diff options
Diffstat (limited to 'setuptools/command')
-rwxr-xr-x | setuptools/command/alias.py | 4 | ||||
-rw-r--r-- | setuptools/command/bdist_egg.py | 2 | ||||
-rwxr-xr-x | setuptools/command/easy_install.py | 18 | ||||
-rwxr-xr-x | setuptools/command/egg_info.py | 5 | ||||
-rwxr-xr-x | setuptools/command/install_scripts.py | 2 | ||||
-rwxr-xr-x | setuptools/command/saveopts.py | 3 | ||||
-rw-r--r-- | setuptools/command/upload_docs.py | 4 |
7 files changed, 21 insertions, 17 deletions
diff --git a/setuptools/command/alias.py b/setuptools/command/alias.py index 4c08c48d..52384e1a 100755 --- a/setuptools/command/alias.py +++ b/setuptools/command/alias.py @@ -9,7 +9,7 @@ def shquote(arg): """Quote an argument for later parsing by shlex.split()""" for c in '"', "'", "\\", "#": if c in arg: return repr(arg) - if arg.split()!=[arg]: + if arg.split() != [arg]: return repr(arg) return arg @@ -33,7 +33,7 @@ class alias(option_base): def finalize_options(self): option_base.finalize_options(self) - if self.remove and len(self.args)!=1: + if self.remove and len(self.args) != 1: raise DistutilsOptionError( "Must specify exactly one argument (the alias name) when " "using --remove" diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index de72ea04..c5776158 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -412,7 +412,7 @@ def write_safety_flag(egg_dir, safe): for flag,fn in safety_flags.items(): fn = os.path.join(egg_dir, fn) if os.path.exists(fn): - if safe is None or bool(safe)!=flag: + if safe is None or bool(safe) != flag: os.unlink(fn) elif safe is not None and bool(safe)==flag: f=open(fn,'wt'); f.write('\n'); f.close() diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index c53ca9f2..000fefa0 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -447,7 +447,7 @@ class easy_install(Command): self.pth_file = None PYTHONPATH = os.environ.get('PYTHONPATH','').split(os.pathsep) - if instdir not in map(normalize_path, filter(None,PYTHONPATH)): + if instdir not in map(normalize_path, [_f for _f in PYTHONPATH if _f]): # only PYTHONPATH dirs need a site.py, so pretend it's there self.sitepy_installed = True elif self.multi_version and not os.path.exists(pth_file): @@ -802,7 +802,7 @@ Please make the appropriate changes for your system and try again. f = open(target,"w"+mode) f.write(contents) f.close() - chmod(target,0x1FF - mask) # 0777 + chmod(target, 0x1FF-mask) # 0777 @@ -916,7 +916,7 @@ Please make the appropriate changes for your system and try again. f = open(pkg_inf,'w') f.write('Metadata-Version: 1.0\n') for k,v in cfg.items('metadata'): - if k!='target_version': + if k != 'target_version': f.write('%s: %s\n' % (k.replace('_','-').title(), v)) f.close() script_dir = os.path.join(egg_info,'scripts') @@ -1156,7 +1156,7 @@ See the setuptools documentation for the "develop" command for more info. 'site_dirs', 'allow_hosts', ) fetch_options = {} - for key, val in iteritems(ei_opts): + for key, val in ei_opts.items(): if key not in fetch_directives: continue fetch_options[key.replace('_', '-')] = val[1] # create a settings dictionary suitable for `edit_config` @@ -1390,7 +1390,8 @@ Please make the appropriate changes for your system and try again.""" % ( def get_site_dirs(): # return a list of 'site' dirs - sitedirs = list(filter(None,os.environ.get('PYTHONPATH','').split(os.pathsep))) + sitedirs = [_f for _f in os.environ.get('PYTHONPATH', + '').split(os.pathsep) if _f] prefixes = [sys.prefix] if sys.exec_prefix != sys.prefix: prefixes.append(sys.exec_prefix) @@ -1509,7 +1510,7 @@ def extract_wininst_cfg(dist_filename): # unicode for the RawConfigParser, so decode it. Is this the # right encoding? config = config.decode('ascii') - cfg.readfp(StringIO.StringIO(config)) + cfg.readfp(StringIO(config)) except ConfigParser.Error: return None if not cfg.has_section('metadata') or not cfg.has_section('Setup'): @@ -1544,7 +1545,7 @@ def get_exe_prefixes(exe_filename): if parts[1].endswith('.egg-info'): prefixes.insert(0,('/'.join(parts[:2]), 'EGG-INFO/')) break - if len(parts)!=2 or not name.endswith('.pth'): + if len(parts) != 2 or not name.endswith('.pth'): continue if name.endswith('-nspkg.pth'): continue @@ -1577,7 +1578,8 @@ class PthDistributions(Environment): dirty = False def __init__(self, filename, sitedirs=()): - self.filename = filename; self.sitedirs = list(map(normalize_path, sitedirs)) + self.filename = filename + self.sitedirs = list(map(normalize_path, sitedirs)) self.basedir = normalize_path(os.path.dirname(self.filename)) self._load(); Environment.__init__(self, [], None, None) for path in yield_lines(self.paths): diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 1a61dfcb..6b0d2426 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -8,7 +8,7 @@ from setuptools import Command from distutils.errors import * from distutils import log from setuptools.command.sdist import sdist -from setuptools.compat import basestring, PY3 +from setuptools.compat import basestring from distutils.util import convert_path from distutils.filelist import FileList as _FileList from pkg_resources import parse_requirements, safe_name, parse_version, \ @@ -416,7 +416,8 @@ def write_pkg_info(cmd, basename, filename): metadata.name, metadata.version = oldname, oldver safe = getattr(cmd.distribution,'zip_safe',None) - from setuptools.command import bdist_egg; bdist_egg.write_safety_flag(cmd.egg_info, safe) + from setuptools.command import bdist_egg + bdist_egg.write_safety_flag(cmd.egg_info, safe) def warn_depends_obsolete(cmd, basename, filename): if os.path.exists(filename): diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index ad522f6c..105dabca 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -50,5 +50,5 @@ class install_scripts(_install_scripts): f = open(target,"w"+mode) f.write(contents) f.close() - chmod(target,0x1FF - mask) # 0777 + chmod(target, 0x1FF-mask) # 0777 diff --git a/setuptools/command/saveopts.py b/setuptools/command/saveopts.py index 1180a440..7209be4c 100755 --- a/setuptools/command/saveopts.py +++ b/setuptools/command/saveopts.py @@ -9,10 +9,9 @@ class saveopts(option_base): def run(self): dist = self.distribution - commands = dist.command_options.keys() settings = {} - for cmd in commands: + for cmd in dist.command_options: if cmd=='saveopts': continue # don't save our own options! diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index e07b885d..12bc916b 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -25,7 +25,9 @@ except ImportError: from setuptools.compat import httplib, urlparse, unicode, iteritems -if sys.version_info >= (3,): +_IS_PYTHON3 = sys.version > '3' + +if _IS_PYTHON3: errors = 'surrogateescape' else: errors = 'strict' |