diff options
author | Éric Araujo <merwok@netwok.org> | 2011-11-15 10:43:20 (GMT) |
---|---|---|
committer | Éric Araujo <merwok@netwok.org> | 2011-11-15 10:43:20 (GMT) |
commit | 4d1554650475cc9a2c2773d6758687f4b3542de9 (patch) | |
tree | 90440373b540b9097ae6c9116992243b4dd75941 /Lib | |
parent | 9b5c7f44fad8fd78c23826218c6e7b425c06b183 (diff) | |
download | cpython-4d1554650475cc9a2c2773d6758687f4b3542de9.zip cpython-4d1554650475cc9a2c2773d6758687f4b3542de9.tar.gz cpython-4d1554650475cc9a2c2773d6758687f4b3542de9.tar.bz2 |
Remove obsolete verbose arguments from packaging.
Logging replaces verbose arguments. I haven’t fixed the example in
Doc/install/install.rst because I have major fixes and changes to the
oc under way and will fix or remove that example as part of that task.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/packaging/command/build_ext.py | 6 | ||||
-rw-r--r-- | Lib/packaging/command/cmd.py | 18 | ||||
-rw-r--r-- | Lib/packaging/command/sdist.py | 5 | ||||
-rw-r--r-- | Lib/packaging/command/test.py | 3 | ||||
-rw-r--r-- | Lib/packaging/compiler/__init__.py | 9 | ||||
-rw-r--r-- | Lib/packaging/compiler/bcppcompiler.py | 4 | ||||
-rw-r--r-- | Lib/packaging/compiler/ccompiler.py | 3 | ||||
-rw-r--r-- | Lib/packaging/compiler/cygwinccompiler.py | 8 | ||||
-rw-r--r-- | Lib/packaging/compiler/msvc9compiler.py | 4 | ||||
-rw-r--r-- | Lib/packaging/compiler/msvccompiler.py | 4 | ||||
-rw-r--r-- | Lib/packaging/util.py | 23 |
11 files changed, 36 insertions, 51 deletions
diff --git a/Lib/packaging/command/build_ext.py b/Lib/packaging/command/build_ext.py index 4051a2d..4f375b6 100644 --- a/Lib/packaging/command/build_ext.py +++ b/Lib/packaging/command/build_ext.py @@ -4,7 +4,6 @@ import os import re import sys import site -import logging import sysconfig from packaging.util import get_platform @@ -288,14 +287,9 @@ class build_ext(Command): self.libraries.extend(build_clib.get_library_names() or []) self.library_dirs.append(build_clib.build_clib) - # Temporary kludge until we remove the verbose arguments and use - # logging everywhere - verbose = logger.getEffectiveLevel() >= logging.DEBUG - # Setup the CCompiler object that we'll use to do all the # compiling and linking self.compiler_obj = new_compiler(compiler=self.compiler, - verbose=verbose, dry_run=self.dry_run, force=self.force) diff --git a/Lib/packaging/command/cmd.py b/Lib/packaging/command/cmd.py index 333b99d..25e6a72 100644 --- a/Lib/packaging/command/cmd.py +++ b/Lib/packaging/command/cmd.py @@ -351,7 +351,7 @@ class Command: def execute(self, func, args, msg=None, level=1): util.execute(func, args, msg, dry_run=self.dry_run) - def mkpath(self, name, mode=0o777, dry_run=None, verbose=0): + def mkpath(self, name, mode=0o777, dry_run=None): if dry_run is None: dry_run = self.dry_run name = os.path.normpath(name) @@ -367,9 +367,11 @@ class Command: def copy_file(self, infile, outfile, preserve_mode=True, preserve_times=True, link=None, level=1): - """Copy a file respecting verbose, dry-run and force flags. (The - former two default to whatever is in the Distribution object, and - the latter defaults to false for commands that don't define it.)""" + """Copy a file respecting dry-run and force flags. + + (dry-run defaults to whatever is in the Distribution object, and + force to false for commands that don't define it.) + """ if self.dry_run: # XXX add a comment return @@ -380,11 +382,13 @@ class Command: def copy_tree(self, infile, outfile, preserve_mode=True, preserve_times=True, preserve_symlinks=False, level=1): - """Copy an entire directory tree respecting verbose, dry-run, + """Copy an entire directory tree respecting dry-run and force flags. """ if self.dry_run: - return # see if we want to display something + # XXX should not return but let copy_tree log and decide to execute + # or not based on its dry_run argument + return return util.copy_tree(infile, outfile, preserve_mode, preserve_times, preserve_symlinks, not self.force, dry_run=self.dry_run) @@ -392,7 +396,7 @@ class Command: def move_file(self, src, dst, level=1): """Move a file respecting the dry-run flag.""" if self.dry_run: - return # XXX log ? + return # XXX same thing return move(src, dst) def spawn(self, cmd, search_path=True, level=1): diff --git a/Lib/packaging/command/sdist.py b/Lib/packaging/command/sdist.py index 09b26db..d399981 100644 --- a/Lib/packaging/command/sdist.py +++ b/Lib/packaging/command/sdist.py @@ -337,12 +337,11 @@ class sdist(Command): """ return self.archive_files - def create_tree(self, base_dir, files, mode=0o777, verbose=1, - dry_run=False): + def create_tree(self, base_dir, files, mode=0o777, dry_run=False): need_dir = set() for file in files: need_dir.add(os.path.join(base_dir, os.path.dirname(file))) # Now create them for dir in sorted(need_dir): - self.mkpath(dir, mode, verbose=verbose, dry_run=dry_run) + self.mkpath(dir, mode, dry_run=dry_run) diff --git a/Lib/packaging/command/test.py b/Lib/packaging/command/test.py index 5b62a12..4d5348f 100644 --- a/Lib/packaging/command/test.py +++ b/Lib/packaging/command/test.py @@ -60,8 +60,7 @@ class test(Command): self.run_command('build') sys.path.insert(0, build.build_lib) - # Temporary kludge until we remove the verbose arguments and use - # logging everywhere + # XXX maybe we could pass the verbose argument of pysetup here logger = logging.getLogger('packaging') verbose = logger.getEffectiveLevel() >= logging.DEBUG verbosity = verbose + 1 diff --git a/Lib/packaging/compiler/__init__.py b/Lib/packaging/compiler/__init__.py index e267e9f..d8e02ce 100644 --- a/Lib/packaging/compiler/__init__.py +++ b/Lib/packaging/compiler/__init__.py @@ -153,8 +153,7 @@ def show_compilers(): pretty_printer.print_help("List of available compilers:") -def new_compiler(plat=None, compiler=None, verbose=0, dry_run=False, - force=False): +def new_compiler(plat=None, compiler=None, dry_run=False, force=False): """Generate an instance of some CCompiler subclass for the supplied platform/compiler combination. 'plat' defaults to 'os.name' (eg. 'posix', 'nt'), and 'compiler' defaults to the default compiler @@ -183,11 +182,7 @@ def new_compiler(plat=None, compiler=None, verbose=0, dry_run=False, cls = resolve_name(cls) _COMPILERS[compiler] = cls - - # XXX The None is necessary to preserve backwards compatibility - # with classes that expect verbose to be the first positional - # argument. - return cls(None, dry_run, force) + return cls(dry_run, force) def gen_preprocess_options(macros, include_dirs): diff --git a/Lib/packaging/compiler/bcppcompiler.py b/Lib/packaging/compiler/bcppcompiler.py index a4aa2fa..06c758c 100644 --- a/Lib/packaging/compiler/bcppcompiler.py +++ b/Lib/packaging/compiler/bcppcompiler.py @@ -47,8 +47,8 @@ class BCPPCompiler(CCompiler) : exe_extension = '.exe' - def __init__(self, verbose=0, dry_run=False, force=False): - super(BCPPCompiler, self).__init__(verbose, dry_run, force) + def __init__(self, dry_run=False, force=False): + super(BCPPCompiler, self).__init__(dry_run, force) # These executables are assumed to all be in the path. # Borland doesn't seem to use any special registry settings to diff --git a/Lib/packaging/compiler/ccompiler.py b/Lib/packaging/compiler/ccompiler.py index 02e22d2..98c4b68 100644 --- a/Lib/packaging/compiler/ccompiler.py +++ b/Lib/packaging/compiler/ccompiler.py @@ -79,10 +79,9 @@ class CCompiler: } language_order = ["c++", "objc", "c"] - def __init__(self, verbose=0, dry_run=False, force=False): + def __init__(self, dry_run=False, force=False): self.dry_run = dry_run self.force = force - self.verbose = verbose # 'output_dir': a common output directory for object, library, # shared object, and shared library files diff --git a/Lib/packaging/compiler/cygwinccompiler.py b/Lib/packaging/compiler/cygwinccompiler.py index d793abd..3eec067 100644 --- a/Lib/packaging/compiler/cygwinccompiler.py +++ b/Lib/packaging/compiler/cygwinccompiler.py @@ -92,8 +92,8 @@ class CygwinCCompiler(UnixCCompiler): shared_lib_format = "%s%s" exe_extension = ".exe" - def __init__(self, verbose=0, dry_run=False, force=False): - super(CygwinCCompiler, self).__init__(verbose, dry_run, force) + def __init__(self, dry_run=False, force=False): + super(CygwinCCompiler, self).__init__(dry_run, force) status, details = check_config_h() logger.debug("Python's GCC status: %s (details: %s)", status, details) @@ -270,8 +270,8 @@ class Mingw32CCompiler(CygwinCCompiler): name = 'mingw32' description = 'MinGW32 compiler' - def __init__(self, verbose=0, dry_run=False, force=False): - super(Mingw32CCompiler, self).__init__(verbose, dry_run, force) + def __init__(self, dry_run=False, force=False): + super(Mingw32CCompiler, self).__init__(dry_run, force) # ld_version >= "2.13" support -shared so use it instead of # -mdll -static diff --git a/Lib/packaging/compiler/msvc9compiler.py b/Lib/packaging/compiler/msvc9compiler.py index 539df73..029aa77 100644 --- a/Lib/packaging/compiler/msvc9compiler.py +++ b/Lib/packaging/compiler/msvc9compiler.py @@ -309,8 +309,8 @@ class MSVCCompiler(CCompiler) : static_lib_format = shared_lib_format = '%s%s' exe_extension = '.exe' - def __init__(self, verbose=0, dry_run=False, force=False): - super(MSVCCompiler, self).__init__(verbose, dry_run, force) + def __init__(self, dry_run=False, force=False): + super(MSVCCompiler, self).__init__(dry_run, force) self.__version = VERSION self.__root = r"Software\Microsoft\VisualStudio" # self.__macros = MACROS diff --git a/Lib/packaging/compiler/msvccompiler.py b/Lib/packaging/compiler/msvccompiler.py index 740bc30..39a10b2 100644 --- a/Lib/packaging/compiler/msvccompiler.py +++ b/Lib/packaging/compiler/msvccompiler.py @@ -236,8 +236,8 @@ class MSVCCompiler(CCompiler): static_lib_format = shared_lib_format = '%s%s' exe_extension = '.exe' - def __init__(self, verbose=0, dry_run=False, force=False): - super(MSVCCompiler, self).__init__(verbose, dry_run, force) + def __init__(self, dry_run=False, force=False): + super(MSVCCompiler, self).__init__(dry_run, force) self.__version = get_build_version() self.__arch = get_build_architecture() if self.__arch == "Intel": diff --git a/Lib/packaging/util.py b/Lib/packaging/util.py index e1d7ad0..5b651b1 100644 --- a/Lib/packaging/util.py +++ b/Lib/packaging/util.py @@ -259,7 +259,7 @@ def split_multiline(value): if element] -def execute(func, args, msg=None, verbose=0, dry_run=False): +def execute(func, args, msg=None, dry_run=False): """Perform some action that affects the outside world. Some actions (e.g. writing to the filesystem) are special because @@ -681,7 +681,7 @@ if sys.platform == 'darwin': _cfg_target_split = None -def spawn(cmd, search_path=True, verbose=0, dry_run=False, env=None): +def spawn(cmd, search_path=True, dry_run=False, env=None): """Run another program specified as a command list 'cmd' in a new process. 'cmd' is just the argument list for the new process, ie. @@ -1331,8 +1331,7 @@ def get_install_method(path): # XXX to be replaced by shutil.copytree def copy_tree(src, dst, preserve_mode=True, preserve_times=True, - preserve_symlinks=False, update=False, verbose=True, - dry_run=False): + preserve_symlinks=False, update=False, dry_run=False): # FIXME use of this function is why we get spurious logging message on # stdout when tests run; kill and replace by shutil! from distutils.file_util import copy_file @@ -1351,7 +1350,7 @@ def copy_tree(src, dst, preserve_mode=True, preserve_times=True, "error listing files in '%s': %s" % (src, errstr)) if not dry_run: - _mkpath(dst, verbose=verbose) + _mkpath(dst) outputs = [] @@ -1361,8 +1360,7 @@ def copy_tree(src, dst, preserve_mode=True, preserve_times=True, if preserve_symlinks and os.path.islink(src_name): link_dest = os.readlink(src_name) - if verbose >= 1: - logger.info("linking %s -> %s", dst_name, link_dest) + logger.info("linking %s -> %s", dst_name, link_dest) if not dry_run: os.symlink(link_dest, dst_name) outputs.append(dst_name) @@ -1371,11 +1369,10 @@ def copy_tree(src, dst, preserve_mode=True, preserve_times=True, outputs.extend( copy_tree(src_name, dst_name, preserve_mode, preserve_times, preserve_symlinks, update, - verbose=verbose, dry_run=dry_run)) + dry_run=dry_run)) else: copy_file(src_name, dst_name, preserve_mode, - preserve_times, update, verbose=verbose, - dry_run=dry_run) + preserve_times, update, dry_run=dry_run) outputs.append(dst_name) return outputs @@ -1388,7 +1385,7 @@ _path_created = set() # I don't use os.makedirs because a) it's new to Python 1.5.2, and # b) it blows up if the directory already exists (I want to silently # succeed in that case). -def _mkpath(name, mode=0o777, verbose=True, dry_run=False): +def _mkpath(name, mode=0o777, dry_run=False): # Detect a common bug -- name is None if not isinstance(name, str): raise PackagingInternalError( @@ -1423,9 +1420,7 @@ def _mkpath(name, mode=0o777, verbose=True, dry_run=False): if abs_head in _path_created: continue - if verbose >= 1: - logger.info("creating %s", head) - + logger.info("creating %s", head) if not dry_run: try: os.mkdir(head, mode) |