mirror of
https://github.com/python/cpython.git
synced 2025-10-27 03:34:32 +00:00
Make setup.py less chatty by default.
This is a conservative version of SF patch 504889. It uses the log module instead of calling print in various places, and it ignores the verbose argument passed to many functions and set as an attribute on some objects. Instead, it uses the verbosity set on the logger via the command line. The log module is now preferred over announce() and warn() methods that exist only for backwards compatibility. XXX This checkin changes a lot of modules that have no test suite and aren't exercised by the Python build process. It will need substantial testing.
This commit is contained in:
parent
6fa82a3477
commit
cd8a1148e1
32 changed files with 260 additions and 313 deletions
|
|
@ -14,6 +14,7 @@
|
|||
from distutils.text_file import TextFile
|
||||
from distutils.errors import *
|
||||
from distutils.filelist import FileList
|
||||
from distutils import log
|
||||
|
||||
|
||||
def show_formats ():
|
||||
|
|
@ -233,31 +234,17 @@ def get_file_list (self):
|
|||
self.warn(("manifest template '%s' does not exist " +
|
||||
"(using default file list)") %
|
||||
self.template)
|
||||
|
||||
self.filelist.findall()
|
||||
|
||||
# Add default file set to 'files'
|
||||
if self.use_defaults:
|
||||
self.add_defaults()
|
||||
|
||||
# Read manifest template if it exists
|
||||
if template_exists:
|
||||
self.read_template()
|
||||
|
||||
# Prune away any directories that don't belong in the source
|
||||
# distribution
|
||||
if self.prune:
|
||||
self.prune_file_list()
|
||||
|
||||
# File list now complete -- sort it so that higher-level files
|
||||
# come first
|
||||
self.filelist.sort()
|
||||
|
||||
# Remove duplicates from the file list
|
||||
self.filelist.remove_duplicates()
|
||||
|
||||
# And write complete file list (including default file set) to
|
||||
# the manifest.
|
||||
self.write_manifest()
|
||||
|
||||
# Don't regenerate the manifest, just read it in.
|
||||
|
|
@ -321,13 +308,12 @@ def add_defaults (self):
|
|||
|
||||
|
||||
def read_template (self):
|
||||
"""Read and parse manifest template file named by self.template.
|
||||
|
||||
"""Read and parse the manifest template file named by
|
||||
'self.template' (usually "MANIFEST.in"). The parsing and
|
||||
processing is done by 'self.filelist', which updates itself
|
||||
accordingly.
|
||||
(usually "MANIFEST.in") The parsing and processing is done by
|
||||
'self.filelist', which updates itself accordingly.
|
||||
"""
|
||||
self.announce("reading manifest template '%s'" % self.template)
|
||||
log.info("reading manifest template '%s'", self.template)
|
||||
template = TextFile(self.template,
|
||||
strip_comments=1,
|
||||
skip_blanks=1,
|
||||
|
|
@ -384,7 +370,7 @@ def read_manifest (self):
|
|||
fill in 'self.filelist', the list of files to include in the source
|
||||
distribution.
|
||||
"""
|
||||
self.announce("reading manifest file '%s'" % self.manifest)
|
||||
log.info("reading manifest file '%s'", self.manifest)
|
||||
manifest = open(self.manifest)
|
||||
while 1:
|
||||
line = manifest.readline()
|
||||
|
|
@ -410,8 +396,7 @@ def make_release_tree (self, base_dir, files):
|
|||
# put 'files' there; the 'mkpath()' is just so we don't die
|
||||
# if the manifest happens to be empty.
|
||||
self.mkpath(base_dir)
|
||||
dir_util.create_tree(base_dir, files,
|
||||
verbose=self.verbose, dry_run=self.dry_run)
|
||||
dir_util.create_tree(base_dir, files, dry_run=self.dry_run)
|
||||
|
||||
# And walk over the list of files, either making a hard link (if
|
||||
# os.link exists) to each one that doesn't already exist in its
|
||||
|
|
@ -428,12 +413,12 @@ def make_release_tree (self, base_dir, files):
|
|||
msg = "copying files to %s..." % base_dir
|
||||
|
||||
if not files:
|
||||
self.warn("no files to distribute -- empty manifest?")
|
||||
log.warn("no files to distribute -- empty manifest?")
|
||||
else:
|
||||
self.announce(msg)
|
||||
log.info(msg)
|
||||
for file in files:
|
||||
if not os.path.isfile(file):
|
||||
self.warn("'%s' not a regular file -- skipping" % file)
|
||||
log.warn("'%s' not a regular file -- skipping" % file)
|
||||
else:
|
||||
dest = os.path.join(base_dir, file)
|
||||
self.copy_file(file, dest, link=link)
|
||||
|
|
@ -464,7 +449,7 @@ def make_distribution (self):
|
|||
self.archive_files = archive_files
|
||||
|
||||
if not self.keep_temp:
|
||||
dir_util.remove_tree(base_dir, self.verbose, self.dry_run)
|
||||
dir_util.remove_tree(base_dir, dry_run=self.dry_run)
|
||||
|
||||
def get_archive_files (self):
|
||||
"""Return the list of archive files created when the command
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue