aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/dist.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/dist.py')
-rw-r--r--setuptools/dist.py57
1 files changed, 30 insertions, 27 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 27cf8501..bfdbb3b5 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -79,7 +79,7 @@ sequence = tuple, list
def check_importable(dist, attr, value):
try:
- ep = pkg_resources.EntryPoint.parse('x='+value)
+ ep = pkg_resources.EntryPoint.parse('x=' + value)
assert not ep.extras
except (TypeError, ValueError, AttributeError, AssertionError):
raise DistutilsSetupError(
@@ -91,7 +91,7 @@ def check_importable(dist, attr, value):
def assert_string_list(dist, attr, value):
"""Verify that value is a string list or None"""
try:
- assert ''.join(value)!=value
+ assert ''.join(value) != value
except (TypeError, ValueError, AttributeError, AssertionError):
raise DistutilsSetupError(
"%r must be a list of strings (got %r)" % (attr, value)
@@ -123,7 +123,7 @@ def check_extras(dist, attr, value):
if ':' in k:
k, m = k.split(':', 1)
if pkg_resources.invalid_marker(m):
- raise DistutilsSetupError("Invalid environment marker: "+m)
+ raise DistutilsSetupError("Invalid environment marker: " + m)
list(pkg_resources.parse_requirements(v))
except (TypeError, ValueError, AttributeError):
raise DistutilsSetupError(
@@ -181,14 +181,16 @@ def check_package_data(dist, attr, value):
"""Verify that value is a dictionary of package names to glob lists"""
if isinstance(value, dict):
for k, v in value.items():
- if not isinstance(k, str): break
- try: iter(v)
+ if not isinstance(k, str):
+ break
+ try:
+ iter(v)
except TypeError:
break
else:
return
raise DistutilsSetupError(
- attr+" must be a dictionary mapping package names to lists of "
+ attr + " must be a dictionary mapping package names to lists of "
"wildcard patterns"
)
@@ -341,7 +343,7 @@ class Distribution(_Distribution):
def _feature_attrname(self, name):
"""Convert feature name to corresponding option attribute name"""
- return 'with_'+name.replace('-', '_')
+ return 'with_' + name.replace('-', '_')
def fetch_build_eggs(self, requires):
"""Resolve pre-setup requirements"""
@@ -430,13 +432,13 @@ class Distribution(_Distribution):
if feature.optional:
descr = feature.description
incdef = ' (default)'
- excdef=''
+ excdef = ''
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))
- no['without-'+name] = 'with-'+name
+ go.append(('with-' + name, None, 'include ' + descr + incdef))
+ go.append(('without-' + name, None, 'exclude ' + descr + excdef))
+ no['without-' + name] = 'with-' + name
self.global_options = self.feature_options = go + self.global_options
self.negative_opt = self.feature_negopt = no
@@ -497,7 +499,7 @@ class Distribution(_Distribution):
def include_feature(self, name):
"""Request inclusion of feature named 'name'"""
- if self.feature_is_included(name)==0:
+ if self.feature_is_included(name) == 0:
descr = self.features[name].description
raise DistutilsOptionError(
descr + " is required, but was excluded or is not available"
@@ -521,7 +523,7 @@ class Distribution(_Distribution):
handle whatever special inclusion logic is needed.
"""
for k, v in attrs.items():
- include = getattr(self, '_include_'+k, None)
+ include = getattr(self, '_include_' + k, None)
if include:
include(v)
else:
@@ -530,7 +532,7 @@ class Distribution(_Distribution):
def exclude_package(self, package):
"""Remove packages, modules, and extensions in named package"""
- pfx = package+'.'
+ pfx = package + '.'
if self.packages:
self.packages = [
p for p in self.packages
@@ -552,10 +554,10 @@ class Distribution(_Distribution):
def has_contents_for(self, package):
"""Return true if 'exclude_package(package)' would do something"""
- pfx = package+'.'
+ pfx = package + '.'
for p in self.iter_distribution_names():
- if p==package or p.startswith(pfx):
+ if p == package or p.startswith(pfx):
return True
def _exclude_misc(self, name, value):
@@ -572,7 +574,7 @@ class Distribution(_Distribution):
)
if old is not None and not isinstance(old, sequence):
raise DistutilsSetupError(
- name+": this setting cannot be changed via include/exclude"
+ name + ": this setting cannot be changed via include/exclude"
)
elif old:
setattr(self, name, [item for item in old if item not in value])
@@ -594,10 +596,10 @@ class Distribution(_Distribution):
setattr(self, name, value)
elif not isinstance(old, sequence):
raise DistutilsSetupError(
- name+": this setting cannot be changed via include/exclude"
+ name + ": this setting cannot be changed via include/exclude"
)
else:
- setattr(self, name, old+[item for item in value if item not in old])
+ setattr(self, name, old + [item for item in value if item not in old])
def exclude(self, **attrs):
"""Remove items from distribution that are named in keyword arguments
@@ -616,7 +618,7 @@ class Distribution(_Distribution):
handle whatever special exclusion logic is needed.
"""
for k, v in attrs.items():
- exclude = getattr(self, '_exclude_'+k, None)
+ exclude = getattr(self, '_exclude_' + k, None)
if exclude:
exclude(v)
else:
@@ -676,19 +678,19 @@ class Distribution(_Distribution):
opt = opt.replace('_', '-')
- if val==0:
+ if val == 0:
cmdobj = self.get_command_obj(cmd)
neg_opt = self.negative_opt.copy()
neg_opt.update(getattr(cmdobj, 'negative_opt', {}))
for neg, pos in neg_opt.items():
- if pos==opt:
- opt=neg
- val=None
+ if pos == opt:
+ opt = neg
+ val = None
break
else:
raise AssertionError("Shouldn't be able to get here")
- elif val==1:
+ elif val == 1:
val = None
d.setdefault(cmd, {})[opt] = val
@@ -835,7 +837,8 @@ class Feature:
r for r in require_features if isinstance(r, str)
]
er = [r for r in require_features if not isinstance(r, str)]
- if er: extras['require_features'] = er
+ if er:
+ extras['require_features'] = er
if isinstance(remove, str):
remove = remove,
@@ -863,7 +866,7 @@ class Feature:
if not self.available:
raise DistutilsPlatformError(
- self.description+" is required, "
+ self.description + " is required, "
"but is not available on this platform"
)