mirror of
https://github.com/python/cpython.git
synced 2025-09-15 13:16:12 +00:00
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.
This commit is contained in:
parent
0069d85ba9
commit
bae17a8aa1
1 changed files with 9 additions and 9 deletions
|
@ -28,15 +28,6 @@ from . import patcomp
|
||||||
from . import fixes
|
from . import fixes
|
||||||
from . import pygram
|
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):
|
def main(args=None):
|
||||||
"""Main program.
|
"""Main program.
|
||||||
|
|
||||||
|
@ -73,6 +64,15 @@ def main(args=None):
|
||||||
print >>sys.stderr, "Use --help to show usage."
|
print >>sys.stderr, "Use --help to show usage."
|
||||||
return 2
|
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
|
# Initialize the refactoring tool
|
||||||
rt = RefactoringTool(options)
|
rt = RefactoringTool(options)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue