Commit 986a8bce authored by Jason R. Coombs's avatar Jason R. Coombs

Delint

parent 1bbb027f
......@@ -11,17 +11,15 @@ import distutils.dist
import itertools
import operator
from collections import defaultdict
from distutils.errors import (DistutilsOptionError, DistutilsPlatformError,
DistutilsSetupError)
from distutils.errors import (
DistutilsOptionError, DistutilsPlatformError, DistutilsSetupError,
)
from distutils.util import rfc822_escape
from setuptools.extern import six
from setuptools.extern.six.moves import map, filter
from pkg_resources.extern import packaging
__import__('pkg_resources.extern.packaging.specifiers')
__import__('pkg_resources.extern.packaging.version')
from setuptools.depends import Require
from setuptools import windows_support
from setuptools.monkey import get_unpatched
......@@ -29,6 +27,9 @@ from setuptools.config import parse_configuration
import pkg_resources
from .py36compat import Distribution_parse_config_files
__import__('pkg_resources.extern.packaging.specifiers')
__import__('pkg_resources.extern.packaging.version')
def _get_unpatched(cls):
warnings.warn("Do not call this function", DeprecationWarning)
......@@ -364,7 +365,8 @@ class Distribution(Distribution_parse_config_files, _Distribution):
self._finalize_requires()
def _finalize_requires(self):
"""Move requirements in `install_requires` that
"""
Move requirements in `install_requires` that
are using environment markers to `extras_require`.
"""
if not self.install_requires:
......@@ -380,7 +382,7 @@ class Distribution(Distribution_parse_config_files, _Distribution):
install_requires.append(r)
continue
r.marker = None
extras_require[':'+str(marker)].append(r)
extras_require[':' + str(marker)].append(r)
self.extras_require = dict(
(k, [str(r) for r in v])
for k, v in extras_require.items()
......@@ -432,7 +434,10 @@ class Distribution(Distribution_parse_config_files, _Distribution):
ep.load()(self, ep.name, value)
if getattr(self, 'convert_2to3_doctests', None):
# XXX may convert to set here when we can rely on set being builtin
self.convert_2to3_doctests = [os.path.abspath(p) for p in self.convert_2to3_doctests]
self.convert_2to3_doctests = [
os.path.abspath(p)
for p in self.convert_2to3_doctests
]
else:
self.convert_2to3_doctests = []
......@@ -476,7 +481,8 @@ class Distribution(Distribution_parse_config_files, _Distribution):
opts['find_links'] = ('setup', links)
install_dir = self.get_egg_cache_dir()
cmd = easy_install(
dist, args=["x"], install_dir=install_dir, exclude_scripts=True,
dist, args=["x"], install_dir=install_dir,
exclude_scripts=True,
always_copy=False, build_directory=None, editable=False,
upgrade=False, multi_version=True, no_report=True, user=False
)
......@@ -501,8 +507,11 @@ class Distribution(Distribution_parse_config_files, _Distribution):
if not feature.include_by_default():
excdef, incdef = incdef, excdef
go.append(('with-' + name, None, 'include ' + descr + incdef))
go.append(('without-' + name, None, 'exclude ' + descr + excdef))
new = (
('with-' + name, None, 'include ' + descr + incdef),
('without-' + name, None, 'exclude ' + descr + excdef),
)
go.extend(new)
no['without-' + name] = 'with-' + name
self.global_options = self.feature_options = go + self.global_options
......@@ -530,7 +539,8 @@ class Distribution(Distribution_parse_config_files, _Distribution):
if command in self.cmdclass:
return self.cmdclass[command]
for ep in pkg_resources.iter_entry_points('distutils.commands', command):
eps = pkg_resources.iter_entry_points('distutils.commands', command)
for ep in eps:
ep.require(installer=self.fetch_build_egg)
self.cmdclass[command] = cmdclass = ep.load()
return cmdclass
......@@ -664,7 +674,8 @@ class Distribution(Distribution_parse_config_files, _Distribution):
name + ": this setting cannot be changed via include/exclude"
)
else:
setattr(self, name, old + [item for item in value if item not in old])
new = [item for item in value if item not in old]
setattr(self, name, old + new)
def exclude(self, **attrs):
"""Remove items from distribution that are named in keyword arguments
......@@ -875,14 +886,14 @@ class Feature:
@staticmethod
def warn_deprecated():
warnings.warn(
msg = (
"Features are deprecated and will be removed in a future "
"version. See https://github.com/pypa/setuptools/issues/65.",
DeprecationWarning,
stacklevel=3,
"version. See https://github.com/pypa/setuptools/issues/65."
)
warnings.warn(msg, DeprecationWarning, stacklevel=3)
def __init__(self, description, standard=False, available=True,
def __init__(
self, description, standard=False, available=True,
optional=True, require_features=(), remove=(), **extras):
self.warn_deprecated()
......@@ -907,8 +918,8 @@ class Feature:
if not remove and not require_features and not extras:
raise DistutilsSetupError(
"Feature %s: must define 'require_features', 'remove', or at least one"
" of 'packages', 'py_modules', etc."
"Feature %s: must define 'require_features', 'remove', or "
"at least one of 'packages', 'py_modules', etc."
)
def include_by_default(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment