[Python-checkins] distutils2: More logging tweaks: use real warning method, merge some calls.
tarek.ziade
python-checkins at python.org
Wed Feb 16 22:23:56 CET 2011
tarek.ziade pushed 6a5628860de4 to distutils2:
http://hg.python.org/distutils2/rev/6a5628860de4
changeset: 1016:6a5628860de4
user: ?ric Araujo <merwok at netwok.org>
date: Thu Feb 10 01:48:09 2011 +0100
summary:
More logging tweaks: use real warning method, merge some calls.
files:
distutils2/command/cmd.py
distutils2/command/register.py
distutils2/compiler/bcppcompiler.py
distutils2/compiler/ccompiler.py
distutils2/compiler/msvccompiler.py
distutils2/compiler/unixccompiler.py
distutils2/manifest.py
diff --git a/distutils2/command/cmd.py b/distutils2/command/cmd.py
--- a/distutils2/command/cmd.py
+++ b/distutils2/command/cmd.py
@@ -182,7 +182,7 @@
raise RuntimeError(
"abstract method -- subclass %s must override" % self.__class__)
- # TODO remove this method, just use logging
+ # TODO remove this method, just use logging.info
def announce(self, msg, level=logging.INFO):
"""If the current verbosity level is of greater than or equal to
'level' print 'msg' to stdout.
@@ -364,7 +364,7 @@
# -- External world manipulation -----------------------------------
- # TODO remove this method, just use logging
+ # TODO remove this method, just use logging.warn
def warn(self, msg):
logger.warning("warning: %s: %s\n", self.get_command_name(), msg)
diff --git a/distutils2/command/register.py b/distutils2/command/register.py
--- a/distutils2/command/register.py
+++ b/distutils2/command/register.py
@@ -208,9 +208,8 @@
if code != 200:
logger.info('Server response (%s): %s', code, result)
else:
- logger.info('You will receive an email shortly.')
- logger.info('Follow the instructions in it to '
- 'complete registration.')
+ logger.info('You will receive an email shortly; follow the '
+ 'instructions in it to complete registration.')
elif choice == '3':
data = {':action': 'password_reset'}
data['email'] = ''
diff --git a/distutils2/compiler/bcppcompiler.py b/distutils2/compiler/bcppcompiler.py
--- a/distutils2/compiler/bcppcompiler.py
+++ b/distutils2/compiler/bcppcompiler.py
@@ -191,9 +191,8 @@
self._fix_lib_args (libraries, library_dirs, runtime_library_dirs)
if runtime_library_dirs:
- logger.warning(("I don't know what to do with "
- "'runtime_library_dirs': %s"),
- str(runtime_library_dirs))
+ logger.warning("I don't know what to do with "
+ "'runtime_library_dirs': %r", runtime_library_dirs)
if output_dir is not None:
output_filename = os.path.join (output_dir, output_filename)
diff --git a/distutils2/compiler/ccompiler.py b/distutils2/compiler/ccompiler.py
--- a/distutils2/compiler/ccompiler.py
+++ b/distutils2/compiler/ccompiler.py
@@ -850,6 +850,7 @@
# -- Utility methods -----------------------------------------------
+ # TODO use logging.info
def announce(self, msg, level=None):
logger.debug(msg)
@@ -858,6 +859,7 @@
if DEBUG:
print msg
+ # TODO use logging.warn
def warn(self, msg):
sys.stderr.write("warning: %s\n" % msg)
diff --git a/distutils2/compiler/msvccompiler.py b/distutils2/compiler/msvccompiler.py
--- a/distutils2/compiler/msvccompiler.py
+++ b/distutils2/compiler/msvccompiler.py
@@ -44,11 +44,10 @@
RegError = win32api.error
except ImportError:
- logger.info("Warning: Can't read registry to find the "
- "necessary compiler setting\n"
- "Make sure that Python modules _winreg, "
- "win32api or win32con are installed.")
- pass
+ logger.warning(
+ "Can't read registry to find the necessary compiler setting;\n"
+ "make sure that Python modules _winreg, win32api or win32con "
+ "are installed.")
if _can_read_reg:
HKEYS = (hkey_mod.HKEY_USERS,
diff --git a/distutils2/compiler/unixccompiler.py b/distutils2/compiler/unixccompiler.py
--- a/distutils2/compiler/unixccompiler.py
+++ b/distutils2/compiler/unixccompiler.py
@@ -98,9 +98,9 @@
sysroot = compiler_so[idx+1]
if sysroot and not os.path.isdir(sysroot):
- logger.warning("Compiling with an SDK that doesn't seem to exist: %s",
- sysroot)
- logger.warning("Please check your Xcode installation")
+ logger.warning(
+ "Compiling with an SDK that doesn't seem to exist: %r;\n"
+ "please check your Xcode installation", sysroot)
return compiler_so
diff --git a/distutils2/manifest.py b/distutils2/manifest.py
--- a/distutils2/manifest.py
+++ b/distutils2/manifest.py
@@ -206,44 +206,43 @@
if action == 'include':
for pattern in patterns:
if not self._include_pattern(pattern, anchor=1):
- logging.warning("warning: no files found matching %r",
- pattern)
+ logging.warning("no files found matching %r", pattern)
elif action == 'exclude':
for pattern in patterns:
if not self.exclude_pattern(pattern, anchor=1):
- logging.warning("warning: no previously-included files "
+ logging.warning("no previously-included files "
"found matching %r", pattern)
elif action == 'global-include':
for pattern in patterns:
if not self._include_pattern(pattern, anchor=0):
- logging.warning("warning: no files found matching %r "
+ logging.warning("no files found matching %r "
"anywhere in distribution", pattern)
elif action == 'global-exclude':
for pattern in patterns:
if not self.exclude_pattern(pattern, anchor=0):
- logging.warning("warning: no previously-included files "
+ logging.warning("no previously-included files "
"matching %r found anywhere in "
"distribution", pattern)
elif action == 'recursive-include':
for pattern in patterns:
if not self._include_pattern(pattern, prefix=dir):
- logging.warning("warning: no files found matching %r "
+ logging.warning("no files found matching %r "
"under directory %r", pattern, dir)
elif action == 'recursive-exclude':
for pattern in patterns:
if not self.exclude_pattern(pattern, prefix=dir):
- logging.warning("warning: no previously-included files "
+ logging.warning("no previously-included files "
"matching %r found under directory %r",
pattern, dir)
elif action == 'graft':
if not self._include_pattern(None, prefix=dir_pattern):
- logging.warning("warning: no directories found matching %r",
+ logging.warning("no directories found matching %r",
dir_pattern)
elif action == 'prune':
--
Repository URL: http://hg.python.org/distutils2
More information about the Python-checkins
mailing list