diff --git a/gyp/gyp_main.py b/gyp/gyp_main.py index 8dfc552e81..aece53c8eb 100755 --- a/gyp/gyp_main.py +++ b/gyp/gyp_main.py @@ -8,13 +8,17 @@ import sys import subprocess +PY3 = bytes != str + # Below IsCygwin() function copied from pylib/gyp/common.py def IsCygwin(): try: out = subprocess.Popen("uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - stdout,stderr = out.communicate() + stdout, stderr = out.communicate() + if PY3: + stdout = stdout.decode("utf-8") return "CYGWIN" in str(stdout) except Exception: return False @@ -27,7 +31,9 @@ def UnixifyPath(path): out = subprocess.Popen(["cygpath", "-u", path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - stdout,stderr = out.communicate() + stdout, stderr = out.communicate() + if PY3: + stdout = stdout.decode("utf-8") return str(stdout) except Exception: return path diff --git a/gyp/pylib/gyp/common.py b/gyp/pylib/gyp/common.py index 8296d11fc3..071ad7e242 100644 --- a/gyp/pylib/gyp/common.py +++ b/gyp/pylib/gyp/common.py @@ -11,6 +11,8 @@ import sys import subprocess +PY3 = bytes != str + # A minimal memoizing decorator. It'll blow up if the args aren't immutable, # among other "problems". @@ -623,7 +625,9 @@ def IsCygwin(): out = subprocess.Popen("uname", stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - stdout,stderr = out.communicate() + stdout, stderr = out.communicate() + if PY3: + stdout = stdout.decode("utf-8") return "CYGWIN" in str(stdout) except Exception: return False