mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
Tweak libuv.py a bit.
This commit is contained in:
@ -15,13 +15,13 @@ LIB_UV_VERSION = "v1.6.1"
|
||||
LIB_UV_DIR = "deps/libuv"
|
||||
|
||||
def python2_binary():
|
||||
"""Tries to find a python 2 executable"""
|
||||
"""Tries to find a python 2 executable."""
|
||||
|
||||
# check major version - .major was added in 2.7
|
||||
if sys.version_info[0] == 2:
|
||||
return sys.executable or "python"
|
||||
else:
|
||||
return "python2"
|
||||
# Using [0] instead of .major here to support Python 2.6.
|
||||
if sys.version_info[0] == 2:
|
||||
return sys.executable or "python"
|
||||
else:
|
||||
return "python2"
|
||||
|
||||
def ensure_dir(dir):
|
||||
"""Creates dir if not already there."""
|
||||
@ -138,14 +138,16 @@ def build_libuv(arch, out):
|
||||
|
||||
def run(args, cwd=None):
|
||||
"""Spawn a process to invoke [args] and mute its output."""
|
||||
|
||||
# check_output() was added in Python 2.7
|
||||
supports_check_output = not (sys.version_info[0] == 2 and sys.version_info[1] < 7)
|
||||
|
||||
try:
|
||||
if supports_check_output:
|
||||
# check_output() was added in Python 2.7.
|
||||
has_check_output = (sys.version_info[0] > 2 or
|
||||
(sys.version_info[0] == 2 and sys.version_info[1] >= 7))
|
||||
|
||||
if has_check_output:
|
||||
subprocess.check_output(args, cwd=cwd, stderr=subprocess.STDOUT)
|
||||
else:
|
||||
proc = subprocess.Popen(args, stdout=subprocess.PIPE)
|
||||
proc = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE)
|
||||
proc.communicate()[0].split()
|
||||
except subprocess.CalledProcessError as error:
|
||||
print(error.output)
|
||||
|
||||
Reference in New Issue
Block a user