File: 0004-Cpuinfo.patch

package info (click to toggle)
numcodecs 0.16.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,004 kB
  • sloc: python: 4,167; makefile: 41
file content (40 lines) | stat: -rw-r--r-- 1,194 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Sat, 21 Nov 2020 19:20:43 +0000
Subject: Cpuinfo

Forwarded: https://github.com/zarr-developers/numcodecs/pull/258
---
 setup.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/setup.py b/setup.py
index af715bf..b30232b 100644
--- a/setup.py
+++ b/setup.py
@@ -5,15 +5,21 @@ from distutils.command.clean import clean
 from distutils.sysconfig import customize_compiler
 from glob import glob
 
-import cpuinfo
 from Cython.Distutils.build_ext import new_build_ext as build_ext
 from setuptools import Extension, setup
 from setuptools.errors import CCompilerError, ExecError, PlatformError
 
-# determine CPU support for SSE2 and AVX2
-cpu_info = cpuinfo.get_cpu_info()
-flags = cpu_info.get('flags', [])
-machine = cpuinfo.platform.machine()
+try:
+    # determine CPU support for SSE2 and AVX2
+    import cpuinfo
+    cpu_info = cpuinfo.get_cpu_info()
+    flags = cpu_info.get('flags', [])
+    machine = cpuinfo.platform.machine()
+except Exception:
+    import platform
+
+    flags = []
+    machine = platform.machine()
 
 # only check for x86 features on x86_64 arch
 have_sse2 = False