Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Larralde
pyhmmer
Commits
011305c6
Commit
011305c6
authored
Jun 21, 2022
by
Martin Larralde
Browse files
Remove `arm64` compilation flags from OSX in `setup.py`
parent
cbc5d6bb
Pipeline
#34649
passed with stage
in 4 minutes and 14 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.github/workflows/test.yml
View file @
011305c6
...
...
@@ -137,13 +137,13 @@ jobs:
with
:
python-version
:
${{ matrix.python-version }}
-
name
:
Show Python build environment
run
:
python -m sysconfig
run
:
arch -x86_64
python -m sysconfig
-
name
:
Update pip
run
:
python -m pip install -U pip wheel setuptools
-
name
:
Install Python requirements
run
:
python -m pip install -r .github/workflows/requirements.txt
-
name
:
Build C extension
run
:
python setup.py build_ext --inplace --debug
run
:
arch -x86_64
python setup.py build_ext --inplace --debug
-
name
:
Install test requirements
run
:
python -m pip install -r pyhmmer/tests/requirements.txt
if
:
matrix.python-impl == 'CPython'
...
...
setup.py
View file @
011305c6
...
...
@@ -11,6 +11,7 @@ import platform
import
re
import
sys
import
subprocess
from
pprint
import
pprint
from
unittest
import
mock
import
setuptools
...
...
@@ -36,6 +37,17 @@ def _split_multiline(value):
def
_eprint
(
*
args
,
**
kwargs
):
print
(
*
args
,
**
kwargs
,
file
=
sys
.
stderr
)
def
_patch_osx_compiler
(
compiler
):
# On newer OSX, Python has been compiled as a universal binary, so
# it will attempt to pass universal binary flags when building the
# extension. This will not work because the code makes use of SSE2.
for
tool
in
(
"compiler"
,
"compiler_so"
,
"linker_so"
):
flags
=
getattr
(
compiler
,
tool
)
i
=
next
((
i
for
i
in
range
(
1
,
len
(
flags
))
if
flags
[
i
-
1
]
==
"-arch"
and
flags
[
i
]
==
"arm64"
),
None
)
if
i
is
not
None
:
flags
.
pop
(
i
)
flags
.
pop
(
i
-
1
)
# --- `setup.py` commands ----------------------------------------------------
class
sdist
(
_sdist
):
...
...
@@ -143,6 +155,10 @@ class build_ext(_build_ext):
else
:
ext
.
define_macros
.
append
((
"CYTHON_WITHOUT_ASSERTIONS"
,
1
))
# remove universal binary CFLAGS from the compiler if any
if
platform
.
system
()
==
"Darwin"
:
_patch_osx_compiler
(
self
.
compiler
)
# update link and include directories
ext
.
include_dirs
.
append
(
self
.
_clib_cmd
.
build_clib
)
ext
.
library_dirs
.
append
(
self
.
_clib_cmd
.
build_clib
)
...
...
@@ -318,6 +334,10 @@ class configure(_build_clib):
# ensure the output directory exists, otherwise create it
self
.
mkpath
(
self
.
build_clib
)
# remove universal binary CFLAGS from the compiler if any
if
platform
.
system
()
==
"Darwin"
:
_patch_osx_compiler
(
self
.
compiler
)
# run the `configure_library` method sequentially on each library,
# unless the header already exists and the configuration has not
# been edited
...
...
@@ -471,6 +491,10 @@ class build_clib(_build_clib):
_build_clib
.
run
(
self
)
def
build_libraries
(
self
,
libraries
):
# remove universal binary CFLAGS from the compiler if any
if
platform
.
system
()
==
"Darwin"
:
_patch_osx_compiler
(
self
.
compiler
)
# build extensions sequentially
self
.
mkpath
(
self
.
build_clib
)
for
library
in
libraries
:
self
.
make_file
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment