summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-03-29 12:42:54 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-03-29 12:42:54 (GMT)
commitbae17a8aa182a816f628234903b386978d6db40e (patch)
treea85139e42f4ceda38ee9b96b86d0a67ba2335a69 /Lib/lib2to3
parent0069d85ba96669844d89d0b59e056e508d84616b (diff)
downloadcpython-bae17a8aa182a816f628234903b386978d6db40e.zip
cpython-bae17a8aa182a816f628234903b386978d6db40e.tar.gz
cpython-bae17a8aa182a816f628234903b386978d6db40e.tar.bz2
lib2to3 should install a logging handler only when run as a main program,
not when used as a library. This may please the buildbots, which fail when test_lib2to3 is run before test_logging.
Diffstat (limited to 'Lib/lib2to3')
-rwxr-xr-xLib/lib2to3/refactor.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py
index 2edf4db..74a4053 100755
--- a/Lib/lib2to3/refactor.py
+++ b/Lib/lib2to3/refactor.py
@@ -28,15 +28,6 @@ from . import patcomp
from . import fixes
from . import pygram
-if sys.version_info < (2, 4):
- hdlr = logging.StreamHandler()
- fmt = logging.Formatter('%(name)s: %(message)s')
- hdlr.setFormatter(fmt)
- logging.root.addHandler(hdlr)
-else:
- logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO)
-
-
def main(args=None):
"""Main program.
@@ -73,6 +64,15 @@ def main(args=None):
print >>sys.stderr, "Use --help to show usage."
return 2
+ # Set up logging handler
+ if sys.version_info < (2, 4):
+ hdlr = logging.StreamHandler()
+ fmt = logging.Formatter('%(name)s: %(message)s')
+ hdlr.setFormatter(fmt)
+ logging.root.addHandler(hdlr)
+ else:
+ logging.basicConfig(format='%(name)s: %(message)s', level=logging.INFO)
+
# Initialize the refactoring tool
rt = RefactoringTool(options)