summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/filelist.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2002-06-04 20:14:43 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2002-06-04 20:14:43 (GMT)
commitcd8a1148e19116db109f27d26c02e1de536dc76e (patch)
treee3969bc16f8ef0c540f1d0e72fb0da711344d758 /Lib/distutils/filelist.py
parent6fa82a34775576b90c8ec38e8968dfbb0b02e11d (diff)
downloadcpython-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/filelist.py')
-rw-r--r--Lib/distutils/filelist.py58
1 files changed, 24 insertions, 34 deletions
diff --git a/Lib/distutils/filelist.py b/Lib/distutils/filelist.py
index f7222fd..d39c835 100644
--- a/Lib/distutils/filelist.py
+++ b/Lib/distutils/filelist.py
@@ -37,27 +37,19 @@ class FileList:
def __init__(self,
warn=None,
debug_print=None):
- # use standard warning and debug functions if no other given
- self.warn = warn or self.__warn
- self.debug_print = debug_print or self.__debug_print
+ # ignore argument to FileList, but keep them for backwards
+ # compatibility
self.allfiles = None
self.files = []
-
def set_allfiles (self, allfiles):
self.allfiles = allfiles
def findall (self, dir=os.curdir):
self.allfiles = findall(dir)
-
- # -- Fallback warning/debug functions ------------------------------
-
- def __warn (self, msg):
- sys.stderr.write("warning: %s\n" % msg)
-
- def __debug_print (self, msg):
+ def debug_print (self, msg):
"""Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
"""
@@ -65,7 +57,6 @@ class FileList:
if DEBUG:
print msg
-
# -- List-like methods ---------------------------------------------
def append (self, item):
@@ -87,8 +78,8 @@ class FileList:
def remove_duplicates (self):
# Assumes list has been sorted!
- for i in range(len(self.files)-1, 0, -1):
- if self.files[i] == self.files[i-1]:
+ for i in range(len(self.files) - 1, 0, -1):
+ if self.files[i] == self.files[i - 1]:
del self.files[i]
@@ -147,61 +138,60 @@ class FileList:
self.debug_print("include " + string.join(patterns))
for pattern in patterns:
if not self.include_pattern(pattern, anchor=1):
- self.warn("no files found matching '%s'" % pattern)
+ log.warn("warning: no files found matching '%s'",
+ pattern)
elif action == 'exclude':
self.debug_print("exclude " + string.join(patterns))
for pattern in patterns:
if not self.exclude_pattern(pattern, anchor=1):
- self.warn(
- "no previously-included files found matching '%s'"%
- pattern)
+ log.warn(("warning: no previously-included files "
+ "found matching '%s'"), pattern)
elif action == 'global-include':
self.debug_print("global-include " + string.join(patterns))
for pattern in patterns:
if not self.include_pattern(pattern, anchor=0):
- self.warn(("no files found matching '%s' " +
- "anywhere in distribution") %
- pattern)
+ log.warn(("warning: no files found matching '%s' " +
+ "anywhere in distribution"), pattern)
elif action == 'global-exclude':
self.debug_print("global-exclude " + string.join(patterns))
for pattern in patterns:
if not self.exclude_pattern(pattern, anchor=0):
- self.warn(("no previously-included files matching '%s' " +
- "found anywhere in distribution") %
- pattern)
+ log.warn(("warning: no previously-included files matching "
+ "'%s' found anywhere in distribution"),
+ pattern)
elif action == 'recursive-include':
self.debug_print("recursive-include %s %s" %
(dir, string.join(patterns)))
for pattern in patterns:
if not self.include_pattern(pattern, prefix=dir):
- self.warn(("no files found matching '%s' " +
- "under directory '%s'") %
- (pattern, dir))
+ log.warn(("warngin: no files found matching '%s' " +
+ "under directory '%s'"),
+ pattern, dir)
elif action == 'recursive-exclude':
self.debug_print("recursive-exclude %s %s" %
(dir, string.join(patterns)))
for pattern in patterns:
if not self.exclude_pattern(pattern, prefix=dir):
- self.warn(("no previously-included files matching '%s' " +
- "found under directory '%s'") %
- (pattern, dir))
+ log.warn(("warning: no previously-included files matching "
+ "'%s' found under directory '%s'"),
+ pattern, dir)
elif action == 'graft':
self.debug_print("graft " + dir_pattern)
if not self.include_pattern(None, prefix=dir_pattern):
- self.warn("no directories found matching '%s'" % dir_pattern)
+ log.warn("warning: no directories found matching '%s'",
+ dir_pattern)
elif action == 'prune':
self.debug_print("prune " + dir_pattern)
if not self.exclude_pattern(None, prefix=dir_pattern):
- self.warn(("no previously-included directories found " +
- "matching '%s'") %
- dir_pattern)
+ log.warn(("no previously-included directories found " +
+ "matching '%s'"), dir_pattern)
else:
raise DistutilsInternalError, \
"this cannot happen: invalid action '%s'" % action