diff options
author | Tyler Reddy <tyler.je.reddy@gmail.com> | 2018-09-15 12:50:02 -0700 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-09-15 12:50:02 -0700 |
commit | 88c01b8ab4260b938f23f88f8a5f385fd361bc33 (patch) | |
tree | 575f1355bace2d1e90aa86d3a9a0037f2123f5f3 /numpy/distutils/fcompiler/ibm.py | |
parent | 58ce07597e939070065b4050d81b29660845b08a (diff) | |
download | numpy-88c01b8ab4260b938f23f88f8a5f385fd361bc33.tar.gz |
MAINT: remove exec_command usage in ibm.py (#11901)
Replaced the usage of exec_command() in distutils ibm module with subprocess.check_output
Diffstat (limited to 'numpy/distutils/fcompiler/ibm.py')
-rw-r--r-- | numpy/distutils/fcompiler/ibm.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/numpy/distutils/fcompiler/ibm.py b/numpy/distutils/fcompiler/ibm.py index d0c2202d4..c4cb2fca7 100644 --- a/numpy/distutils/fcompiler/ibm.py +++ b/numpy/distutils/fcompiler/ibm.py @@ -3,9 +3,10 @@ from __future__ import division, absolute_import, print_function import os import re import sys +import subprocess from numpy.distutils.fcompiler import FCompiler -from numpy.distutils.exec_command import exec_command, find_executable +from numpy.distutils.exec_command import find_executable from numpy.distutils.misc_util import make_temp_file from distutils import log @@ -35,9 +36,13 @@ class IBMFCompiler(FCompiler): lslpp = find_executable('lslpp') xlf = find_executable('xlf') if os.path.exists(xlf) and os.path.exists(lslpp): - s, o = exec_command(lslpp + ' -Lc xlfcmp') - m = re.search(r'xlfcmp:(?P<version>\d+([.]\d+)+)', o) - if m: version = m.group('version') + try: + o = subprocess.check_output([lslpp, '-Lc', 'xlfcmp']) + except (OSError, subprocess.CalledProcessError): + pass + else: + m = re.search(r'xlfcmp:(?P<version>\d+([.]\d+)+)', o) + if m: version = m.group('version') xlf_dir = '/etc/opt/ibmcmp/xlf' if version is None and os.path.isdir(xlf_dir): |