diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-04-30 17:38:29 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-04-30 17:38:29 -0400 |
commit | 573c2c86d4d4f506a87a1fc16060f32c1386ad38 (patch) | |
tree | d8e3e14b773461dc4e555ff76d9c6180f958cee0 | |
parent | 0f0c892487277e25ce79a39477b193822f1edf79 (diff) | |
download | external_python_setuptools-573c2c86d4d4f506a87a1fc16060f32c1386ad38.tar.gz external_python_setuptools-573c2c86d4d4f506a87a1fc16060f32c1386ad38.tar.bz2 external_python_setuptools-573c2c86d4d4f506a87a1fc16060f32c1386ad38.zip |
Correct indentation and clarify meaning by using namespacing
--HG--
extra : amend_source : 20ab7547c8478eb084767fe701e627bdd462ba16
-rwxr-xr-x | setuptools/command/bdist_rpm.py | 8 | ||||
-rwxr-xr-x | setuptools/command/bdist_wininst.py | 6 | ||||
-rw-r--r-- | setuptools/command/build_py.py | 20 | ||||
-rw-r--r-- | setuptools/command/install.py | 20 | ||||
-rw-r--r-- | setuptools/command/install_lib.py | 8 | ||||
-rwxr-xr-x | setuptools/command/install_scripts.py | 9 | ||||
-rwxr-xr-x | setuptools/command/register.py | 9 | ||||
-rwxr-xr-x | setuptools/command/sdist.py | 8 |
8 files changed, 43 insertions, 45 deletions
diff --git a/setuptools/command/bdist_rpm.py b/setuptools/command/bdist_rpm.py index c13732fa..99386824 100755 --- a/setuptools/command/bdist_rpm.py +++ b/setuptools/command/bdist_rpm.py @@ -1,6 +1,6 @@ -from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm +import distutils.command.bdist_rpm as orig -class bdist_rpm(_bdist_rpm): +class bdist_rpm(orig.bdist_rpm): """ Override the default bdist_rpm behavior to do the following: @@ -15,12 +15,12 @@ class bdist_rpm(_bdist_rpm): # ensure distro name is up-to-date self.run_command('egg_info') - _bdist_rpm.run(self) + orig.bdist_rpm.run(self) def _make_spec_file(self): version = self.distribution.get_version() rpmversion = version.replace('-','_') - spec = _bdist_rpm._make_spec_file(self) + spec = orig.bdist_rpm._make_spec_file(self) line23 = '%define version ' + version line24 = '%define version ' + rpmversion spec = [ diff --git a/setuptools/command/bdist_wininst.py b/setuptools/command/bdist_wininst.py index d4d195a0..f9d8d4f0 100755 --- a/setuptools/command/bdist_wininst.py +++ b/setuptools/command/bdist_wininst.py @@ -1,6 +1,6 @@ -from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst +import distutils.command.bdist_wininst as orig -class bdist_wininst(_bdist_wininst): +class bdist_wininst(orig.bdist_wininst): def reinitialize_command(self, command, reinit_subcommands=0): """ Supplement reinitialize_command to work around @@ -15,6 +15,6 @@ class bdist_wininst(_bdist_wininst): def run(self): self._is_running = True try: - _bdist_wininst.run(self) + orig.bdist_wininst.run(self) finally: self._is_running = False diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py index 1efabc02..53bfb7df 100644 --- a/setuptools/command/build_py.py +++ b/setuptools/command/build_py.py @@ -2,7 +2,7 @@ import os import sys import fnmatch import textwrap -from distutils.command.build_py import build_py as _build_py +import distutils.command.build_py as orig from distutils.util import convert_path from glob import glob @@ -13,7 +13,7 @@ except ImportError: def run_2to3(self, files, doctests=True): "do nothing" -class build_py(_build_py, Mixin2to3): +class build_py(orig.build_py, Mixin2to3): """Enhanced 'build_py' command that includes data files with packages The data files are specified via a 'package_data' argument to 'setup()'. @@ -23,7 +23,7 @@ class build_py(_build_py, Mixin2to3): 'py_modules' and 'packages' in the same setup operation. """ def finalize_options(self): - _build_py.finalize_options(self) + orig.build_py.finalize_options(self) self.package_data = self.distribution.package_data self.exclude_package_data = self.distribution.exclude_package_data or {} if 'data_files' in self.__dict__: del self.__dict__['data_files'] @@ -48,16 +48,16 @@ class build_py(_build_py, Mixin2to3): # Only compile actual .py files, using our base class' idea of what our # output files are. - self.byte_compile(_build_py.get_outputs(self, include_bytecode=0)) + self.byte_compile(orig.build_py.get_outputs(self, include_bytecode=0)) def __getattr__(self, attr): if attr=='data_files': # lazily compute data files self.data_files = files = self._get_data_files() return files - return _build_py.__getattr__(self,attr) + return orig.build_py.__getattr__(self,attr) def build_module(self, module, module_file, package): - outfile, copied = _build_py.build_module(self, module, module_file, package) + outfile, copied = orig.build_py.build_module(self, module, module_file, package) if copied: self.__updated_files.append(outfile) return outfile, copied @@ -140,7 +140,7 @@ class build_py(_build_py, Mixin2to3): needed for the 'install_lib' command to do its job properly, and to generate a correct installation manifest.) """ - return _build_py.get_outputs(self, include_bytecode) + [ + return orig.build_py.get_outputs(self, include_bytecode) + [ os.path.join(build_dir, filename) for package, src_dir, build_dir,filenames in self.data_files for filename in filenames @@ -153,7 +153,7 @@ class build_py(_build_py, Mixin2to3): except KeyError: pass - init_py = _build_py.check_package(self, package, package_dir) + init_py = orig.build_py.check_package(self, package, package_dir) self.packages_checked[package] = init_py if not init_py or not self.distribution.namespace_packages: @@ -179,10 +179,10 @@ class build_py(_build_py, Mixin2to3): def initialize_options(self): self.packages_checked={} - _build_py.initialize_options(self) + orig.build_py.initialize_options(self) def get_package_dir(self, package): - res = _build_py.get_package_dir(self, package) + res = orig.build_py.get_package_dir(self, package) if self.distribution.src_root is not None: return os.path.join(self.distribution.src_root, res) return res diff --git a/setuptools/command/install.py b/setuptools/command/install.py index 1681617f..3425dbf7 100644 --- a/setuptools/command/install.py +++ b/setuptools/command/install.py @@ -3,18 +3,18 @@ import inspect import glob import warnings import platform -from distutils.command.install import install as _install +import distutils.command.install as orig from distutils.errors import DistutilsArgError -class install(_install): +class install(orig.install): """Use easy_install to install the package, w/dependencies""" - user_options = _install.user_options + [ + user_options = orig.install.user_options + [ ('old-and-unmanageable', None, "Try not to use this!"), ('single-version-externally-managed', None, "used by system package builders to create 'flat' eggs"), ] - boolean_options = _install.boolean_options + [ + boolean_options = orig.install.boolean_options + [ 'old-and-unmanageable', 'single-version-externally-managed', ] new_commands = [ @@ -24,12 +24,12 @@ class install(_install): _nc = dict(new_commands) def initialize_options(self): - _install.initialize_options(self) + orig.install.initialize_options(self) self.old_and_unmanageable = None self.single_version_externally_managed = None def finalize_options(self): - _install.finalize_options(self) + orig.install.finalize_options(self) if self.root: self.single_version_externally_managed = True elif self.single_version_externally_managed: @@ -42,7 +42,7 @@ class install(_install): def handle_extra_path(self): if self.root or self.single_version_externally_managed: # explicit backward-compatibility mode, allow extra_path to work - return _install.handle_extra_path(self) + return orig.install.handle_extra_path(self) # Ignore extra_path when installing an egg (or being run by another # command without --root or --single-version-externally-managed @@ -52,11 +52,11 @@ class install(_install): def run(self): # Explicit request for old-style install? Just do it if self.old_and_unmanageable or self.single_version_externally_managed: - return _install.run(self) + return orig.install.run(self) if not self._called_from_setup(inspect.currentframe()): # Run in backward-compatibility mode to support bdist_* commands. - _install.run(self) + orig.install.run(self) else: self.do_egg_install() @@ -113,5 +113,5 @@ class install(_install): # XXX Python 3.1 doesn't see _nc if this is inside the class install.sub_commands = [ - cmd for cmd in _install.sub_commands if cmd[0] not in install._nc + cmd for cmd in orig.install.sub_commands if cmd[0] not in install._nc ] + install.new_commands diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 63dc11fe..747fbabb 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -1,7 +1,7 @@ -from distutils.command.install_lib import install_lib as _install_lib +import distutils.command.install_lib as orig import os -class install_lib(_install_lib): +class install_lib(orig.install_lib): """Don't add compiled flags to filenames of non-Python files""" def run(self): @@ -34,7 +34,7 @@ class install_lib(_install_lib): exclude = self.get_exclusions() if not exclude: - return _install_lib.copy_tree(self, infile, outfile) + return orig.install_lib.copy_tree(self, infile, outfile) # Exclude namespace package __init__.py* files from the output @@ -56,7 +56,7 @@ class install_lib(_install_lib): return outfiles def get_outputs(self): - outputs = _install_lib.get_outputs(self) + outputs = orig.install_lib.get_outputs(self) exclude = self.get_exclusions() if exclude: return [f for f in outputs if f not in exclude] diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 1c6cc51d..c19536bf 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -1,14 +1,13 @@ -from distutils.command.install_scripts import install_scripts \ - as _install_scripts +import distutils.command.install_scripts as orig from pkg_resources import Distribution, PathMetadata, ensure_directory import os from distutils import log -class install_scripts(_install_scripts): +class install_scripts(orig.install_scripts): """Do normal script install, plus any egg_info wrapper scripts""" def initialize_options(self): - _install_scripts.initialize_options(self) + orig.install_scripts.initialize_options(self) self.no_ep = False def run(self): @@ -17,7 +16,7 @@ class install_scripts(_install_scripts): self.run_command("egg_info") if self.distribution.scripts: - _install_scripts.run(self) # run first to set up self.outfiles + orig.install_scripts.run(self) # run first to set up self.outfiles else: self.outfiles = [] if self.no_ep: diff --git a/setuptools/command/register.py b/setuptools/command/register.py index 3b2e0859..6694d1c0 100755 --- a/setuptools/command/register.py +++ b/setuptools/command/register.py @@ -1,10 +1,9 @@ -from distutils.command.register import register as _register +import distutils.command.register as orig -class register(_register): - __doc__ = _register.__doc__ +class register(orig.register): + __doc__ = orig.register.__doc__ def run(self): # Make sure that we are using valid current name/version info self.run_command('egg_info') - _register.run(self) - + orig.register.run(self) diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index 76e1c5f1..948d27fa 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -4,7 +4,7 @@ import sys from glob import glob import pkg_resources -from distutils.command.sdist import sdist as _sdist +import distutils.command.sdist as orig from distutils.util import convert_path from distutils import log from setuptools import svn_utils @@ -72,7 +72,7 @@ finders = [ ] -class sdist(_sdist): +class sdist(orig.sdist): """Smart sdist that finds anything supported by revision control""" user_options = [ @@ -119,7 +119,7 @@ class sdist(_sdist): # Doing so prevents an error when easy_install attempts to delete the # file. try: - _sdist.read_template(self) + orig.sdist.read_template(self) except: sys.exc_info()[2].tb_next.tb_frame.f_locals['template'].close() raise @@ -197,7 +197,7 @@ class sdist(_sdist): ) def make_release_tree(self, base_dir, files): - _sdist.make_release_tree(self, base_dir, files) + orig.sdist.make_release_tree(self, base_dir, files) # Save any egg_info command line options used to create this sdist dest = os.path.join(base_dir, 'setup.cfg') |