Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4d15546

Browse files
committed
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.
1 parent 9b5c7f4 commit 4d15546

14 files changed

Lines changed: 44 additions & 57 deletions

File tree

Doc/install/install.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,8 @@ Additionally, there's a ``global`` section for options that affect every command
842842
Sections consist of one or more lines containing a single option specified as
843843
``option = value``.
844844

845+
.. XXX use dry-run in the next example or use a pysetup option as example
846+
845847
For example, here's a complete configuration file that forces all commands to
846848
run quietly by default::
847849

Doc/library/packaging.compiler.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function. Compiler types provided by Packaging are listed in
1515
Public functions
1616
----------------
1717

18-
.. function:: new_compiler(plat=None, compiler=None, verbose=0, dry_run=0, force=0)
18+
.. function:: new_compiler(plat=None, compiler=None, dry_run=False, force=False)
1919

2020
Factory function to generate an instance of some
2121
:class:`~.ccompiler.CCompiler` subclass for the requested platform or
@@ -165,7 +165,7 @@ link steps needed to build a single project. Methods are provided to set
165165
options for the compiler --- macro definitions, include directories, link path,
166166
libraries and the like.
167167

168-
.. class:: CCompiler([verbose=0, dry_run=0, force=0])
168+
.. class:: CCompiler(dry_run=False, force=False)
169169

170170
The abstract base class :class:`CCompiler` defines the interface that must be
171171
implemented by real compiler classes. The class also has some utility
@@ -180,11 +180,11 @@ libraries and the like.
180180
per-compilation or per-link basis.
181181

182182
The constructor for each subclass creates an instance of the Compiler object.
183-
Flags are *verbose* (show verbose output), *dry_run* (don't actually execute
183+
Flags are *dry_run* (don't actually execute
184184
the steps) and *force* (rebuild everything, regardless of dependencies). All
185-
of these flags default to ``0`` (off). Note that you probably don't want to
185+
of these flags default to ``False`` (off). Note that you probably don't want to
186186
instantiate :class:`CCompiler` or one of its subclasses directly - use the
187-
:func:`packaging.CCompiler.new_compiler` factory function instead.
187+
:func:`new_compiler` factory function instead.
188188

189189
The following methods allow you to manually alter compiler options for the
190190
instance of the Compiler class.

Doc/library/packaging.util.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ This module contains various helpers for the other modules.
9090
Search the path for a given executable name.
9191

9292

93-
.. function:: execute(func, args, msg=None, verbose=0, dry_run=0)
93+
.. function:: execute(func, args, msg=None, dry_run=False)
9494

9595
Perform some action that affects the outside world (for instance, writing to
9696
the filesystem). Such actions are special because they are disabled by the

Lib/packaging/command/build_ext.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import re
55
import sys
66
import site
7-
import logging
87
import sysconfig
98

109
from packaging.util import get_platform
@@ -288,14 +287,9 @@ def run(self):
288287
self.libraries.extend(build_clib.get_library_names() or [])
289288
self.library_dirs.append(build_clib.build_clib)
290289

291-
# Temporary kludge until we remove the verbose arguments and use
292-
# logging everywhere
293-
verbose = logger.getEffectiveLevel() >= logging.DEBUG
294-
295290
# Setup the CCompiler object that we'll use to do all the
296291
# compiling and linking
297292
self.compiler_obj = new_compiler(compiler=self.compiler,
298-
verbose=verbose,
299293
dry_run=self.dry_run,
300294
force=self.force)
301295

Lib/packaging/command/cmd.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def get_sub_commands(self):
351351
def execute(self, func, args, msg=None, level=1):
352352
util.execute(func, args, msg, dry_run=self.dry_run)
353353

354-
def mkpath(self, name, mode=0o777, dry_run=None, verbose=0):
354+
def mkpath(self, name, mode=0o777, dry_run=None):
355355
if dry_run is None:
356356
dry_run = self.dry_run
357357
name = os.path.normpath(name)
@@ -367,9 +367,11 @@ def mkpath(self, name, mode=0o777, dry_run=None, verbose=0):
367367

368368
def copy_file(self, infile, outfile,
369369
preserve_mode=True, preserve_times=True, link=None, level=1):
370-
"""Copy a file respecting verbose, dry-run and force flags. (The
371-
former two default to whatever is in the Distribution object, and
372-
the latter defaults to false for commands that don't define it.)"""
370+
"""Copy a file respecting dry-run and force flags.
371+
372+
(dry-run defaults to whatever is in the Distribution object, and
373+
force to false for commands that don't define it.)
374+
"""
373375
if self.dry_run:
374376
# XXX add a comment
375377
return
@@ -380,19 +382,21 @@ def copy_file(self, infile, outfile,
380382

381383
def copy_tree(self, infile, outfile, preserve_mode=True,
382384
preserve_times=True, preserve_symlinks=False, level=1):
383-
"""Copy an entire directory tree respecting verbose, dry-run,
385+
"""Copy an entire directory tree respecting dry-run
384386
and force flags.
385387
"""
386388
if self.dry_run:
387-
return # see if we want to display something
389+
# XXX should not return but let copy_tree log and decide to execute
390+
# or not based on its dry_run argument
391+
return
388392

389393
return util.copy_tree(infile, outfile, preserve_mode, preserve_times,
390394
preserve_symlinks, not self.force, dry_run=self.dry_run)
391395

392396
def move_file(self, src, dst, level=1):
393397
"""Move a file respecting the dry-run flag."""
394398
if self.dry_run:
395-
return # XXX log ?
399+
return # XXX same thing
396400
return move(src, dst)
397401

398402
def spawn(self, cmd, search_path=True, level=1):

Lib/packaging/command/sdist.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,11 @@ def get_archive_files(self):
337337
"""
338338
return self.archive_files
339339

340-
def create_tree(self, base_dir, files, mode=0o777, verbose=1,
341-
dry_run=False):
340+
def create_tree(self, base_dir, files, mode=0o777, dry_run=False):
342341
need_dir = set()
343342
for file in files:
344343
need_dir.add(os.path.join(base_dir, os.path.dirname(file)))
345344

346345
# Now create them
347346
for dir in sorted(need_dir):
348-
self.mkpath(dir, mode, verbose=verbose, dry_run=dry_run)
347+
self.mkpath(dir, mode, dry_run=dry_run)

Lib/packaging/command/test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ def run(self):
6060
self.run_command('build')
6161
sys.path.insert(0, build.build_lib)
6262

63-
# Temporary kludge until we remove the verbose arguments and use
64-
# logging everywhere
63+
# XXX maybe we could pass the verbose argument of pysetup here
6564
logger = logging.getLogger('packaging')
6665
verbose = logger.getEffectiveLevel() >= logging.DEBUG
6766
verbosity = verbose + 1

Lib/packaging/compiler/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ def show_compilers():
153153
pretty_printer.print_help("List of available compilers:")
154154

155155

156-
def new_compiler(plat=None, compiler=None, verbose=0, dry_run=False,
157-
force=False):
156+
def new_compiler(plat=None, compiler=None, dry_run=False, force=False):
158157
"""Generate an instance of some CCompiler subclass for the supplied
159158
platform/compiler combination. 'plat' defaults to 'os.name'
160159
(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,
183182
cls = resolve_name(cls)
184183
_COMPILERS[compiler] = cls
185184

186-
187-
# XXX The None is necessary to preserve backwards compatibility
188-
# with classes that expect verbose to be the first positional
189-
# argument.
190-
return cls(None, dry_run, force)
185+
return cls(dry_run, force)
191186

192187

193188
def gen_preprocess_options(macros, include_dirs):

Lib/packaging/compiler/bcppcompiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class BCPPCompiler(CCompiler) :
4747
exe_extension = '.exe'
4848

4949

50-
def __init__(self, verbose=0, dry_run=False, force=False):
51-
super(BCPPCompiler, self).__init__(verbose, dry_run, force)
50+
def __init__(self, dry_run=False, force=False):
51+
super(BCPPCompiler, self).__init__(dry_run, force)
5252

5353
# These executables are assumed to all be in the path.
5454
# Borland doesn't seem to use any special registry settings to

Lib/packaging/compiler/ccompiler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ class CCompiler:
7979
}
8080
language_order = ["c++", "objc", "c"]
8181

82-
def __init__(self, verbose=0, dry_run=False, force=False):
82+
def __init__(self, dry_run=False, force=False):
8383
self.dry_run = dry_run
8484
self.force = force
85-
self.verbose = verbose
8685

8786
# 'output_dir': a common output directory for object, library,
8887
# shared object, and shared library files

0 commit comments

Comments
 (0)