Permalink
Browse files

Convert cherryd script into console_script

Also:
* remove ``cherrypy/cherryd``
* run cherryd as cherrypy.__main__ module to support Python 2.6
  • Loading branch information...
1 parent db152f6 commit 116dc27e319e882a2c6edabb1c224d048a0078cd @webknjaz webknjaz committed Jan 7, 2017
Showing with 25 additions and 11 deletions.
  1. +3 −2 cherrypy/__main__.py
  2. +0 −6 cherrypy/cherryd
  3. +1 −1 cherrypy/scaffold/__init__.py
  4. +20 −1 cherrypy/test/helper.py
  5. +1 −1 setup.py
@@ -1,4 +1,5 @@
-import cherrypy.daemon
+from cherrypy.daemon import run
+
if __name__ == '__main__':
- cherrypy.daemon.run()
+ run()
View
@@ -1,6 +0,0 @@
-#! /usr/bin/env python
-
-import cherrypy.daemon
-
-if __name__ == '__main__':
- cherrypy.daemon.run()
@@ -8,7 +8,7 @@
Even before any tweaking, this should serve a few demonstration pages.
Change to this directory and run:
- ../cherryd -c site.conf
+ cherryd -c site.conf
"""
@@ -473,10 +473,29 @@ def start(self, imports=None):
cherrypy._cpserver.wait_for_free_port(self.host, self.port)
args = [
- os.path.join(thisdir, '..', 'cherryd'),
+ '-m',
+ 'cherrypy.__main__', # __main__ is needed for `-m` in Python 2.6
'-c', self.config_file,
'-p', self.pid_file,
]
+ """
+ Command for running cherryd server with autoreload enabled
+
+ Using
+
+ ```
+ ['-c',
+ "__requires__ = 'CherryPy'; \
+ import pkg_resources, re, sys; \
+ sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]); \
+ sys.exit(\
+ pkg_resources.load_entry_point(\
+ 'CherryPy', 'console_scripts', 'cherryd')())"]
+ ```
+
+ doesn't work as it's impossible to reconstruct the `-c`'s contents.
+ Ref: https://github.com/cherrypy/cherrypy/issues/1545
+ """
if not isinstance(imports, (list, tuple)):
imports = [imports]
View
@@ -107,7 +107,7 @@
url=url,
license=cp_license,
packages=packages,
- scripts=scripts,
+ entry_points={"console_scripts": ["cherryd = cherrypy.__main__:run"]},
include_package_data=True,
install_requires=install_requires,
extras_require=extras_require,

0 comments on commit 116dc27

Please sign in to comment.