mirror of
https://github.com/zebrajr/tensorflow.git
synced 2026-01-15 12:15:41 +00:00
Merge pull request #33025 from wallysslima:master
PiperOrigin-RevId: 287527549 Change-Id: I6bcadc3969f47f900ea142c565dd65def4b99ada
This commit is contained in:
12
configure.py
12
configure.py
@@ -147,14 +147,16 @@ def write_action_env_to_bazelrc(var_name, var):
|
||||
write_to_bazelrc('build --action_env %s="%s"' % (var_name, str(var)))
|
||||
|
||||
|
||||
def run_shell(cmd, allow_non_zero=False):
|
||||
def run_shell(cmd, allow_non_zero=False, stderr=None):
|
||||
if stderr is None:
|
||||
stderr = sys.stdout
|
||||
if allow_non_zero:
|
||||
try:
|
||||
output = subprocess.check_output(cmd)
|
||||
output = subprocess.check_output(cmd, stderr=stderr)
|
||||
except subprocess.CalledProcessError as e:
|
||||
output = e.output
|
||||
else:
|
||||
output = subprocess.check_output(cmd)
|
||||
output = subprocess.check_output(cmd, stderr=stderr)
|
||||
return output.decode('UTF-8').strip()
|
||||
|
||||
|
||||
@@ -169,10 +171,12 @@ def get_python_path(environ_cp, python_bin_path):
|
||||
if environ_cp.get('PYTHONPATH'):
|
||||
python_paths = environ_cp.get('PYTHONPATH').split(':')
|
||||
try:
|
||||
stderr = open(os.devnull, 'wb')
|
||||
library_paths = run_shell([
|
||||
python_bin_path, '-c',
|
||||
'import site; print("\\n".join(site.getsitepackages()))'
|
||||
]).split('\n')
|
||||
],
|
||||
stderr=stderr).split('\n')
|
||||
except subprocess.CalledProcessError:
|
||||
library_paths = [
|
||||
run_shell([
|
||||
|
||||
Reference in New Issue
Block a user