diff options
author | Tyler Reddy <tyler.je.reddy@gmail.com> | 2018-09-10 14:14:19 -0700 |
---|---|---|
committer | Tyler Reddy <tyler.je.reddy@gmail.com> | 2018-09-10 14:14:19 -0700 |
commit | b780c0b9d6bf9592ca90f064d5c9081ca4a81803 (patch) | |
tree | 4463235554aaa4f4346b714a141d5f8e8e9d7726 | |
parent | dc6a5735519aca9aeedf1b8e83fefa1ae43131b3 (diff) | |
download | numpy-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.rst | 7 | ||||
-rw-r--r-- | numpy/distutils/system_info.py | 11 |
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): |