mirror of https://gitlab.com/ita1024/waf.git
Simplify the unicode type test for python 3
This commit is contained in:
parent
c6f98f80db
commit
1205f92a7f
|
@ -6,7 +6,7 @@
|
|||
logging, colors, terminal width and pretty-print
|
||||
"""
|
||||
|
||||
import os, re, traceback, sys, types
|
||||
import os, re, traceback, sys
|
||||
from waflib import Utils, ansiterm
|
||||
|
||||
if not os.environ.get('NOSYNC', False):
|
||||
|
@ -43,6 +43,11 @@ colors_lst = {
|
|||
|
||||
indicator = '\r\x1b[K%s%s%s'
|
||||
|
||||
try:
|
||||
unicode
|
||||
except NameError:
|
||||
unicode = None
|
||||
|
||||
def enable_colors(use):
|
||||
if use == 1:
|
||||
if not (sys.stderr.isatty() or sys.stdout.isatty()):
|
||||
|
@ -150,7 +155,7 @@ class log_handler(logging.StreamHandler):
|
|||
def emit_override(self, record, **kw):
|
||||
self.terminator = getattr(record, 'terminator', '\n')
|
||||
stream = self.stream
|
||||
if hasattr(types, "UnicodeType"):
|
||||
if unicode:
|
||||
# python2
|
||||
msg = self.formatter.format(record)
|
||||
fs = '%s' + self.terminator
|
||||
|
|
Loading…
Reference in New Issue