8000 Merge pull request #11899 from tylerjereddy/rm_exec_command_3 · eric-wieser/numpy@f5838d0 · GitHub
[go: up one dir, main page]

Skip to content

Commit f5838d0

Browse files
authored
Merge pull request numpy#11899 from tylerjereddy/rm_exec_command_3
MAINT: remove exec_command from system_info.py
2 parents 457f379 + b780c0b commit f5838d0

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

doc/release/1.16.0-notes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ New Features
6666
Improvements
6767
============
6868

69+
build shell independence
70+
------------------------
71+
NumPy builds should no longer interact with the host machine
72+
shell directly. ``exec_command`` has been replaced with
73+
``subprocess.check_output`` where appropriate.
74+
75+
6976
`np.polynomial.Polynomial` classes render in LaTeX in Jupyter notebooks
7077
-----------------------------------------------------------------------
7178

numpy/distutils/system_info.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@
147147
from distutils.util import get_platform
148148

149149
from numpy.distutils.exec_command import (
150-
find_executable, exec_command, get_pythonexe)
150+
find_executable, filepath_from_subprocess_output,
151+
get_pythonexe)
151152
from numpy.distutils.misc_util import (is_sequence, is_string,
152153
get_shared_lib_extension)
153154
from numpy.distutils.command.config import config as cmd_config
@@ -2243,8 +2244,12 @@ def get_config_exe(self):
22432244

22442245
def get_config_output(self, config_exe, option):
22452246
cmd = config_exe + ' ' + self.append_config_exe + ' ' + option
2246-
s, o = exec_command(cmd, use_tee=0)
2247-
if not s:
2247+
try:
2248+
o = subprocess.check_output(cmd)
2249+
except (OSError, subprocess.CalledProcessError):
2250+
pass
2251+
else:
2252+
o = filepath_from_subprocess_output(o)
22482253
return o
22492254

22502255
def calc_info(self):

0 commit comments

Comments
 (0)
0