[Numpy-svn] r3956 - trunk/numpy/distutils

numpy-svn@scip... numpy-svn@scip...
Thu Aug 9 05:04:23 CDT 2007


Author: pearu
Date: 2007-08-09 05:01:56 -0500 (Thu, 09 Aug 2007)
New Revision: 3956

Modified:
   trunk/numpy/distutils/exec_command.py
   trunk/numpy/distutils/log.py
Log:
Fix an incorrect usage of log.set_verbosity(INFO) causing log always to be at DEBUG level, INFO is for set_threshold.

Modified: trunk/numpy/distutils/exec_command.py
===================================================================
--- trunk/numpy/distutils/exec_command.py	2007-08-08 22:31:50 UTC (rev 3955)
+++ trunk/numpy/distutils/exec_command.py	2007-08-09 10:01:56 UTC (rev 3956)
@@ -196,7 +196,7 @@
     The following special keyword arguments can be used:
       use_shell - execute `sh -c command`
       use_tee   - pipe the output of command through tee
-      execute_in - before command `cd execute_in` and after `cd -`.
+      execute_in - before run command `cd execute_in` and after `cd -`.
 
     On NT, DOS systems the returned status is correct for external commands.
     Wild cards will not work for non-posix systems or when use_shell=0.

Modified: trunk/numpy/distutils/log.py
===================================================================
--- trunk/numpy/distutils/log.py	2007-08-08 22:31:50 UTC (rev 3955)
+++ trunk/numpy/distutils/log.py	2007-08-09 10:01:56 UTC (rev 3956)
@@ -37,24 +37,28 @@
 
 good = _global_log.good
 
-def set_threshold(level):
+def set_threshold(level, force=False):
     prev_level = _global_log.threshold
-    if prev_level > DEBUG:
+    if prev_level > DEBUG or force:
         # If we're running at DEBUG, don't change the threshold, as there's
         # likely a good reason why we're running at this level.
         _global_log.threshold = level
+        if level <= DEBUG:
+            info('set_threshold: setting thershold to DEBUG level, it can be changed only with force argument')
+    else:
+        info('set_threshold: not changing thershold from DEBUG level %s to %s' % (prev_level,level))
     return prev_level
 
-def set_verbosity(v):
+def set_verbosity(v, force=False):
     prev_level = _global_log.threshold
     if v < 0:
-        set_threshold(ERROR)
+        set_threshold(ERROR, force)
     elif v == 0:
-        set_threshold(WARN)
+        set_threshold(WARN, force)
     elif v == 1:
-        set_threshold(INFO)
+        set_threshold(INFO, force)
     elif v >= 2:
-        set_threshold(DEBUG)
+        set_threshold(DEBUG, force)
     return {FATAL:-2,ERROR:-1,WARN:0,INFO:1,DEBUG:2}.get(prev_level,1)
 
 _global_color_map = {
@@ -65,4 +69,5 @@
     FATAL:red_text
 }
 
-set_verbosity(INFO)
+# don't use INFO,.. flags in set_verbosity, these flags are for set_threshold.
+set_verbosity(0, force=True)



More information about the Numpy-svn mailing list