diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-09-21 13:41:08 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-09-21 13:41:08 (GMT) |
commit | 99773359843803c54574b6ee6fc1516e7fcde10f (patch) | |
tree | 68960c3b75d0819093d72d6e742273246a678e18 /Lib | |
parent | ccaf380fabaf09362de926a648b131114b33e90b (diff) | |
download | cpython-99773359843803c54574b6ee6fc1516e7fcde10f.zip cpython-99773359843803c54574b6ee6fc1516e7fcde10f.tar.gz cpython-99773359843803c54574b6ee6fc1516e7fcde10f.tar.bz2 |
#6954: Fixed crash when using DISTUTILS_DEBUG flag in Distutils.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/dist.py | 2 | ||||
-rw-r--r-- | Lib/distutils/log.py | 3 | ||||
-rw-r--r-- | Lib/distutils/tests/test_dist.py | 7 |
3 files changed, 11 insertions, 1 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py index afed545..f49afcc 100644 --- a/Lib/distutils/dist.py +++ b/Lib/distutils/dist.py @@ -359,7 +359,7 @@ Common commands: (see '--help-commands' for more) parser = ConfigParser() for filename in filenames: if DEBUG: - self.announce(" reading", filename) + self.announce(" reading %s" % filename) parser.read(filename) for section in parser.sections(): options = parser.options(section) diff --git a/Lib/distutils/log.py b/Lib/distutils/log.py index 6f949d5..7588570 100644 --- a/Lib/distutils/log.py +++ b/Lib/distutils/log.py @@ -17,6 +17,9 @@ class Log: self.threshold = threshold def _log(self, level, msg, args): + if level not in (DEBUG, INFO, WARN, ERROR, FATAL): + raise ValueError('%s wrong log level' % str(level)) + if level >= self.threshold: if args: msg = msg % args diff --git a/Lib/distutils/tests/test_dist.py b/Lib/distutils/tests/test_dist.py index 553f30c..3d4b25f 100644 --- a/Lib/distutils/tests/test_dist.py +++ b/Lib/distutils/tests/test_dist.py @@ -200,6 +200,13 @@ class DistributionTestCase(support.TempdirManager, self.assertEquals(cmds, ['distutils.command', 'one', 'two']) + def test_announce(self): + # make sure the level is known + dist = Distribution() + args = ('ok',) + kwargs = {'level': 'ok2'} + self.assertRaises(ValueError, dist.announce, args, kwargs) + class MetadataTestCase(support.TempdirManager, support.EnvironGuard, unittest.TestCase): |