mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-21 12:35:47 -04:00

When running the test suite on macOS with Python 3 we noticed a difference in behavior between Python 2 and Python 3 for seven.get_command_output. The output contained a newline with Python 3, but not for Python 2. This resulted in an invalid SDK path passed to the compiler. Differential revision: https://reviews.llvm.org/D57275 llvm-svn: 352397
26 lines
680 B
Python
26 lines
680 B
Python
import six
|
|
|
|
if six.PY2:
|
|
import commands
|
|
get_command_output = commands.getoutput
|
|
get_command_status_output = commands.getstatusoutput
|
|
|
|
cmp_ = cmp
|
|
else:
|
|
def get_command_status_output(command):
|
|
try:
|
|
import subprocess
|
|
return (
|
|
0,
|
|
subprocess.check_output(
|
|
command,
|
|
shell=True,
|
|
universal_newlines=True).rstrip())
|
|
except subprocess.CalledProcessError as e:
|
|
return (e.returncode, e.output)
|
|
|
|
def get_command_output(command):
|
|
return get_command_status_output(command)[1]
|
|
|
|
cmp_ = lambda x, y: (x > y) - (x < y)
|