summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Reddy <tyler.je.reddy@gmail.com>2018-09-10 14:14:19 -0700
committerTyler Reddy <tyler.je.reddy@gmail.com>2018-09-10 14:14:19 -0700
commitb780c0b9d6bf9592ca90f064d5c9081ca4a81803 (patch)
tree4463235554aaa4f4346b714a141d5f8e8e9d7726
parentdc6a5735519aca9aeedf1b8e83fefa1ae43131b3 (diff)
downloadnumpy-b780c0b9d6bf9592ca90f064d5c9081ca4a81803.tar.gz
MAINT: remove exec_command from system_info.py
* replace exec_command() with its standard library equivalent in distutils system_info module
-rw-r--r--doc/release/1.16.0-notes.rst7
-rw-r--r--numpy/distutils/system_info.py11
2 files changed, 15 insertions, 3 deletions
diff --git a/doc/release/1.16.0-notes.rst b/doc/release/1.16.0-notes.rst
index 4a38af777..0ba4636d9 100644
--- a/doc/release/1.16.0-notes.rst
+++ b/doc/release/1.16.0-notes.rst
@@ -66,6 +66,13 @@ New Features
Improvements
============
+build shell independence
+------------------------
+NumPy builds should no longer interact with the host machine
+shell directly. ``exec_command`` has been replaced with
+``subprocess.check_output`` where appropriate.
+
+
`np.polynomial.Polynomial` classes render in LaTeX in Jupyter notebooks
-----------------------------------------------------------------------
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index a5693bdd5..a901e2906 100644
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -147,7 +147,8 @@ from distutils import log
from distutils.util import get_platform
from numpy.distutils.exec_command import (
- find_executable, exec_command, get_pythonexe)
+ find_executable, filepath_from_subprocess_output,
+ get_pythonexe)
from numpy.distutils.misc_util import (is_sequence, is_string,
get_shared_lib_extension)
from numpy.distutils.command.config import config as cmd_config
@@ -2243,8 +2244,12 @@ class _pkg_config_info(system_info):
def get_config_output(self, config_exe, option):
cmd = config_exe + ' ' + self.append_config_exe + ' ' + option
- s, o = exec_command(cmd, use_tee=0)
- if not s:
+ try:
+ o = subprocess.check_output(cmd)
+ except (OSError, subprocess.CalledProcessError):
+ pass
+ else:
+ o = filepath_from_subprocess_output(o)
return o
def calc_info(self):