diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-12-21 01:49:00 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-12-21 01:49:00 (GMT) |
commit | 88e2c5d35a9ce74e779bfc5cb38624bef49c695f (patch) | |
tree | c9b8985c220a5d99d1caae8c25c8d654be47bac0 /Lib/distutils | |
parent | 8b9361a26df8b336d08de6a59387c56be520591f (diff) | |
download | cpython-88e2c5d35a9ce74e779bfc5cb38624bef49c695f.zip cpython-88e2c5d35a9ce74e779bfc5cb38624bef49c695f.tar.gz cpython-88e2c5d35a9ce74e779bfc5cb38624bef49c695f.tar.bz2 |
Merged revisions 76956 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76956 | tarek.ziade | 2009-12-21 02:22:46 +0100 (Mon, 21 Dec 2009) | 1 line
massive import cleaning in Distutils
........
Diffstat (limited to 'Lib/distutils')
24 files changed, 62 insertions, 78 deletions
diff --git a/Lib/distutils/bcppcompiler.py b/Lib/distutils/bcppcompiler.py index c5e5cd2..77d94a5 100644 --- a/Lib/distutils/bcppcompiler.py +++ b/Lib/distutils/bcppcompiler.py @@ -13,13 +13,11 @@ for the Borland C++ compiler. __revision__ = "$Id$" - import os -from distutils.errors import \ - DistutilsExecError, DistutilsPlatformError, \ - CompileError, LibError, LinkError, UnknownFileError -from distutils.ccompiler import \ - CCompiler, gen_preprocess_options, gen_lib_options + +from distutils.errors import (DistutilsExecError, CompileError, LibError, + LinkError, UnknownFileError) +from distutils.ccompiler import CCompiler, gen_preprocess_options from distutils.file_util import write_file from distutils.dep_util import newer from distutils import log diff --git a/Lib/distutils/ccompiler.py b/Lib/distutils/ccompiler.py index ff7f9df..407cabd 100644 --- a/Lib/distutils/ccompiler.py +++ b/Lib/distutils/ccompiler.py @@ -5,8 +5,11 @@ for the Distutils compiler abstraction model.""" __revision__ = "$Id$" -import sys, os, re -from distutils.errors import * +import sys +import os +import re + +from distutils.errors import CompileError, LinkError, UnknownFileError from distutils.spawn import spawn from distutils.file_util import move_file from distutils.dir_util import mkpath diff --git a/Lib/distutils/command/bdist.py b/Lib/distutils/command/bdist.py index 2c81f3a..dd202ff 100644 --- a/Lib/distutils/command/bdist.py +++ b/Lib/distutils/command/bdist.py @@ -6,8 +6,9 @@ distribution).""" __revision__ = "$Id$" import os + from distutils.core import Command -from distutils.errors import * +from distutils.errors import DistutilsPlatformError, DistutilsOptionError from distutils.util import get_platform diff --git a/Lib/distutils/command/bdist_msi.py b/Lib/distutils/command/bdist_msi.py index c4be47b..f920548 100644 --- a/Lib/distutils/command/bdist_msi.py +++ b/Lib/distutils/command/bdist_msi.py @@ -28,7 +28,6 @@ class PyDialog(Dialog): default, cancel, bitmap=true)""" Dialog.__init__(self, *args) ruler = self.h - 36 - bmwidth = 152*ruler/328 #if kw.get("bitmap", True): # self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "PythonWin") self.line("BottomLine", 0, ruler, self.w, 0) @@ -419,7 +418,6 @@ class bdist_msi(Command): # see "Dialog Style Bits" modal = 3 # visible | modal modeless = 1 # visible - track_disk_space = 32 # UI customization properties add_data(db, "Property", diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py index 452f950..0a579db 100644 --- a/Lib/distutils/command/bdist_rpm.py +++ b/Lib/distutils/command/bdist_rpm.py @@ -5,13 +5,14 @@ distributions).""" __revision__ = "$Id$" -import sys, os +import sys +import os + from distutils.core import Command from distutils.debug import DEBUG -from distutils.util import get_platform from distutils.file_util import write_file -from distutils.errors import * -from distutils.sysconfig import get_python_version +from distutils.errors import (DistutilsOptionError, DistutilsPlatformError, + DistutilsFileError, DistutilsExecError) from distutils import log class bdist_rpm(Command): diff --git a/Lib/distutils/command/bdist_wininst.py b/Lib/distutils/command/bdist_wininst.py index d6d01c6..0b7044a 100644 --- a/Lib/distutils/command/bdist_wininst.py +++ b/Lib/distutils/command/bdist_wininst.py @@ -5,11 +5,13 @@ exe-program.""" __revision__ = "$Id$" -import sys, os +import sys +import os + from distutils.core import Command from distutils.util import get_platform -from distutils.dir_util import create_tree, remove_tree -from distutils.errors import * +from distutils.dir_util import remove_tree +from distutils.errors import DistutilsOptionError, DistutilsPlatformError from distutils.sysconfig import get_python_version from distutils import log diff --git a/Lib/distutils/command/build_clib.py b/Lib/distutils/command/build_clib.py index 258d7c1..12bf1d2 100644 --- a/Lib/distutils/command/build_clib.py +++ b/Lib/distutils/command/build_clib.py @@ -18,7 +18,7 @@ __revision__ = "$Id$" import os from distutils.core import Command -from distutils.errors import * +from distutils.errors import DistutilsSetupError from distutils.sysconfig import customize_compiler from distutils import log diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index 70dd81f..de980bd 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -10,7 +10,8 @@ import sys, os, re from warnings import warn from distutils.core import Command -from distutils.errors import * +from distutils.errors import (CCompilerError, DistutilsError, CompileError, + DistutilsSetupError, DistutilsPlatformError) from distutils.sysconfig import customize_compiler, get_python_version from distutils.dep_util import newer_group from distutils.extension import Extension diff --git a/Lib/distutils/command/build_py.py b/Lib/distutils/command/build_py.py index fa08579..7cc9353 100644 --- a/Lib/distutils/command/build_py.py +++ b/Lib/distutils/command/build_py.py @@ -133,7 +133,6 @@ class build_py(Command): def build_package_data(self): """Copy data files into build directory""" - lastdir = None for package, src_dir, build_dir, filenames in self.data_files: for filename in filenames: target = os.path.join(build_dir, filename) diff --git a/Lib/distutils/command/config.py b/Lib/distutils/command/config.py index ac80a54..830552c 100644 --- a/Lib/distutils/command/config.py +++ b/Lib/distutils/command/config.py @@ -11,7 +11,8 @@ this header file lives". __revision__ = "$Id$" -import sys, os, re +import os +import re from distutils.core import Command from distutils.errors import DistutilsExecError diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py index bdf5f8f..7d3dc53 100644 --- a/Lib/distutils/command/register.py +++ b/Lib/distutils/command/register.py @@ -7,13 +7,15 @@ Implements the Distutils 'register' command (register with the repository). __revision__ = "$Id$" -import os, string, getpass +import os +import string +import getpass import io -import urllib.parse, urllib.request +import urllib.parse +import urllib.request from warnings import warn from distutils.core import PyPIRCCommand -from distutils.errors import * from distutils import log class register(PyPIRCCommand): diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index 76e1de8..f33406c 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -7,14 +7,14 @@ __revision__ = "$Id$" import os import string import sys -from types import * from glob import glob from warnings import warn from distutils.core import Command from distutils import dir_util, dep_util, file_util, archive_util from distutils.text_file import TextFile -from distutils.errors import * +from distutils.errors import (DistutilsPlatformError, DistutilsOptionError, + DistutilsTemplateError) from distutils.filelist import FileList from distutils import log from distutils.util import convert_path diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py index 674edd4..bb1b7fc 100644 --- a/Lib/distutils/command/upload.py +++ b/Lib/distutils/command/upload.py @@ -1,8 +1,8 @@ """distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to PyPI).""" -import sys -import os, io +import os +import io import socket import platform from urllib.request import urlopen, Request, HTTPError @@ -10,7 +10,7 @@ from base64 import standard_b64encode from urllib.parse import urlparse from hashlib import md5 -from distutils.errors import * +from distutils.errors import DistutilsOptionError from distutils.core import PyPIRCCommand from distutils.spawn import spawn from distutils import log diff --git a/Lib/distutils/config.py b/Lib/distutils/config.py index 5b625f3..fe41ce9 100644 --- a/Lib/distutils/config.py +++ b/Lib/distutils/config.py @@ -4,7 +4,6 @@ Provides the PyPIRCCommand class, the base class for the command classes that uses .pypirc in the distutils.command package. """ import os -import sys from configparser import ConfigParser from distutils.cmd import Command @@ -60,8 +59,6 @@ class PyPIRCCommand(Command): if os.path.exists(rc): self.announce('Using PyPI login from %s' % rc) repository = self.repository or self.DEFAULT_REPOSITORY - realm = self.realm or self.DEFAULT_REALM - config = ConfigParser() config.read(rc) sections = config.sections() diff --git a/Lib/distutils/core.py b/Lib/distutils/core.py index 95c0357..c820a42 100644 --- a/Lib/distutils/core.py +++ b/Lib/distutils/core.py @@ -8,10 +8,12 @@ really defined in distutils.dist and distutils.cmd. __revision__ = "$Id$" -import sys, os +import sys +import os from distutils.debug import DEBUG -from distutils.errors import * +from distutils.errors import (DistutilsSetupError, DistutilsArgError, + DistutilsError, CCompilerError) from distutils.util import grok_environment_error # Mainly import these so setup scripts can "from distutils.core import" them. @@ -31,7 +33,7 @@ usage: %(script)s [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] or: %(script)s cmd --help """ -def gen_usage (script_name): +def gen_usage(script_name): script = os.path.basename(script_name) return USAGE % vars() @@ -56,7 +58,7 @@ extension_keywords = ('name', 'sources', 'include_dirs', 'extra_objects', 'extra_compile_args', 'extra_link_args', 'swig_opts', 'export_symbols', 'depends', 'language') -def setup (**attrs): +def setup(**attrs): """The gateway to the Distutils: do everything your setup script needs to do, in a highly flexible and user-driven way. Briefly: create a Distribution instance; find and parse config files; parse the command @@ -168,10 +170,8 @@ def setup (**attrs): return dist -# setup () - -def run_setup (script_name, script_args=None, stop_after="run"): +def run_setup(script_name, script_args=None, stop_after="run"): """Run a setup script in a somewhat controlled environment, and return the Distribution instance that drives things. This is useful if you need to find out the distribution meta-data (passed as @@ -234,7 +234,4 @@ def run_setup (script_name, script_args=None, stop_after="run"): # I wonder if the setup script's namespace -- g and l -- would be of # any interest to callers? - #print "_setup_distribution:", _setup_distribution return _setup_distribution - -# run_setup () diff --git a/Lib/distutils/cygwinccompiler.py b/Lib/distutils/cygwinccompiler.py index d9f4a43..3e2a634 100644 --- a/Lib/distutils/cygwinccompiler.py +++ b/Lib/distutils/cygwinccompiler.py @@ -53,11 +53,9 @@ import copy import re from warnings import warn -from distutils.ccompiler import gen_preprocess_options, gen_lib_options from distutils.unixccompiler import UnixCCompiler from distutils.file_util import write_file from distutils.errors import DistutilsExecError, CompileError, UnknownFileError -from distutils import log from distutils.util import get_compiler_versions def get_msvcr(): diff --git a/Lib/distutils/dir_util.py b/Lib/distutils/dir_util.py index 98e6252..370025b 100644 --- a/Lib/distutils/dir_util.py +++ b/Lib/distutils/dir_util.py @@ -4,7 +4,7 @@ Utility functions for manipulating directories and directory trees.""" __revision__ = "$Id$" -import os, sys +import os from distutils.errors import DistutilsFileError, DistutilsInternalError from distutils import log diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index 353525e..5a107e7 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -14,7 +14,8 @@ try: except ImportError: warnings = None -from distutils.errors import * +from distutils.errors import (DistutilsOptionError, DistutilsArgError, + DistutilsModuleError, DistutilsClassError) from distutils.fancy_getopt import FancyGetopt, translate_longopt from distutils.util import check_environ, strtobool, rfc822_escape from distutils import log diff --git a/Lib/distutils/emxccompiler.py b/Lib/distutils/emxccompiler.py index 50634d6..fd79aec 100644 --- a/Lib/distutils/emxccompiler.py +++ b/Lib/distutils/emxccompiler.py @@ -24,11 +24,9 @@ __revision__ = "$Id$" import os, sys, copy from warnings import warn -from distutils.ccompiler import gen_preprocess_options, gen_lib_options from distutils.unixccompiler import UnixCCompiler from distutils.file_util import write_file from distutils.errors import DistutilsExecError, CompileError, UnknownFileError -from distutils import log from distutils.util import get_compiler_versions class EMXCCompiler (UnixCCompiler): diff --git a/Lib/distutils/extension.py b/Lib/distutils/extension.py index 5c07bda..10aaf7c 100644 --- a/Lib/distutils/extension.py +++ b/Lib/distutils/extension.py @@ -6,7 +6,6 @@ modules in setup scripts.""" __revision__ = "$Id$" import os -import sys import warnings # This class is really only used by the "build_ext" command, so it might diff --git a/Lib/distutils/fancy_getopt.py b/Lib/distutils/fancy_getopt.py index 879d4d2..73343ad 100644 --- a/Lib/distutils/fancy_getopt.py +++ b/Lib/distutils/fancy_getopt.py @@ -10,9 +10,11 @@ additional features: __revision__ = "$Id$" -import sys, string, re +import sys +import string +import re import getopt -from distutils.errors import * +from distutils.errors import DistutilsGetoptError, DistutilsArgError # Much like command_re in distutils.core, this is close to but not quite # the same as a Python NAME -- except, in the spirit of most GNU @@ -444,16 +446,3 @@ class OptionDummy: 'options' will be initialized to None.""" for opt in options: setattr(self, opt, None) - - -if __name__ == "__main__": - text = """\ -Tra-la-la, supercalifragilisticexpialidocious. -How *do* you spell that odd word, anyways? -(Someone ask Mary -- she'll know [or she'll -say, "How should I know?"].)""" - - for w in (10, 20, 30, 40): - print("width: %d" % w) - print("\n".join(wrap_text(text, w))) - print() diff --git a/Lib/distutils/msvc9compiler.py b/Lib/distutils/msvc9compiler.py index c84fb0b..4d05a44 100644 --- a/Lib/distutils/msvc9compiler.py +++ b/Lib/distutils/msvc9compiler.py @@ -19,10 +19,9 @@ import subprocess import sys import re -from distutils.errors import DistutilsExecError, DistutilsPlatformError, \ - CompileError, LibError, LinkError -from distutils.ccompiler import CCompiler, gen_preprocess_options, \ - gen_lib_options +from distutils.errors import (DistutilsExecError, DistutilsPlatformError, + CompileError, LibError, LinkError) +from distutils.ccompiler import CCompiler, gen_lib_options from distutils import log from distutils.util import get_platform diff --git a/Lib/distutils/msvccompiler.py b/Lib/distutils/msvccompiler.py index 1cd0f91..dc3bd8d 100644 --- a/Lib/distutils/msvccompiler.py +++ b/Lib/distutils/msvccompiler.py @@ -10,12 +10,12 @@ for the Microsoft Visual Studio. __revision__ = "$Id$" -import sys, os -from distutils.errors import \ - DistutilsExecError, DistutilsPlatformError, \ - CompileError, LibError, LinkError -from distutils.ccompiler import \ - CCompiler, gen_preprocess_options, gen_lib_options +import sys +import os + +from distutils.errors import (DistutilsExecError, DistutilsPlatformError, + CompileError, LibError, LinkError) +from distutils.ccompiler import CCompiler, gen_lib_options from distutils import log _can_read_reg = False @@ -124,7 +124,7 @@ class MacroExpander: self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1") else: self.set_macro("FrameworkSDKDir", net, "sdkinstallroot") - except KeyError as exc: # + except KeyError: raise DistutilsPlatformError( """Python was built with Visual Studio 2003; extensions must be built with a compiler than can generate compatible binaries. diff --git a/Lib/distutils/text_file.py b/Lib/distutils/text_file.py index 97459fb..53c8561 100644 --- a/Lib/distutils/text_file.py +++ b/Lib/distutils/text_file.py @@ -6,8 +6,8 @@ lines, and joining lines with backslashes.""" __revision__ = "$Id$" -import sys, os, io - +import sys +import io class TextFile: """Provides a file-like object that takes care of all the things you |