Skip to content

Commit af59b92

Browse files
authored
Fix package installation issues (#180)
- For sdist, fix specifying `data_files=` on each Extension instead of on the package itself - For sdist, fix headers being given as `data_files=` instead of `headers=` - For wheels, fix using the avx2 instead of the vanilla package to determine CPU capabilities - It was touching avx instructions along the way, causing crashes on M1 macs First part of fixing #179
1 parent 6a976f3 commit af59b92

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

glue/python/src/stim/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
compatible instructions. Importing a different one can result in runtime segfaults that crash the python interpreter.
66
"""
77

8-
import stim._stim_march_avx2 as _tmp
8+
import stim._stim_march_polyfill as _tmp
99

1010
_tmp = _tmp._UNSTABLE_detect_march()
1111
if _tmp == 'avx2':

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
stim_polyfill = Extension(
3636
'stim._stim_march_polyfill',
3737
sources=RELEVANT_SOURCE_FILES,
38+
headers=HEADER_FILES,
3839
include_dirs=[pybind11.get_include(), "src"],
3940
language='c++',
40-
data_files=['pyproject.toml'] + HEADER_FILES,
4141
extra_compile_args=[
4242
*common_compile_args,
4343
# I would specify -mno-sse2 but that causes build failures in non-stim code...?
@@ -48,9 +48,9 @@
4848
stim_sse2 = Extension(
4949
'stim._stim_march_sse2',
5050
sources=RELEVANT_SOURCE_FILES,
51+
headers=HEADER_FILES,
5152
include_dirs=[pybind11.get_include(), "src"],
5253
language='c++',
53-
data_files=['pyproject.toml'] + HEADER_FILES,
5454
extra_compile_args=[
5555
*common_compile_args,
5656
'-msse2',
@@ -61,9 +61,9 @@
6161
stim_avx2 = Extension(
6262
'stim._stim_march_avx2',
6363
sources=RELEVANT_SOURCE_FILES,
64+
headers=HEADER_FILES,
6465
include_dirs=[pybind11.get_include(), "src"],
6566
language='c++',
66-
data_files=['pyproject.toml'] + HEADER_FILES,
6767
extra_compile_args=[
6868
*common_compile_args,
6969
'-msse2',
@@ -87,7 +87,7 @@
8787
long_description_content_type='text/markdown',
8888
ext_modules=[stim_polyfill, stim_sse2, stim_avx2],
8989
python_requires='>=3.6.0',
90-
data_files=[('', ['glue/python/README.md'])],
90+
data_files=[('', ['glue/python/README.md', 'pyproject.toml'])],
9191
packages=['stim'],
9292
package_dir={'stim': 'glue/python/src/stim'},
9393
install_requires=['numpy'],

0 commit comments

Comments
 (0)