diff options
author | Michael Merickel <michael@merickel.org> | 2022-05-15 18:46:47 -0500 |
---|---|---|
committer | Michael Merickel <michael@merickel.org> | 2022-05-15 19:55:08 -0500 |
commit | c666acbfa11257abed3395e433d5d0af8a35e260 (patch) | |
tree | d7858ed83b2890638eb5810d7629cac5b946e9d4 | |
parent | 0fae4f855bbb356a84f1a2d67d89c75463b131ae (diff) | |
download | pastedeploy-git-c666acbfa11257abed3395e433d5d0af8a35e260.tar.gz |
refactor package info to setup.cfg, run pyupgrade
-rw-r--r-- | MANIFEST.in | 11 | ||||
-rw-r--r-- | paste/deploy/config.py | 8 | ||||
-rw-r--r-- | paste/deploy/loadwsgi.py | 14 | ||||
-rw-r--r-- | paste/deploy/util.py | 2 | ||||
-rw-r--r-- | pyproject.toml | 3 | ||||
-rw-r--r-- | setup.cfg | 70 | ||||
-rw-r--r-- | setup.py | 69 | ||||
-rw-r--r-- | tests/fake_packages/FakeApp.egg/fakeapp/apps.py | 4 | ||||
-rw-r--r-- | tests/fake_packages/FakeApp.egg/fakeapp/configapps.py | 2 |
9 files changed, 97 insertions, 86 deletions
diff --git a/MANIFEST.in b/MANIFEST.in index 8586f10..938fb5c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,7 +1,14 @@ -include docs/*.txt -include license.txt +graft .github graft tests graft paste/deploy/paster_templates +include docs/*.txt +include license.txt +include pytest.ini +include tox.ini +include rtd.txt +include pyproject.toml +include contributing.md + global-exclude __pycache__ *.py[cod] global-exclude .DS_Store diff --git a/paste/deploy/config.py b/paste/deploy/config.py index a503007..f448350 100644 --- a/paste/deploy/config.py +++ b/paste/deploy/config.py @@ -24,7 +24,7 @@ def local_dict(): return result -class DispatchingConfig(object): +class DispatchingConfig: """ This is a configuration object that can be used globally, @@ -135,7 +135,7 @@ class DispatchingConfig(object): CONFIG = DispatchingConfig() -class ConfigMiddleware(object): +class ConfigMiddleware: """ A WSGI middleware that adds a ``paste.config`` key to the request @@ -194,7 +194,7 @@ def make_config_filter(app, global_conf, **local_conf): make_config_middleware = ConfigMiddleware.__doc__ -class PrefixMiddleware(object): +class PrefixMiddleware: """Translate a given prefix into a SCRIPT_NAME for the filtered application. @@ -277,7 +277,7 @@ class PrefixMiddleware(object): if self.force_port is not None: host = environ.get('HTTP_HOST', '').split(':', 1)[0] if self.force_port: - host = '%s:%s' % (host, self.force_port) + host = f'{host}:{self.force_port}' environ['SERVER_PORT'] = str(self.force_port) else: if environ['wsgi.url_scheme'] == 'http': diff --git a/paste/deploy/loadwsgi.py b/paste/deploy/loadwsgi.py index 2c8f827..78c5956 100644 --- a/paste/deploy/loadwsgi.py +++ b/paste/deploy/loadwsgi.py @@ -82,12 +82,12 @@ class NicerConfigParser(ConfigParser): except Exception: e = sys.exc_info()[1] args = list(e.args) - args[0] = 'Error in file %s: %s' % (self.filename, e) + args[0] = f'Error in file {self.filename}: {e}' e.args = tuple(args) e.message = args[0] raise - class InterpolateWrapper(object): + class InterpolateWrapper: # Python >= 3.2 def __init__(self, original): self._original = original @@ -102,7 +102,7 @@ class NicerConfigParser(ConfigParser): except Exception: e = sys.exc_info()[1] args = list(e.args) - args[0] = 'Error in file %s: %s' % (parser.filename, e) + args[0] = f'Error in file {parser.filename}: {e}' e.args = tuple(args) e.message = args[0] raise @@ -113,7 +113,7 @@ class NicerConfigParser(ConfigParser): ############################################################ -class _ObjectType(object): +class _ObjectType: name = None egg_protocols = None @@ -125,7 +125,7 @@ class _ObjectType(object): self.config_prefixes = [_aslist(p) for p in _aslist(self.config_prefixes)] def __repr__(self): - return '<%s protocols=%r prefixes=%r>' % ( + return '<{} protocols={!r} prefixes={!r}>'.format( self.name, self.egg_protocols, self.config_prefixes) def invoke(self, context): @@ -349,7 +349,7 @@ _loaders['call'] = _loadfunc ############################################################ -class _Loader(object): +class _Loader: def get_app(self, name=None, global_conf=None): return self.app_context( @@ -694,7 +694,7 @@ class FuncLoader(_Loader): ) -class LoaderContext(object): +class LoaderContext: def __init__(self, obj, object_type, protocol, global_conf, local_conf, loader, diff --git a/paste/deploy/util.py b/paste/deploy/util.py index 2a56a07..d30466a 100644 --- a/paste/deploy/util.py +++ b/paste/deploy/util.py @@ -33,7 +33,7 @@ def fix_type_error(exc_info, callable, varargs, kwargs): kwargs = sorted(kwargs.items()) args += ', '.join(['%s=...' % n for n, v in kwargs]) gotspec = '(%s)' % args - msg = '%s; got %s, wanted %s' % (exc_info[1], gotspec, argspec) + msg = f'{exc_info[1]}; got {gotspec}, wanted {argspec}' exc_info[1].args = (msg,) return exc_info diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..89a9175 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools >= 41"] +build-backend = "setuptools.build_meta" @@ -1,2 +1,68 @@ -[wheel] -universal = true +[metadata] +name = PasteDeploy +version = 2.1.1 +author = Ian Bicking +author_email = pylons-discuss@googlegroups.com +maintainer = Chris Dent +maintainer_email = pylons-discuss@googlegroups.com +license = MIT +description = Load, configure, and compose WSGI applications and servers +keywords = + web + wsgi + application + server +url = https://docs.pylonsproject.org/projects/pastedeploy/en/latest/ +long_description = file: README.rst +long_description_content_type = text/x-rst +classifiers = + Development Status :: 6 - Mature + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Programming Language :: Python + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: Implementation :: CPython + Programming Language :: Python :: Implementation :: PyPy + Topic :: Internet :: WWW/HTTP + Topic :: Internet :: WWW/HTTP :: Dynamic Content + Topic :: Internet :: WWW/HTTP :: WSGI + Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware + Topic :: Software Development :: Libraries :: Python Modules + Framework :: Paste +project_urls = + Documentation = https://docs.pylonsproject.org/projects/pastedeploy/en/latest/ + Changelog = https://docs.pylonsproject.org/projects/pastedeploy/en/latest/news.html + Issue Tracker = https://github.com/Pylons/pastedeploy/issues + +[options] +packages = find: +zip_safe = False +install_requires = + setuptools +include_package_data = True +namespace_packages = + paste + +[options.packages.find] +exclude = + tests + +[options.extras_require] +config = +paste = + Paste +docs = + Sphinx >= 1.7.5 + pylons-sphinx-themes + +[options.entry_points] +paste.filter_app_factory = + config = paste.deploy.config:make_config_filter [Config] + prefix = paste.deploy.config:make_prefix_middleware + +paste.paster_create_template = + paste_deploy = paste.deploy.paster_templates:PasteDeploy @@ -1,68 +1,3 @@ -import os +from setuptools import setup -from setuptools import setup, find_packages - -here = os.path.dirname(__file__) -readme_path = os.path.join(here, "README.rst") -readme = open(readme_path).read() - -docs_extras = [ - "Sphinx >= 1.7.5", # Read The Docs minimum version - "pylons-sphinx-themes", -] - -setup( - name="PasteDeploy", - version="3.0.dev0", - description="Load, configure, and compose WSGI applications and servers", - long_description=readme, - classifiers=[ - "Development Status :: 6 - Mature", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Internet :: WWW/HTTP :: Dynamic Content", - "Topic :: Internet :: WWW/HTTP :: WSGI", - "Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware", - "Topic :: Software Development :: Libraries :: Python Modules", - "Framework :: Paste", - ], - keywords="web wsgi application server", - author="Ian Bicking", - author_email="pylons-discuss@googlegroups.com", - maintainer="Chris Dent", - maintainer_email="pylons-discuss@googlegroups.com", - url="https://pylonsproject.org/", - project_urls={ - "Documentation": "https://docs.pylonsproject.org/projects/pastedeploy/en/latest/", - "Changelog": "https://docs.pylonsproject.org/projects/pastedeploy/en/latest/news.html", - "Issue Tracker": "https://github.com/Pylons/pastedeploy/issues", - }, - license="MIT", - namespace_packages=["paste"], - packages=find_packages(exclude=["tests"]), - include_package_data=True, - zip_safe=False, - install_requires=['setuptools'], - extras_require={ - "Config": [], - "Paste": ["Paste"], - "docs": docs_extras, - }, - entry_points=""" - [paste.filter_app_factory] - config = paste.deploy.config:make_config_filter [Config] - prefix = paste.deploy.config:make_prefix_middleware - - [paste.paster_create_template] - paste_deploy=paste.deploy.paster_templates:PasteDeploy - """ -) +setup() diff --git a/tests/fake_packages/FakeApp.egg/fakeapp/apps.py b/tests/fake_packages/FakeApp.egg/fakeapp/apps.py index cae7eba..9ab5183 100644 --- a/tests/fake_packages/FakeApp.egg/fakeapp/apps.py +++ b/tests/fake_packages/FakeApp.egg/fakeapp/apps.py @@ -35,7 +35,7 @@ def make_remote_addr(loader, global_conf, **conf): dispatcher.map[addrs[name]] = apps[name] return dispatcher -class RemoteAddrDispatch(object): +class RemoteAddrDispatch: def __init__(self, map=None): self.map = map or {} @@ -53,7 +53,7 @@ def make_cap_filter(global_conf, method_to_call='upper'): return CapFilter(app, global_conf, method_to_call) return cap_filter -class CapFilter(object): +class CapFilter: def __init__(self, app, global_conf, method_to_call='upper'): self.app = app diff --git a/tests/fake_packages/FakeApp.egg/fakeapp/configapps.py b/tests/fake_packages/FakeApp.egg/fakeapp/configapps.py index ef13182..8e125e8 100644 --- a/tests/fake_packages/FakeApp.egg/fakeapp/configapps.py +++ b/tests/fake_packages/FakeApp.egg/fakeapp/configapps.py @@ -1,4 +1,4 @@ -class SimpleApp(object): +class SimpleApp: def __init__(self, global_conf, local_conf, name): self.global_conf = global_conf self.local_conf = local_conf |