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.
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 re
import sys
import site
-import logging
import sysconfig
from packaging.util import get_platform
@@ -288,14 +287,9 @@
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 @@
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 @@
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 @@
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 @@
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 @@
"""
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 @@
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