diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-06-04 20:14:43 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-06-04 20:14:43 (GMT) |
commit | cd8a1148e19116db109f27d26c02e1de536dc76e (patch) | |
tree | e3969bc16f8ef0c540f1d0e72fb0da711344d758 /Lib/distutils/command/sdist.py | |
parent | 6fa82a34775576b90c8ec38e8968dfbb0b02e11d (diff) | |
download | cpython-cd8a1148e19116db109f27d26c02e1de536dc76e.zip cpython-cd8a1148e19116db109f27d26c02e1de536dc76e.tar.gz cpython-cd8a1148e19116db109f27d26c02e1de536dc76e.tar.bz2 |
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.
Diffstat (limited to 'Lib/distutils/command/sdist.py')
-rw-r--r-- | Lib/distutils/command/sdist.py | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index fbd3c6d..082aa88 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -14,6 +14,7 @@ from distutils import dir_util, dep_util, file_util, archive_util 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 @@ class sdist (Command): 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 @@ class sdist (Command): 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 @@ class sdist (Command): 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 @@ class sdist (Command): # 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 @@ class sdist (Command): 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 @@ class sdist (Command): 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 |