summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2019-09-24 11:47:54 -0500
committerTodd Gamblin <tgamblin@llnl.gov>2019-09-24 09:47:54 -0700
commit065cbe89fed448fcc64593f679867a7a7ad3cbd1 (patch)
tree3697f77091c659d1a5c3612b0fba278cb7af6f39 /lib
parent6cd5edacca8e4cacbcaf104b3c241097fc83568f (diff)
downloadspack-065cbe89fed448fcc64593f679867a7a7ad3cbd1.tar.gz
spack-065cbe89fed448fcc64593f679867a7a7ad3cbd1.tar.bz2
spack-065cbe89fed448fcc64593f679867a7a7ad3cbd1.tar.xz
spack-065cbe89fed448fcc64593f679867a7a7ad3cbd1.zip
Fix "specific target" detection in Python 3 (#12906)
The output of subprocess.check_output is a byte string in Python 3. This causes dictionary lookup to fail later on. A try-except around this function prevented this error from being noticed. Removed this so that more errors can propagate out.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/llnl/util/cpu/detect.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/spack/llnl/util/cpu/detect.py b/lib/spack/llnl/util/cpu/detect.py
index 40a427a5da..7744d5acd2 100644
--- a/lib/spack/llnl/util/cpu/detect.py
+++ b/lib/spack/llnl/util/cpu/detect.py
@@ -7,7 +7,7 @@ import functools
import platform
import re
import subprocess
-import sys
+import warnings
import six
@@ -76,11 +76,8 @@ def proc_cpuinfo():
def check_output(args):
- if sys.version_info[:2] == (2, 6):
- return subprocess.run(
- args, check=True, stdout=subprocess.PIPE).stdout # nopyqver
- else:
- return subprocess.check_output(args) # nopyqver
+ output = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()[0]
+ return six.text_type(output.decode('utf-8'))
@info_dict(operating_system='Darwin')
@@ -126,8 +123,8 @@ def raw_info_dictionary():
for factory in info_factory[platform.system()]:
try:
info = factory()
- except Exception:
- pass
+ except Exception as e:
+ warnings.warn(str(e))
if info:
break