summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rwxr-xr-x[-rw-r--r--]setup.py221
1 files changed, 95 insertions, 126 deletions
diff --git a/setup.py b/setup.py
index d4267e09..b3ab3cb6 100644..100755
--- a/setup.py
+++ b/setup.py
@@ -1,135 +1,106 @@
-"""Installs CherryPy using distutils
+#! /usr/bin/env python
+"""CherryPy package setuptools installer."""
-Run:
- python setup.py install
+import io
-to install this package.
-"""
-
-try:
- from setuptools import setup
-except ImportError:
- from distutils.core import setup
-
-from distutils.command.install import INSTALL_SCHEMES
-from distutils.command.build_py import build_py
-import sys
-import re
-
-
-class cherrypy_build_py(build_py):
- """Custom version of build_py that excludes Python-specific modules"""
-
- def build_module(self, module, module_file, package):
- python3 = sys.version_info >= (3,)
- if python3:
- exclude_pattern = re.compile('wsgiserver2|ssl_pyopenssl|'
- '_cpcompat_subprocess')
- else:
- exclude_pattern = re.compile('wsgiserver3')
- if exclude_pattern.match(module):
- return # skip it
- return build_py.build_module(self, module, module_file, package)
+import setuptools
###############################################################################
# arguments for the setup command
###############################################################################
-name = "CherryPy"
-version = "5.2.0"
-desc = "Object-Oriented HTTP framework"
-long_desc = "CherryPy is a pythonic, object-oriented HTTP framework"
+name = 'CherryPy'
+desc = 'Object-Oriented HTTP framework'
+
+with io.open('README.rst', encoding='utf-8') as strm:
+ long_desc = strm.read()
+
classifiers = [
- "Development Status :: 5 - Production/Stable",
- "Environment :: Web Environment",
- "Intended Audience :: Developers",
- "License :: Freely Distributable",
- "Operating System :: OS Independent",
- "Framework :: CherryPy",
- "License :: OSI Approved :: BSD License",
- "Programming Language :: Python",
- "Programming Language :: Python :: 2",
- "Programming Language :: Python :: 2.6",
- "Programming Language :: Python :: 2.7",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.1",
- "Programming Language :: Python :: 3.2",
- "Programming Language :: Python :: 3.3",
- "Programming Language :: Python :: 3.4",
- "Programming Language :: Python :: 3.5",
- "Programming Language :: Python :: Implementation",
- "Programming Language :: Python :: Implementation :: CPython",
- "Programming Language :: Python :: Implementation :: Jython",
- "Programming Language :: Python :: Implementation :: PyPy",
- "Topic :: Internet :: WWW/HTTP",
- "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
- "Topic :: Internet :: WWW/HTTP :: HTTP Servers",
- "Topic :: Internet :: WWW/HTTP :: WSGI",
- "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
- "Topic :: Internet :: WWW/HTTP :: WSGI :: Server",
- "Topic :: Software Development :: Libraries :: Application Frameworks",
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: Freely Distributable',
+ 'Operating System :: OS Independent',
+ 'Framework :: CherryPy',
+ 'License :: OSI Approved :: BSD License',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: Implementation',
+ 'Programming Language :: Python :: Implementation :: CPython',
+ 'Programming Language :: Python :: Implementation :: Jython',
+ 'Programming Language :: Python :: Implementation :: PyPy',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
+ 'Topic :: Internet :: WWW/HTTP :: HTTP Servers',
+ 'Topic :: Internet :: WWW/HTTP :: WSGI',
+ 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application',
+ 'Topic :: Internet :: WWW/HTTP :: WSGI :: Server',
+ 'Topic :: Software Development :: Libraries :: Application Frameworks',
]
-author = "CherryPy Team"
-author_email = "team@cherrypy.org"
-url = "http://www.cherrypy.org"
-cp_license = "BSD"
+author = 'CherryPy Team'
+author_email = 'team@cherrypy.org'
+url = 'http://www.cherrypy.org'
+cp_license = 'BSD'
packages = [
- "cherrypy", "cherrypy.lib",
- "cherrypy.tutorial", "cherrypy.test",
- "cherrypy.process",
- "cherrypy.scaffold",
- "cherrypy.wsgiserver",
+ 'cherrypy', 'cherrypy.lib',
+ 'cherrypy.tutorial', 'cherrypy.test',
+ 'cherrypy.process',
+ 'cherrypy.scaffold',
]
-data_files = [
- ('cherrypy', ['cherrypy/cherryd',
- 'cherrypy/favicon.ico',
- 'cherrypy/LICENSE.txt',
- ]),
- ('cherrypy/process', []),
- ('cherrypy/scaffold', ['cherrypy/scaffold/example.conf',
- 'cherrypy/scaffold/site.conf',
- ]),
- ('cherrypy/scaffold/static', [
- 'cherrypy/scaffold/static/made_with_cherrypy_small.png']),
- ('cherrypy/test', ['cherrypy/test/style.css',
- 'cherrypy/test/test.pem',
- ]),
- ('cherrypy/test/static', ['cherrypy/test/static/index.html',
- 'cherrypy/test/static/dirback.jpg', ]),
- ('cherrypy/tutorial',
- [
- 'cherrypy/tutorial/tutorial.conf',
- 'cherrypy/tutorial/README.txt',
- 'cherrypy/tutorial/pdf_file.pdf',
- 'cherrypy/tutorial/custom_error.html',
- ]
- ),
-]
-scripts = ["cherrypy/cherryd"]
-cmd_class = dict(
- build_py=cherrypy_build_py,
-)
+# install requirements must not contain namespace
+# packages. See #1673
+install_requires = [
+ 'six>=1.11.0',
+ 'cheroot>=5.9.1',
+ 'portend>=2.1.1',
+]
-if sys.version_info >= (3, 0):
- required_python_version = '3.1'
-else:
- required_python_version = '2.6'
+extras_require = {
+ 'docs': [
+ 'sphinx',
+ 'docutils',
+ 'alabaster',
+ 'rst.linker>=1.9',
+ 'jaraco.packaging>=3.2',
+ ],
+ 'json': ['simplejson'],
+ 'routes_dispatcher': ['routes>=2.3.1'],
+ 'ssl': ['pyOpenSSL'],
+ 'testing': [
+ 'coverage', # inspects tests coverage
+ 'codecov', # sends tests coverage to codecov.io
+
+ # cherrypy.lib.gctools
+ 'objgraph',
+
+ 'pytest>=2.8',
+ 'pytest-cov',
+ 'pytest-sugar',
+ 'backports.unittest_mock',
+ 'path.py',
+ ],
+ # Enables memcached session support via `cherrypy[memcached_session]`:
+ 'memcached_session': ['python-memcached>=1.58'],
+ 'xcgi': ['flup'],
+
+ # http://docs.cherrypy.org/en/latest/advanced.html?highlight=windows#windows-console-events
+ ':sys_platform == "win32"': ['pypiwin32'],
+}
+"""Feature flags end-users can use in dependencies"""
###############################################################################
# end arguments for setup
###############################################################################
-# wininst may install data_files in Python/x.y instead of the cherrypy package.
-# Django's solution is at http://code.djangoproject.com/changeset/8313
-# See also
-# http://mail.python.org/pipermail/distutils-sig/2004-August/004134.html
-if 'bdist_wininst' in sys.argv or '--format=wininst' in sys.argv:
- data_files = [(r'\PURELIB\%s' % path, files) for path, files in data_files]
-
setup_params = dict(
name=name,
- version=version,
+ use_scm_version=True,
description=desc,
long_description=long_desc,
classifiers=classifiers,
@@ -138,23 +109,21 @@ setup_params = dict(
url=url,
license=cp_license,
packages=packages,
- data_files=data_files,
- scripts=scripts,
- cmdclass=cmd_class,
+ entry_points={'console_scripts': ['cherryd = cherrypy.__main__:run']},
+ include_package_data=True,
+ install_requires=install_requires,
+ extras_require=extras_require,
+ setup_requires=[
+ 'setuptools_scm',
+ ],
+ python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
)
-def main():
- if sys.version < required_python_version:
- s = "I'm sorry, but %s %s requires Python %s or later."
- print(s % (name, version, required_python_version))
- sys.exit(1)
- # set default location for "data_files" to
- # platform specific "site-packages" location
- for scheme in list(INSTALL_SCHEMES.values()):
- scheme['data'] = scheme['purelib']
- setup(**setup_params)
+def main():
+ """Package installation entry point."""
+ setuptools.setup(**setup_params)
-if __name__ == "__main__":
+if __name__ == '__main__':
main()