diff options
author | ?ric Araujo <merwok@netwok.org> | 2011-11-15 11:50:00 +0100 |
---|---|---|
committer | ?ric Araujo <merwok@netwok.org> | 2011-11-15 11:50:00 +0100 |
commit | 144074adaade12979d514a785267b9d32b927c42 (patch) | |
tree | 82597117626928c24d42d7df9548e79d8a72ee11 | |
parent | 387c66ed2370d56c91c416b2d6a9b0d452108553 (diff) | |
download | disutils2-144074adaade12979d514a785267b9d32b927c42.tar.gz |
Remove 'verbose' arguments, obsoleted by logging
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | distutils2/command/build_ext.py | 5 | ||||
-rw-r--r-- | distutils2/command/cmd.py | 18 | ||||
-rw-r--r-- | distutils2/command/sdist.py | 5 | ||||
-rw-r--r-- | distutils2/command/test.py | 3 | ||||
-rw-r--r-- | distutils2/compiler/__init__.py | 9 | ||||
-rw-r--r-- | distutils2/compiler/bcppcompiler.py | 4 | ||||
-rw-r--r-- | distutils2/compiler/ccompiler.py | 3 | ||||
-rw-r--r-- | distutils2/compiler/cygwinccompiler.py | 8 | ||||
-rw-r--r-- | distutils2/compiler/msvc9compiler.py | 4 | ||||
-rw-r--r-- | distutils2/compiler/msvccompiler.py | 4 | ||||
-rw-r--r-- | distutils2/util.py | 23 |
12 files changed, 38 insertions, 50 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index d29edc3..f6f6f2a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -157,6 +157,8 @@ CONTRIBUTORS.txt for full names. Bug numbers refer to http://bugs.python.org/. - Rename get_reinitialized_command back to reinitialize_command [éric] - Rename install_distinfo's option from distinfo-dir to the more usual install_dir [éric] +- Remove verbose arguments for Command and Compiler classes as well as util + functions, obsoleted by logging [éric] 1.0a3 - 2010-10-08 diff --git a/distutils2/command/build_ext.py b/distutils2/command/build_ext.py index b73149a..582ff3d 100644 --- a/distutils2/command/build_ext.py +++ b/distutils2/command/build_ext.py @@ -297,14 +297,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/distutils2/command/cmd.py b/distutils2/command/cmd.py index 5992187..1cdae14 100644 --- a/distutils2/command/cmd.py +++ b/distutils2/command/cmd.py @@ -351,7 +351,7 @@ class Command(object): def execute(self, func, args, msg=None, level=1): util.execute(func, args, msg, dry_run=self.dry_run) - def mkpath(self, name, mode=00777, dry_run=None, verbose=0): + def mkpath(self, name, mode=00777, dry_run=None): if dry_run is None: dry_run = self.dry_run name = os.path.normpath(name) @@ -367,9 +367,11 @@ class Command(object): 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(object): 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(object): 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/distutils2/command/sdist.py b/distutils2/command/sdist.py index 978b009..a4fa4bd 100644 --- a/distutils2/command/sdist.py +++ b/distutils2/command/sdist.py @@ -337,12 +337,11 @@ class sdist(Command): """ return self.archive_files - def create_tree(self, base_dir, files, mode=0777, verbose=1, - dry_run=False): + def create_tree(self, base_dir, files, mode=0777, 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/distutils2/command/test.py b/distutils2/command/test.py index 09af3b6..1c9d114 100644 --- a/distutils2/command/test.py +++ b/distutils2/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('distutils2') verbose = logger.getEffectiveLevel() >= logging.DEBUG verbosity = verbose + 1 diff --git a/distutils2/compiler/__init__.py b/distutils2/compiler/__init__.py index 2f95319..071e97b 100644 --- a/distutils2/compiler/__init__.py +++ b/distutils2/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/distutils2/compiler/bcppcompiler.py b/distutils2/compiler/bcppcompiler.py index bb46467..4591c68 100644 --- a/distutils2/compiler/bcppcompiler.py +++ b/distutils2/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/distutils2/compiler/ccompiler.py b/distutils2/compiler/ccompiler.py index 8ea2e50..ef09a2d 100644 --- a/distutils2/compiler/ccompiler.py +++ b/distutils2/compiler/ccompiler.py @@ -79,10 +79,9 @@ class CCompiler(object): } 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/distutils2/compiler/cygwinccompiler.py b/distutils2/compiler/cygwinccompiler.py index b2cf19c..8115e9b 100644 --- a/distutils2/compiler/cygwinccompiler.py +++ b/distutils2/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/distutils2/compiler/msvc9compiler.py b/distutils2/compiler/msvc9compiler.py index 0c49618..b201d85 100644 --- a/distutils2/compiler/msvc9compiler.py +++ b/distutils2/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/distutils2/compiler/msvccompiler.py b/distutils2/compiler/msvccompiler.py index 044422b..83211ee 100644 --- a/distutils2/compiler/msvccompiler.py +++ b/distutils2/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/distutils2/util.py b/distutils2/util.py index dcb8e9d..0c6c3a4 100644 --- a/distutils2/util.py +++ b/distutils2/util.py @@ -264,7 +264,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 @@ -688,7 +688,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. @@ -1364,8 +1364,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): from distutils.file_util import copy_file if not dry_run and not os.path.isdir(src): @@ -1382,7 +1381,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 = [] @@ -1392,8 +1391,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) @@ -1402,11 +1400,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 @@ -1419,7 +1416,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=0777, verbose=True, dry_run=False): +def _mkpath(name, mode=0777, dry_run=False): # Detect a common bug -- name is None if not isinstance(name, basestring): raise PackagingInternalError( @@ -1454,9 +1451,7 @@ def _mkpath(name, mode=0777, 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) |