[Python-modules-commits] [cherrypy3] 01/15: Import cherrypy3_8.9.1.orig.tar.gz

Stephan Suerken absurd at moszumanska.debian.org
Mon Nov 27 08:40:47 UTC 2017


This is an automated email from the git hooks/post-receive script.

absurd pushed a commit to branch master
in repository cherrypy3.

commit bce9bebc84b185f8b3c8bdb087efbc470eb33200
Author: Stephan Sürken <absurd at debian.org>
Date:   Thu Nov 23 11:07:48 2017 +0100

    Import cherrypy3_8.9.1.orig.tar.gz
---
 .gitignore                         |  3 +++
 .travis.yml                        | 14 ++++++++--
 CHANGES.rst                        | 16 ++++++++++++
 CherryPy.egg-info/PKG-INFO         |  8 +++---
 CherryPy.egg-info/SOURCES.txt      |  2 +-
 CherryPy.egg-info/entry_points.txt |  3 +++
 CherryPy.egg-info/requires.txt     |  2 +-
 PKG-INFO                           |  8 +++---
 README.rst                         |  6 ++---
 cherrypy/__main__.py               |  5 ++--
 cherrypy/cherryd                   |  6 -----
 cherrypy/process/plugins.py        |  1 -
 cherrypy/process/wspbus.py         | 53 +++++++++++++++++++++++++++++++++++++-
 cherrypy/scaffold/__init__.py      |  2 +-
 cherrypy/test/helper.py            | 21 ++++++++++++++-
 setup.py                           |  6 ++---
 16 files changed, 125 insertions(+), 31 deletions(-)

diff --git a/.gitignore b/.gitignore
index 6ace73c..a2ddbf7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,6 @@ sphinx/source/_build
 
 # Ignore useless OS X's dirs:
 .DS_Store
+
+# Py.test
+/.cache/
diff --git a/.travis.yml b/.travis.yml
index d339593..c26b0db 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,7 @@ python:
 - 3.3
 - 3.4
 - 3.5
-- 3.6-dev
+- 3.6
 - pypy
 - pypy3
 - nightly
@@ -21,7 +21,6 @@ matrix:
   include:
     - python: 3.5
       env: TOXENV=pre-commit
-  include:
     - python: 3.5
       env: TOXENV=dist-check
 
@@ -30,6 +29,17 @@ cache: pip
 install: pip install tox
 script: tox
 
+after_failure: >
+  if [[ "$TOXENV" != "pre-commit" ]]
+  then
+    echo Dumping logs, because tests failed to succeed
+    for log in `ls cherrypy/test/*.log`
+    do
+      echo Outputting $log
+      cat $log
+    done
+  fi
+
 deploy:
   provider: pypi
   on:
diff --git a/CHANGES.rst b/CHANGES.rst
index 9c484b4..73f81d7 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,3 +1,19 @@
+v8.9.1
+-----
+
+* #1537: Restore dependency on pywin32 for Python 3.6.
+
+v8.9.0
+-----
+
+* #1547: Replaced ``cherryd`` distutils script with a setuptools
+  console entry point.
+
+  When running CherryPy in daemon mode, the forked process no
+  longer changes directory to ``/``. If that behavior is something
+  on which your application relied and should rely, please file
+  a ticket with the project.
+
 v8.8.0
 -----
 
diff --git a/CherryPy.egg-info/PKG-INFO b/CherryPy.egg-info/PKG-INFO
index 911941e..b49327a 100644
--- a/CherryPy.egg-info/PKG-INFO
+++ b/CherryPy.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: CherryPy
-Version: 8.8.0
+Version: 8.9.1
 Summary: Object-Oriented HTTP framework
 Home-page: http://www.cherrypy.org
 Author: CherryPy Team
@@ -12,11 +12,11 @@ Description: .. image:: https://img.shields.io/pypi/v/cherrypy.svg
         .. image:: https://readthedocs.org/projects/cherrypy/badge/?version=latest
           :target: http://docs.cherrypy.org/en/latest/?badge=latest
         
-        .. image:: https://img.shields.io/travis/cherrypy/cherrypy/master.svg?label=*NIX%20build%20%40%20Travis%20CI
+        .. image:: https://img.shields.io/travis/cherrypy/cherrypy/master.svg?label=Linux%20build%20%40%20Travis%20CI
            :target: http://travis-ci.org/cherrypy/cherrypy
         
-        .. image:: https://img.shields.io/appveyor/ci/jaraco/cherrypy.svg?label=Windows%20build%20%40%20Travis%20CI
-           :target: https://ci.appveyor.com/project/jaraco/cherrypy
+        .. image:: https://img.shields.io/appveyor/ci/jaraco/cherrypy/master.svg?label=Windows%20build%20%40%20Appveyor
+           :target: https://ci.appveyor.com/project/jaraco/cherrypy/branch/master
         
         .. image:: https://img.shields.io/pypi/pyversions/cherrypy.svg
         
diff --git a/CherryPy.egg-info/SOURCES.txt b/CherryPy.egg-info/SOURCES.txt
index 5340df4..8e9da4a 100644
--- a/CherryPy.egg-info/SOURCES.txt
+++ b/CherryPy.egg-info/SOURCES.txt
@@ -13,6 +13,7 @@ tox.ini
 CherryPy.egg-info/PKG-INFO
 CherryPy.egg-info/SOURCES.txt
 CherryPy.egg-info/dependency_links.txt
+CherryPy.egg-info/entry_points.txt
 CherryPy.egg-info/requires.txt
 CherryPy.egg-info/top_level.txt
 cherrypy/__init__.py
@@ -33,7 +34,6 @@ cherrypy/_cptree.py
 cherrypy/_cpwsgi.py
 cherrypy/_cpwsgi_server.py
 cherrypy/_helper.py
-cherrypy/cherryd
 cherrypy/daemon.py
 cherrypy/favicon.ico
 cherrypy/lib/__init__.py
diff --git a/CherryPy.egg-info/entry_points.txt b/CherryPy.egg-info/entry_points.txt
new file mode 100644
index 0000000..044979d
--- /dev/null
+++ b/CherryPy.egg-info/entry_points.txt
@@ -0,0 +1,3 @@
+[console_scripts]
+cherryd = cherrypy.__main__:run
+
diff --git a/CherryPy.egg-info/requires.txt b/CherryPy.egg-info/requires.txt
index 61538fe..711b81e 100644
--- a/CherryPy.egg-info/requires.txt
+++ b/CherryPy.egg-info/requires.txt
@@ -1,6 +1,6 @@
 six
 
-[:sys_platform == "win32" and python_version != "3.6"]
+[:sys_platform == "win32"]
 pypiwin32
 
 [doc]
diff --git a/PKG-INFO b/PKG-INFO
index 911941e..b49327a 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: CherryPy
-Version: 8.8.0
+Version: 8.9.1
 Summary: Object-Oriented HTTP framework
 Home-page: http://www.cherrypy.org
 Author: CherryPy Team
@@ -12,11 +12,11 @@ Description: .. image:: https://img.shields.io/pypi/v/cherrypy.svg
         .. image:: https://readthedocs.org/projects/cherrypy/badge/?version=latest
           :target: http://docs.cherrypy.org/en/latest/?badge=latest
         
-        .. image:: https://img.shields.io/travis/cherrypy/cherrypy/master.svg?label=*NIX%20build%20%40%20Travis%20CI
+        .. image:: https://img.shields.io/travis/cherrypy/cherrypy/master.svg?label=Linux%20build%20%40%20Travis%20CI
            :target: http://travis-ci.org/cherrypy/cherrypy
         
-        .. image:: https://img.shields.io/appveyor/ci/jaraco/cherrypy.svg?label=Windows%20build%20%40%20Travis%20CI
-           :target: https://ci.appveyor.com/project/jaraco/cherrypy
+        .. image:: https://img.shields.io/appveyor/ci/jaraco/cherrypy/master.svg?label=Windows%20build%20%40%20Appveyor
+           :target: https://ci.appveyor.com/project/jaraco/cherrypy/branch/master
         
         .. image:: https://img.shields.io/pypi/pyversions/cherrypy.svg
         
diff --git a/README.rst b/README.rst
index f3e9f43..268036a 100644
--- a/README.rst
+++ b/README.rst
@@ -4,11 +4,11 @@
 .. image:: https://readthedocs.org/projects/cherrypy/badge/?version=latest
   :target: http://docs.cherrypy.org/en/latest/?badge=latest
 
-.. image:: https://img.shields.io/travis/cherrypy/cherrypy/master.svg?label=*NIX%20build%20%40%20Travis%20CI
+.. image:: https://img.shields.io/travis/cherrypy/cherrypy/master.svg?label=Linux%20build%20%40%20Travis%20CI
    :target: http://travis-ci.org/cherrypy/cherrypy
 
-.. image:: https://img.shields.io/appveyor/ci/jaraco/cherrypy.svg?label=Windows%20build%20%40%20Travis%20CI
-   :target: https://ci.appveyor.com/project/jaraco/cherrypy
+.. image:: https://img.shields.io/appveyor/ci/jaraco/cherrypy/master.svg?label=Windows%20build%20%40%20Appveyor
+   :target: https://ci.appveyor.com/project/jaraco/cherrypy/branch/master
 
 .. image:: https://img.shields.io/pypi/pyversions/cherrypy.svg
 
diff --git a/cherrypy/__main__.py b/cherrypy/__main__.py
index b1c9c01..f8c016d 100755
--- a/cherrypy/__main__.py
+++ b/cherrypy/__main__.py
@@ -1,4 +1,5 @@
-import cherrypy.daemon
+from cherrypy.daemon import run
+
 
 if __name__ == '__main__':
-    cherrypy.daemon.run()
+    run()
diff --git a/cherrypy/cherryd b/cherrypy/cherryd
deleted file mode 100755
index 5d271c3..0000000
--- a/cherrypy/cherryd
+++ /dev/null
@@ -1,6 +0,0 @@
-#! /usr/bin/env python
-
-import cherrypy.daemon
-
-if __name__ == '__main__':
-    cherrypy.daemon.run()
diff --git a/cherrypy/process/plugins.py b/cherrypy/process/plugins.py
index 31e7d76..48708f5 100644
--- a/cherrypy/process/plugins.py
+++ b/cherrypy/process/plugins.py
@@ -409,7 +409,6 @@ class Daemonizer(SimplePlugin):
             sys.exit('%s: fork #2 failed: (%d) %s\n'
                      % (sys.argv[0], exc.errno, exc.strerror))
 
-        os.chdir('/')
         os.umask(0)
 
         si = open(self.stdin, 'r')
diff --git a/cherrypy/process/wspbus.py b/cherrypy/process/wspbus.py
index 14b0e0d..4c2d50e 100644
--- a/cherrypy/process/wspbus.py
+++ b/cherrypy/process/wspbus.py
@@ -447,6 +447,57 @@ class Bus(object):
             argc = ctypes.c_int()
 
             ctypes.pythonapi.Py_GetArgcArgv(ctypes.byref(argc), ctypes.byref(argv))
+
+            _argv = argv[:argc.value]
+
+            # The code below is trying to correctly handle special cases.
+            # `-c`'s argument interpreted by Python itself becomes `-c` as
+            # well. Same applies to `-m`. This snippet is trying to survive
+            # at least the case with `-m`
+            # Ref: https://github.com/cherrypy/cherrypy/issues/1545
+            # Ref: python/cpython at 418baf9
+            argv_len, is_command, is_module = len(_argv), False, False
+
+            try:
+                m_ind = _argv.index('-m')
+                if m_ind < argv_len - 1 and _argv[m_ind + 1] in ('-c', '-m'):
+                    """
+                    In some older Python versions `-m`'s argument may be
+                    substituted with `-c`, not `-m`
+                    """
+                    is_module = True
+            except (IndexError, ValueError):
+                m_ind = None
+
+            try:
+                c_ind = _argv.index('-c')
+                if m_ind < argv_len - 1 and _argv[c_ind + 1] == '-c':
+                    is_command = True
+            except (IndexError, ValueError):
+                c_ind = None
+
+            if is_module:
+                """It's containing `-m -m` sequence of arguments"""
+                if is_command and c_ind < m_ind:
+                    """There's `-c -c` before `-m`"""
+                    raise RuntimeError(
+                        "Cannot reconstruct command from '-c'. Ref: "
+                        'https://github.com/cherrypy/cherrypy/issues/1545')
+                # Survive module argument here
+                original_module = sys.argv[0]
+                if not os.access(original_module, os.R_OK):
+                    """There's no such module exist"""
+                    raise AttributeError(
+                        "{} doesn't seem to be a module "
+                        "accessible by current user".format(original_module))
+                del _argv[m_ind:m_ind + 2]  # remove `-m -m`
+                # ... and substitute it with the original module path:
+                _argv.insert(m_ind, original_module)
+            elif is_command:
+                """It's containing just `-c -c` sequence of arguments"""
+                raise RuntimeError(
+                    "Cannot reconstruct command from '-c'. "
+                    'Ref: https://github.com/cherrypy/cherrypy/issues/1545')
         except AttributeError:
             """It looks Py_GetArgcArgv is completely absent in some environments
 
@@ -459,7 +510,7 @@ class Bus(object):
             """
             raise NotImplementedError
         else:
-            return argv[:argc.value]
+            return _argv
 
     @staticmethod
     def _extend_pythonpath(env):
diff --git a/cherrypy/scaffold/__init__.py b/cherrypy/scaffold/__init__.py
index 3ecd8ad..52b40b3 100644
--- a/cherrypy/scaffold/__init__.py
+++ b/cherrypy/scaffold/__init__.py
@@ -8,7 +8,7 @@ then tweak as desired.
 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
 
 """
 
diff --git a/cherrypy/test/helper.py b/cherrypy/test/helper.py
index 1531421..17fe543 100644
--- a/cherrypy/test/helper.py
+++ b/cherrypy/test/helper.py
@@ -473,10 +473,29 @@ server.ssl_private_key: r'%s'
         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]
diff --git a/setup.py b/setup.py
index bdcfb9c..72cb0de 100644
--- a/setup.py
+++ b/setup.py
@@ -59,7 +59,6 @@ packages = [
     'cherrypy.scaffold',
     'cherrypy.wsgiserver',
 ]
-scripts = ['cherrypy/cherryd']
 
 install_requires = [
     'six',
@@ -87,8 +86,7 @@ extras_require = {
     'xcgi': ['flup'],
 
     # http://docs.cherrypy.org/en/latest/advanced.html?highlight=windows#windows-console-events
-    # disabled on Python 3.6 due to #1537
-    ':sys_platform == "win32" and python_version != "3.6"': ['pypiwin32'],
+    ':sys_platform == "win32"': ['pypiwin32'],
 }
 """Feature flags end-users can use in dependencies"""
 
@@ -107,7 +105,7 @@ setup_params = dict(
     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,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/cherrypy3.git



More information about the Python-modules-commits mailing list