python-blosc/0002-setup.py-unbreak-build-on-architectures-which-don-t-.patch
2019-07-12 19:03:22 +02:00

38 lines
1.7 KiB
Diff

From b4bac67a4ad842c76e4ec10cbee8dac01abcfad0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 12 Jul 2019 18:46:44 +0200
Subject: [PATCH 2/2] setup.py: unbreak build on architectures which don't have
cpu flags
ppc64le and s390x would fail with:
BUILDSTDERR: Traceback (most recent call last):
BUILDSTDERR: File "setup.py", line 241, in <module>
BUILDSTDERR: if 'DISABLE_BLOSC_SSE2' not in os.environ and (cpu_info != None) and ('sse2' in cpu_info['flags']):
BUILDSTDERR: KeyError: 'flags'
BUILDSTDERR: error: Bad exit status from /var/tmp/rpm-tmp.xbprqV (%install)
---
setup.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index 1d8ebe86eb..468b970588 100644
--- a/setup.py
+++ b/setup.py
@@ -238,7 +238,7 @@ if __name__ == '__main__':
# Guess SSE2 or AVX2 capabilities
# SSE2
- if 'DISABLE_BLOSC_SSE2' not in os.environ and (cpu_info != None) and ('sse2' in cpu_info['flags']):
+ if 'DISABLE_BLOSC_SSE2' not in os.environ and cpu_info != None and 'sse2' in cpu_info.get('flags', {}):
print('SSE2 detected')
CFLAGS.append('-DSHUFFLE_SSE2_ENABLED')
sources += [f for f in glob('c-blosc/blosc/*.c') if 'sse2' in f]
@@ -247,7 +247,7 @@ if __name__ == '__main__':
elif os.name == 'nt':
def_macros += [('__SSE2__', 1)]
# AVX2
- if 'DISABLE_BLOSC_AVX2' not in os.environ and (cpu_info != None) and ('avx2' in cpu_info['flags']):
+ if 'DISABLE_BLOSC_AVX2' not in os.environ and cpu_info != None and 'sse2' in cpu_info.get('flags', {}):
if os.name == 'posix':
print("AVX2 detected")
avx2_defs = {