aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/dist.py
diff options
context:
space:
mode:
authorstepshal <nessento@openmailbox.org>2016-07-14 09:26:06 +0700
committerstepshal <nessento@openmailbox.org>2016-07-14 09:28:52 +0700
commitf749ccab1e55723848946c9aba5c3eddebe0b24e (patch)
treecbec0027e0b718ae6844e3c4eddb71574c33dae0 /setuptools/dist.py
parent45de6ea8b9392771a6a14e012605614a7c148506 (diff)
downloadexternal_python_setuptools-f749ccab1e55723848946c9aba5c3eddebe0b24e.tar.gz
external_python_setuptools-f749ccab1e55723848946c9aba5c3eddebe0b24e.tar.bz2
external_python_setuptools-f749ccab1e55723848946c9aba5c3eddebe0b24e.zip
Add missing whitespace.
Diffstat (limited to 'setuptools/dist.py')
-rw-r--r--setuptools/dist.py136
1 files changed, 68 insertions, 68 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py
index ee85cf52..f229d726 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -67,10 +67,10 @@ def check_importable(dist, attr, value):
try:
ep = pkg_resources.EntryPoint.parse('x='+value)
assert not ep.extras
- except (TypeError,ValueError,AttributeError,AssertionError):
+ except (TypeError, ValueError, AttributeError, AssertionError):
raise DistutilsSetupError(
"%r must be importable 'module:attrs' string (got %r)"
- % (attr,value)
+ % (attr, value)
)
@@ -78,15 +78,15 @@ def assert_string_list(dist, attr, value):
"""Verify that value is a string list or None"""
try:
assert ''.join(value)!=value
- except (TypeError,ValueError,AttributeError,AssertionError):
+ except (TypeError, ValueError, AttributeError, AssertionError):
raise DistutilsSetupError(
- "%r must be a list of strings (got %r)" % (attr,value)
+ "%r must be a list of strings (got %r)" % (attr, value)
)
def check_nsp(dist, attr, value):
"""Verify that namespace packages are valid"""
- assert_string_list(dist,attr,value)
+ assert_string_list(dist, attr, value)
for nsp in value:
if not dist.has_contents_for(nsp):
raise DistutilsSetupError(
@@ -105,13 +105,13 @@ def check_nsp(dist, attr, value):
def check_extras(dist, attr, value):
"""Verify that extras_require mapping is valid"""
try:
- for k,v in value.items():
+ for k, v in value.items():
if ':' in k:
- k,m = k.split(':',1)
+ k, m = k.split(':', 1)
if pkg_resources.invalid_marker(m):
raise DistutilsSetupError("Invalid environment marker: "+m)
list(pkg_resources.parse_requirements(v))
- except (TypeError,ValueError,AttributeError):
+ except (TypeError, ValueError, AttributeError):
raise DistutilsSetupError(
"'extras_require' must be a dictionary whose values are "
"strings or lists of strings containing valid project/version "
@@ -153,9 +153,9 @@ def check_test_suite(dist, attr, value):
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
+ if isinstance(value, dict):
+ for k, v in value.items():
+ if not isinstance(k, str): break
try: iter(v)
except TypeError:
break
@@ -274,12 +274,12 @@ class Distribution(_Distribution):
# Make sure we have any eggs needed to interpret 'attrs'
if attrs is not None:
self.dependency_links = attrs.pop('dependency_links', [])
- assert_string_list(self,'dependency_links',self.dependency_links)
+ assert_string_list(self, 'dependency_links', self.dependency_links)
if attrs and 'setup_requires' in attrs:
self.fetch_build_eggs(attrs['setup_requires'])
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
vars(self).setdefault(ep.name, None)
- _Distribution.__init__(self,attrs)
+ _Distribution.__init__(self, attrs)
if isinstance(self.metadata.version, numbers.Number):
# Some people apparently take "version number" too literally :)
self.metadata.version = str(self.metadata.version)
@@ -311,9 +311,9 @@ class Distribution(_Distribution):
self._finalize_features()
return result
- def _feature_attrname(self,name):
+ 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"""
@@ -331,7 +331,7 @@ class Distribution(_Distribution):
self._set_global_opts_from_features()
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'):
- value = getattr(self,ep.name,None)
+ value = getattr(self, ep.name, None)
if value is not None:
ep.require(installer=self.fetch_build_egg)
ep.load()(self, ep.name, value)
@@ -364,7 +364,7 @@ class Distribution(_Distribution):
cmd.package_index.to_scan = []
except AttributeError:
from setuptools.command.easy_install import easy_install
- dist = self.__class__({'script_args':['easy_install']})
+ dist = self.__class__({'script_args': ['easy_install']})
dist.parse_config_files()
opts = dist.get_option_dict('easy_install')
keep = (
@@ -395,8 +395,8 @@ class Distribution(_Distribution):
go = []
no = self.negative_opt.copy()
- for name,feature in self.features.items():
- self._set_feature(name,None)
+ for name, feature in self.features.items():
+ self._set_feature(name, None)
feature.validate(self)
if feature.optional:
@@ -417,25 +417,25 @@ class Distribution(_Distribution):
"""Add/remove features and resolve dependencies between them"""
# First, flag all the enabled items (and thus their dependencies)
- for name,feature in self.features.items():
+ for name, feature in self.features.items():
enabled = self.feature_is_included(name)
if enabled or (enabled is None and feature.include_by_default()):
feature.include_in(self)
- self._set_feature(name,1)
+ self._set_feature(name, 1)
# Then disable the rest, so that off-by-default features don't
# get flagged as errors when they're required by an enabled feature
- for name,feature in self.features.items():
+ for name, feature in self.features.items():
if not self.feature_is_included(name):
feature.exclude_from(self)
- self._set_feature(name,0)
+ self._set_feature(name, 0)
def get_command_class(self, command):
"""Pluggable version of get_command_class()"""
if command in self.cmdclass:
return self.cmdclass[command]
- for ep in pkg_resources.iter_entry_points('distutils.commands',command):
+ for ep in pkg_resources.iter_entry_points('distutils.commands', command):
ep.require(installer=self.fetch_build_egg)
self.cmdclass[command] = cmdclass = ep.load()
return cmdclass
@@ -458,15 +458,15 @@ class Distribution(_Distribution):
self.cmdclass[ep.name] = cmdclass
return _Distribution.get_command_list(self)
- def _set_feature(self,name,status):
+ def _set_feature(self, name, status):
"""Set feature's inclusion status"""
- setattr(self,self._feature_attrname(name),status)
+ setattr(self, self._feature_attrname(name), status)
- def feature_is_included(self,name):
+ def feature_is_included(self, name):
"""Return 1 if feature is included, 0 if excluded, 'None' if unknown"""
- return getattr(self,self._feature_attrname(name))
+ return getattr(self, self._feature_attrname(name))
- def include_feature(self,name):
+ def include_feature(self, name):
"""Request inclusion of feature named 'name'"""
if self.feature_is_included(name)==0:
@@ -475,9 +475,9 @@ class Distribution(_Distribution):
descr + " is required, but was excluded or is not available"
)
self.features[name].include_in(self)
- self._set_feature(name,1)
+ self._set_feature(name, 1)
- def include(self,**attrs):
+ def include(self, **attrs):
"""Add items to distribution that are named in keyword arguments
For example, 'dist.exclude(py_modules=["x"])' would add 'x' to
@@ -492,14 +492,14 @@ class Distribution(_Distribution):
will try to call 'dist._include_foo({"bar":"baz"})', which can then
handle whatever special inclusion logic is needed.
"""
- for k,v in attrs.items():
+ for k, v in attrs.items():
include = getattr(self, '_include_'+k, None)
if include:
include(v)
else:
- self._include_misc(k,v)
+ self._include_misc(k, v)
- def exclude_package(self,package):
+ def exclude_package(self, package):
"""Remove packages, modules, and extensions in named package"""
pfx = package+'.'
@@ -521,7 +521,7 @@ class Distribution(_Distribution):
if p.name != package and not p.name.startswith(pfx)
]
- def has_contents_for(self,package):
+ def has_contents_for(self, package):
"""Return true if 'exclude_package(package)' would do something"""
pfx = package+'.'
@@ -530,48 +530,48 @@ class Distribution(_Distribution):
if p==package or p.startswith(pfx):
return True
- def _exclude_misc(self,name,value):
+ def _exclude_misc(self, name, value):
"""Handle 'exclude()' for list/tuple attrs without a special handler"""
- if not isinstance(value,sequence):
+ if not isinstance(value, sequence):
raise DistutilsSetupError(
"%s: setting must be a list or tuple (%r)" % (name, value)
)
try:
- old = getattr(self,name)
+ old = getattr(self, name)
except AttributeError:
raise DistutilsSetupError(
"%s: No such distribution setting" % name
)
- if old is not None and not isinstance(old,sequence):
+ if old is not None and not isinstance(old, sequence):
raise DistutilsSetupError(
name+": this setting cannot be changed via include/exclude"
)
elif old:
- setattr(self,name,[item for item in old if item not in value])
+ setattr(self, name, [item for item in old if item not in value])
- def _include_misc(self,name,value):
+ def _include_misc(self, name, value):
"""Handle 'include()' for list/tuple attrs without a special handler"""
- if not isinstance(value,sequence):
+ if not isinstance(value, sequence):
raise DistutilsSetupError(
"%s: setting must be a list (%r)" % (name, value)
)
try:
- old = getattr(self,name)
+ old = getattr(self, name)
except AttributeError:
raise DistutilsSetupError(
"%s: No such distribution setting" % name
)
if old is None:
- setattr(self,name,value)
- elif not isinstance(old,sequence):
+ setattr(self, name, value)
+ elif not isinstance(old, sequence):
raise DistutilsSetupError(
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):
+ def exclude(self, **attrs):
"""Remove items from distribution that are named in keyword arguments
For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from
@@ -587,15 +587,15 @@ class Distribution(_Distribution):
will try to call 'dist._exclude_foo({"bar":"baz"})', which can then
handle whatever special exclusion logic is needed.
"""
- for k,v in attrs.items():
+ for k, v in attrs.items():
exclude = getattr(self, '_exclude_'+k, None)
if exclude:
exclude(v)
else:
- self._exclude_misc(k,v)
+ self._exclude_misc(k, v)
- def _exclude_packages(self,packages):
- if not isinstance(packages,sequence):
+ def _exclude_packages(self, packages):
+ if not isinstance(packages, sequence):
raise DistutilsSetupError(
"packages: setting must be a list or tuple (%r)" % (packages,)
)
@@ -610,17 +610,17 @@ class Distribution(_Distribution):
command = args[0]
aliases = self.get_option_dict('aliases')
while command in aliases:
- src,alias = aliases[command]
+ src, alias = aliases[command]
del aliases[command] # ensure each alias can expand only once!
import shlex
- args[:1] = shlex.split(alias,True)
+ args[:1] = shlex.split(alias, True)
command = args[0]
nargs = _Distribution._parse_command_opts(self, parser, args)
# Handle commands that want to consume all remaining arguments
cmd_class = self.get_command_class(command)
- if getattr(cmd_class,'command_consumes_arguments',None):
+ if getattr(cmd_class, 'command_consumes_arguments', None):
self.get_option_dict(command)['args'] = ("command line", nargs)
if nargs is not None:
return []
@@ -639,20 +639,20 @@ class Distribution(_Distribution):
d = {}
- for cmd,opts in self.command_options.items():
+ for cmd, opts in self.command_options.items():
- for opt,(src,val) in opts.items():
+ for opt, (src, val) in opts.items():
if src != "command line":
continue
- opt = opt.replace('_','-')
+ opt = opt.replace('_', '-')
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():
+ neg_opt.update(getattr(cmdobj, 'negative_opt', {}))
+ for neg, pos in neg_opt.items():
if pos==opt:
opt=neg
val=None
@@ -663,7 +663,7 @@ class Distribution(_Distribution):
elif val==1:
val = None
- d.setdefault(cmd,{})[opt] = val
+ d.setdefault(cmd, {})[opt] = val
return d
@@ -677,7 +677,7 @@ class Distribution(_Distribution):
yield module
for ext in self.ext_modules or ():
- if isinstance(ext,tuple):
+ if isinstance(ext, tuple):
name, buildinfo = ext
else:
name = ext.name
@@ -800,16 +800,16 @@ class Feature:
self.standard = standard
self.available = available
self.optional = optional
- if isinstance(require_features,(str,Require)):
+ if isinstance(require_features, (str, Require)):
require_features = require_features,
self.require_features = [
- r for r in require_features if isinstance(r,str)
+ r for r in require_features if isinstance(r, str)
]
- er = [r for r in require_features if not isinstance(r,str)]
+ er = [r for r in require_features if not isinstance(r, str)]
if er: extras['require_features'] = er
- if isinstance(remove,str):
+ if isinstance(remove, str):
remove = remove,
self.remove = remove
self.extras = extras
@@ -824,7 +824,7 @@ class Feature:
"""Should this feature be included by default?"""
return self.available and self.standard
- def include_in(self,dist):
+ def include_in(self, dist):
"""Ensure feature and its requirements are included in distribution
You may override this in a subclass to perform additional operations on
@@ -844,7 +844,7 @@ class Feature:
for f in self.require_features:
dist.include_feature(f)
- def exclude_from(self,dist):
+ def exclude_from(self, dist):
"""Ensure feature is excluded from distribution
You may override this in a subclass to perform additional operations on
@@ -859,7 +859,7 @@ class Feature:
for item in self.remove:
dist.exclude_package(item)
- def validate(self,dist):
+ def validate(self, dist):
"""Verify that feature makes sense in context of distribution
This method is called by the distribution just before it parses its