aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools
diff options
context:
space:
mode:
authorstepshal <nessento@openmailbox.org>2016-07-14 12:11:49 +0700
committerstepshal <nessento@openmailbox.org>2016-07-14 12:11:49 +0700
commitdc2d1dc249bec8e3a864e2aa6002a8e27adc4b7c (patch)
tree2f1a5c1365313dbe185c598194d2f9cafda7e6ee /setuptools
parent10866a525737842b090d83ccaf6d7aceb092f069 (diff)
downloadexternal_python_setuptools-dc2d1dc249bec8e3a864e2aa6002a8e27adc4b7c.tar.gz
external_python_setuptools-dc2d1dc249bec8e3a864e2aa6002a8e27adc4b7c.tar.bz2
external_python_setuptools-dc2d1dc249bec8e3a864e2aa6002a8e27adc4b7c.zip
Fix missing whitespace around operator.
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/depends.py20
-rw-r--r--setuptools/dist.py48
-rw-r--r--setuptools/lib2to3_ex.py2
-rwxr-xr-xsetuptools/package_index.py40
-rw-r--r--setuptools/py31compat.py2
-rwxr-xr-xsetuptools/sandbox.py6
-rw-r--r--setuptools/site-patch.py8
-rw-r--r--setuptools/ssl_support.py2
-rw-r--r--setuptools/tests/test_bdist_egg.py4
-rw-r--r--setuptools/tests/test_easy_install.py4
-rw-r--r--setuptools/tests/test_packageindex.py2
11 files changed, 69 insertions, 69 deletions
diff --git a/setuptools/depends.py b/setuptools/depends.py
index eb1d7b13..01f4a23a 100644
--- a/setuptools/depends.py
+++ b/setuptools/depends.py
@@ -89,16 +89,16 @@ def _iter_code(code):
ptr = 0
extended_arg = 0
- while ptr<eof:
+ while ptr < eof:
op = bytes[ptr]
- if op>=HAVE_ARGUMENT:
+ if op >= HAVE_ARGUMENT:
- arg = bytes[ptr+1] + bytes[ptr+2]*256 + extended_arg
+ arg = bytes[ptr + 1] + bytes[ptr + 2] * 256 + extended_arg
ptr += 3
- if op==EXTENDED_ARG:
+ if op == EXTENDED_ARG:
long_type = six.integer_types[-1]
extended_arg = arg * long_type(65536)
continue
@@ -119,7 +119,7 @@ def find_module(module, paths=None):
part = parts.pop(0)
f, path, (suffix, mode, kind) = info = imp.find_module(part, paths)
- if kind==PKG_DIRECTORY:
+ if kind == PKG_DIRECTORY:
parts = parts or ['__init__']
paths = [path]
@@ -143,12 +143,12 @@ def get_module_constant(module, symbol, default=-1, paths=None):
return None
try:
- if kind==PY_COMPILED:
+ if kind == PY_COMPILED:
f.read(8) # skip magic & date
code = marshal.load(f)
- elif kind==PY_FROZEN:
+ elif kind == PY_FROZEN:
code = imp.get_frozen_object(module)
- elif kind==PY_SOURCE:
+ elif kind == PY_SOURCE:
code = compile(f.read(), path, 'exec')
else:
# Not something we can parse; we'll have to import it. :(
@@ -190,9 +190,9 @@ def extract_constant(code, symbol, default=-1):
for op, arg in _iter_code(code):
- if op==LOAD_CONST:
+ if op == LOAD_CONST:
const = code.co_consts[arg]
- elif arg==name_idx and (op==STORE_NAME or op==STORE_GLOBAL):
+ elif arg == name_idx and (op == STORE_NAME or op == STORE_GLOBAL):
return const
else:
const = default
diff --git a/setuptools/dist.py b/setuptools/dist.py
index f229d726..b4ff3861 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -65,7 +65,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(
@@ -77,7 +77,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)
@@ -109,7 +109,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(
@@ -162,7 +162,7 @@ def check_package_data(dist, attr, value):
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"
)
@@ -313,7 +313,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"""
@@ -402,13 +402,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
@@ -469,7 +469,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"
@@ -493,7 +493,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:
@@ -502,7 +502,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
@@ -524,10 +524,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):
@@ -544,7 +544,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])
@@ -566,10 +566,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
@@ -588,7 +588,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:
@@ -648,19 +648,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 +835,7 @@ class Feature:
if not self.available:
raise DistutilsPlatformError(
- self.description+" is required, "
+ self.description + " is required, "
"but is not available on this platform"
)
diff --git a/setuptools/lib2to3_ex.py b/setuptools/lib2to3_ex.py
index f7296786..ac5f8096 100644
--- a/setuptools/lib2to3_ex.py
+++ b/setuptools/lib2to3_ex.py
@@ -34,7 +34,7 @@ class Mixin2to3(_Mixin2to3):
return
if not files:
return
- log.info("Fixing "+" ".join(files))
+ log.info("Fixing " + " ".join(files))
self.__build_fixer_names()
self.__exclude_fixers()
if doctests:
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index cdedef83..4590e93f 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -80,7 +80,7 @@ def egg_info_for_url(url):
parts = urllib.parse.urlparse(url)
scheme, server, path, parameters, query, fragment = parts
base = urllib.parse.unquote(path.split('/')[-1])
- if server=='sourceforge.net' and base=='download': # XXX Yuck
+ if server == 'sourceforge.net' and base == 'download': # XXX Yuck
base = urllib.parse.unquote(path.split('/')[-2])
if '#' in base: base, fragment = base.split('#', 1)
return base, fragment
@@ -155,7 +155,7 @@ def interpret_distro_name(
# it is a bdist_dumb, not an sdist -- bail out
return
- for p in range(1, len(parts)+1):
+ for p in range(1, len(parts) + 1):
yield Distribution(
location, metadata, '-'.join(parts[:p]), '-'.join(parts[p:]),
py_version=py_version, precedence = precedence,
@@ -209,7 +209,7 @@ def find_external_links(url, page):
for tag in ("<th>Home Page", "<th>Download URL"):
pos = page.find(tag)
- if pos!=-1:
+ if pos != -1:
match = HREF.search(page, pos)
if match:
yield urllib.parse.urljoin(url, htmldecode(match.group(1)))
@@ -336,7 +336,7 @@ class PackageIndex(Environment):
for match in HREF.finditer(page):
link = urllib.parse.urljoin(base, htmldecode(match.group(1)))
self.process_url(link)
- if url.startswith(self.index_url) and getattr(f, 'code', None)!=404:
+ if url.startswith(self.index_url) and getattr(f, 'code', None) != 404:
page = self.process_index(url, page)
def process_filename(self, fn, nested=False):
@@ -357,7 +357,7 @@ class PackageIndex(Environment):
def url_ok(self, url, fatal=False):
s = URL_SCHEME(url)
- if (s and s.group(1).lower()=='file') or self.allows(urllib.parse.urlparse(url)[1]):
+ if (s and s.group(1).lower() == 'file') or self.allows(urllib.parse.urlparse(url)[1]):
return True
msg = ("\nNote: Bypassing %s (disallowed host; see "
"http://bit.ly/1dg9ijs for details).\n")
@@ -400,7 +400,7 @@ class PackageIndex(Environment):
parts = list(map(
urllib.parse.unquote, link[len(self.index_url):].split('/')
))
- if len(parts)==2 and '#' not in parts[1]:
+ if len(parts) == 2 and '#' not in parts[1]:
# it's a package page, sanitize and index it
pkg = safe_name(parts[0])
ver = safe_version(parts[1])
@@ -423,7 +423,7 @@ class PackageIndex(Environment):
base, frag = egg_info_for_url(new_url)
if base.endswith('.py') and not frag:
if ver:
- new_url+='#egg=%s-%s' % (pkg, ver)
+ new_url += '#egg=%s-%s' % (pkg, ver)
else:
self.need_version_info(url)
self.scan_url(new_url)
@@ -449,11 +449,11 @@ class PackageIndex(Environment):
self.scan_url(self.index_url)
def find_packages(self, requirement):
- self.scan_url(self.index_url + requirement.unsafe_name+'/')
+ self.scan_url(self.index_url + requirement.unsafe_name + '/')
if not self.package_pages.get(requirement.key):
# Fall back to safe version of the name
- self.scan_url(self.index_url + requirement.project_name+'/')
+ self.scan_url(self.index_url + requirement.project_name + '/')
if not self.package_pages.get(requirement.key):
# We couldn't find the target package, so search the index page too
@@ -589,13 +589,13 @@ class PackageIndex(Environment):
for dist in env[req.key]:
- if dist.precedence==DEVELOP_DIST and not develop_ok:
+ if dist.precedence == DEVELOP_DIST and not develop_ok:
if dist not in skipped:
self.warn("Skipping development or system egg: %s", dist)
skipped[dist] = 1
continue
- if dist in req and (dist.precedence<=SOURCE_DIST or not source):
+ if dist in req and (dist.precedence <= SOURCE_DIST or not source):
return dist
if force_scan:
@@ -645,7 +645,7 @@ class PackageIndex(Environment):
interpret_distro_name(filename, match.group(1), None) if d.version
] or []
- if len(dists)==1: # unambiguous ``#egg`` fragment
+ if len(dists) == 1: # unambiguous ``#egg`` fragment
basename = os.path.basename(filename)
# Make sure the file has been downloaded to the temp dir.
@@ -654,7 +654,7 @@ class PackageIndex(Environment):
from setuptools.command.easy_install import samefile
if not samefile(filename, dst):
shutil.copy2(filename, dst)
- filename=dst
+ filename = dst
with open(os.path.join(tmpdir, 'setup.py'), 'w') as file:
file.write(
@@ -771,13 +771,13 @@ class PackageIndex(Environment):
# Download the file
#
- if scheme=='svn' or scheme.startswith('svn+'):
+ if scheme == 'svn' or scheme.startswith('svn+'):
return self._download_svn(url, filename)
- elif scheme=='git' or scheme.startswith('git+'):
+ elif scheme == 'git' or scheme.startswith('git+'):
return self._download_git(url, filename)
elif scheme.startswith('hg+'):
return self._download_hg(url, filename)
- elif scheme=='file':
+ elif scheme == 'file':
return urllib.request.url2pathname(urllib.parse.urlparse(url)[2])
else:
self.url_ok(url, True) # raises error if not allowed
@@ -806,7 +806,7 @@ class PackageIndex(Environment):
break # not an index page
file.close()
os.unlink(filename)
- raise DistutilsError("Unexpected HTML page found at "+url)
+ raise DistutilsError("Unexpected HTML page found at " + url)
def _download_svn(self, url, filename):
url = url.split('#', 1)[0] # remove any fragment for svn's sake
@@ -821,7 +821,7 @@ class PackageIndex(Environment):
user, pw = auth.split(':', 1)
creds = " --username=%s --password=%s" % (user, pw)
else:
- creds = " --username="+auth
+ creds = " --username=" + auth
netloc = host
parts = scheme, netloc, url, p, q, f
url = urllib.parse.urlunparse(parts)
@@ -896,7 +896,7 @@ entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub
def uchr(c):
if not isinstance(c, int):
return c
- if c>255: return six.unichr(c)
+ if c > 255: return six.unichr(c)
return chr(c)
@@ -1046,7 +1046,7 @@ def open_with_auth(url, opener=urllib.request.urlopen):
# Put authentication info back into request URL if same host,
# so that links found on the page will work
s2, h2, path2, param2, query2, frag2 = urllib.parse.urlparse(fp.url)
- if s2==scheme and h2==host:
+ if s2 == scheme and h2 == host:
parts = s2, netloc, path2, param2, query2, frag2
fp.url = urllib.parse.urlunparse(parts)
diff --git a/setuptools/py31compat.py b/setuptools/py31compat.py
index 04a314ef..414b377b 100644
--- a/setuptools/py31compat.py
+++ b/setuptools/py31compat.py
@@ -12,7 +12,7 @@ except ImportError:
def get_path(name):
if name not in ('platlib', 'purelib'):
raise ValueError("Name must be purelib or platlib")
- return get_python_lib(name=='platlib')
+ return get_python_lib(name == 'platlib')
try:
# Python >=3.2
diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py
index c6bab096..5ed45f84 100755
--- a/setuptools/sandbox.py
+++ b/setuptools/sandbox.py
@@ -234,7 +234,7 @@ def run_setup(setup_script, args):
setup_dir = os.path.abspath(os.path.dirname(setup_script))
with setup_context(setup_dir):
try:
- sys.argv[:] = [setup_script]+list(args)
+ sys.argv[:] = [setup_script] + list(args)
sys.path.insert(0, setup_dir)
# reset to include setup dir, w/clean callback list
working_set.__init__()
@@ -353,8 +353,8 @@ class AbstractSandbox:
def _remap_pair(self, operation, src, dst, *args, **kw):
"""Called for path pairs like rename, link, and symlink operations"""
return (
- self._remap_input(operation+'-from', src, *args, **kw),
- self._remap_input(operation+'-to', dst, *args, **kw)
+ self._remap_input(operation + '-from', src, *args, **kw),
+ self._remap_input(operation + '-to', dst, *args, **kw)
)
diff --git a/setuptools/site-patch.py b/setuptools/site-patch.py
index 3e89ef2f..6cfac4d6 100644
--- a/setuptools/site-patch.py
+++ b/setuptools/site-patch.py
@@ -2,7 +2,7 @@ def __boot():
import sys
import os
PYTHONPATH = os.environ.get('PYTHONPATH')
- if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH):
+ if PYTHONPATH is None or (sys.platform == 'win32' and not PYTHONPATH):
PYTHONPATH = []
else:
PYTHONPATH = PYTHONPATH.split(os.pathsep)
@@ -12,7 +12,7 @@ def __boot():
mydir = os.path.dirname(__file__)
for item in stdpath:
- if item==mydir or not item:
+ if item == mydir or not item:
continue # skip if current dir. on Windows, or my own directory
importer = pic.get(item)
if importer is not None:
@@ -55,7 +55,7 @@ def __boot():
for item in sys.path:
p, np = makepath(item)
- if np==nd and insert_at is None:
+ if np == nd and insert_at is None:
# We've hit the first 'system' path entry, so added entries go here
insert_at = len(new_path)
@@ -68,6 +68,6 @@ def __boot():
sys.path[:] = new_path
-if __name__=='site':
+if __name__ == 'site':
__boot()
del __boot
diff --git a/setuptools/ssl_support.py b/setuptools/ssl_support.py
index ecede509..f4ba8a92 100644
--- a/setuptools/ssl_support.py
+++ b/setuptools/ssl_support.py
@@ -235,7 +235,7 @@ def get_win_certfile():
def find_ca_bundle():
"""Return an existing CA bundle path, or None"""
- if os.name=='nt':
+ if os.name == 'nt':
return get_win_certfile()
else:
for cert_path in cert_paths:
diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py
index a7ceac86..42c44edf 100644
--- a/setuptools/tests/test_bdist_egg.py
+++ b/setuptools/tests/test_bdist_egg.py
@@ -18,9 +18,9 @@ setup(name='foo', py_modules=['hi'])
@pytest.yield_fixture
def setup_context(tmpdir):
- with (tmpdir/'setup.py').open('w') as f:
+ with (tmpdir / 'setup.py').open('w') as f:
f.write(SETUP_PY)
- with (tmpdir/'hi.py').open('w') as f:
+ with (tmpdir / 'hi.py').open('w') as f:
f.write('1\n')
with tmpdir.as_cwd():
yield tmpdir
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py
index 894c4fd8..821e6fb2 100644
--- a/setuptools/tests/test_easy_install.py
+++ b/setuptools/tests/test_easy_install.py
@@ -157,7 +157,7 @@ class TestPTHFileWriter:
@pytest.yield_fixture
def setup_context(tmpdir):
- with (tmpdir/'setup.py').open('w') as f:
+ with (tmpdir / 'setup.py').open('w') as f:
f.write(SETUP_PY)
with tmpdir.as_cwd():
yield tmpdir
@@ -555,7 +555,7 @@ class TestScriptHeader:
assert actual == expected
actual = ei.ScriptWriter.get_script_header('#!/usr/bin/python',
- executable='"'+self.exe_with_spaces+'"')
+ executable='"' + self.exe_with_spaces + '"')
expected = '#!"%s"\n' % self.exe_with_spaces
assert actual == expected
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 61f5909b..dda55382 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -129,7 +129,7 @@ class TestPackageIndex:
# the distribution has been found
assert 'foobar' in pi
# we have only one link, because links are compared without md5
- assert len(pi['foobar'])==1
+ assert len(pi['foobar']) == 1
# the link should be from the index
assert 'correct_md5' in pi['foobar'][0].location