Commit bd3de69d authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

BF: py2 compat - command may be unicode string

parent 7534f1b5
......@@ -721,6 +721,14 @@ class Progress(object):
return fallback
def isstr(s):
"""Returns True if s is a string, False otherwise, Works on python 2.7
and >=3.3.
"""
try: return isinstance(s, basestring)
except Exception: return isinstance(s, str)
@contextlib.contextmanager
def tempdir(override_dir=None):
"""Returns a context manager which creates, changes into, and returns a
......@@ -933,14 +941,13 @@ class Process(object):
if total is None: label = None
else: label = '%'
if isinstance(cmd, str): cmds = [cmd]
else: cmds = cmd
if isstr(cmd): cmds = [cmd]
else: cmds = cmd
with Progress(label=label,
fmt='{:.0f}',
transform=Progress.percent) as prog:
for cmd in cmds:
proc = Process(cmd, *args, **kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment