Skip to content

Commit

Permalink
Fix package installation issues (#180)
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Strilanc authored Dec 15, 2021
1 parent 6a976f3 commit af59b92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion glue/python/src/stim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
compatible instructions. Importing a different one can result in runtime segfaults that crash the python interpreter.
"""

import stim._stim_march_avx2 as _tmp
import stim._stim_march_polyfill as _tmp

_tmp = _tmp._UNSTABLE_detect_march()
if _tmp == 'avx2':
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
stim_polyfill = Extension(
'stim._stim_march_polyfill',
sources=RELEVANT_SOURCE_FILES,
headers=HEADER_FILES,
include_dirs=[pybind11.get_include(), "src"],
language='c++',
data_files=['pyproject.toml'] + HEADER_FILES,
extra_compile_args=[
*common_compile_args,
# I would specify -mno-sse2 but that causes build failures in non-stim code...?
Expand All @@ -48,9 +48,9 @@
stim_sse2 = Extension(
'stim._stim_march_sse2',
sources=RELEVANT_SOURCE_FILES,
headers=HEADER_FILES,
include_dirs=[pybind11.get_include(), "src"],
language='c++',
data_files=['pyproject.toml'] + HEADER_FILES,
extra_compile_args=[
*common_compile_args,
'-msse2',
Expand All @@ -61,9 +61,9 @@
stim_avx2 = Extension(
'stim._stim_march_avx2',
sources=RELEVANT_SOURCE_FILES,
headers=HEADER_FILES,
include_dirs=[pybind11.get_include(), "src"],
language='c++',
data_files=['pyproject.toml'] + HEADER_FILES,
extra_compile_args=[
*common_compile_args,
'-msse2',
Expand All @@ -87,7 +87,7 @@
long_description_content_type='text/markdown',
ext_modules=[stim_polyfill, stim_sse2, stim_avx2],
python_requires='>=3.6.0',
data_files=[('', ['glue/python/README.md'])],
data_files=[('', ['glue/python/README.md', 'pyproject.toml'])],
packages=['stim'],
package_dir={'stim': 'glue/python/src/stim'},
install_requires=['numpy'],
Expand Down

0 comments on commit af59b92

Please sign in to comment.