Fix avx_support; only run check_intrinsics for conda build test

This commit is contained in:
Siu Kwan Lam 2014-01-16 17:03:40 -06:00
commit 4ed8f80774
3 changed files with 15 additions and 5 deletions

View file

@ -49,6 +49,17 @@ def detect_unix_like():
return True
return False
@contextlib.contextmanager
def _close_popen(popen):
if sys.version_info[0] >= 3:
with popen:
yield
else:
yield
popen.stdout.close()
def detect_osx_like():
try:
info = subprocess.Popen(['sysctl', '-n', 'machdep.cpu.features'],
@ -56,7 +67,7 @@ def detect_osx_like():
except OSError:
return False
with info:
with _close_popen(info):
features = info.stdout.read().decode('UTF8')
features = features.split()
return 'AVX1.0' in features and 'OSXSAVE' in features and 'XSAVE' in features