Skip to content

Commit 6ca4408

Browse files
authored
Fix builds on aarch64 (#23)
1 parent 99a7a02 commit 6ca4408

6 files changed

Lines changed: 170 additions & 46 deletions

File tree

.github/workflows/publish.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: publish
33
on:
44
workflow_dispatch:
55
inputs:
6-
repository:
6+
repository:
77
description: 'The repository to upload the package to'
88
required: true
99
default: 'testpypi'
@@ -24,11 +24,13 @@ jobs:
2424
python-version: '3.9'
2525
- name: Set up QEMU
2626
if: runner.os == 'Linux'
27-
uses: docker/setup-qemu-action@v1.0.1
27+
# uses: docker/setup-qemu-action@v1.0.1
28+
uses: docker/setup-qemu-action@v1.2.0
2829
with:
2930
platforms: arm64
3031
- name: Build wheels
31-
uses: joerick/cibuildwheel@v1.9.0
32+
# uses: joerick/cibuildwheel@v1.9.0
33+
uses: pypa/cibuildwheel@v2.9.0
3234
with:
3335
output-dir: wheelhouse
3436
env:
@@ -38,7 +40,7 @@ jobs:
3840
CIBW_ARCHS_MACOS: 'auto arm64'
3941
CIBW_TEST_REQUIRES: pytest
4042
CIBW_TEST_COMMAND: 'pytest -s {project}/tests'
41-
CIBW_TEST_SKIP: '*-macosx_arm64' # Until the day Apple silicon instances are available on GitHub Actions
43+
# CIBW_TEST_SKIP: '*-macosx_arm64' # Until the day Apple silicon instances are available on GitHub Actions
4244
- uses: actions/upload-artifact@v2
4345
with:
4446
path: ./wheelhouse/*.whl

pip-freeze.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,26 @@
1-
attrs==21.4.0
1+
attrs==22.1.0
22
backcall==0.2.0
3-
Cython==0.29.28
3+
Cython==0.29.32
44
decorator==5.1.1
55
importlib-metadata==4.8.3
66
iniconfig==1.1.1
77
ipdb==0.13.9
88
ipython==7.16.3
99
ipython-genutils==0.2.0
1010
jedi==0.17.2
11-
-e git+ssh://git@github.com/escherba/python-metrohash.git@2a85565e5e49b9a36fded0b056d67060ff0e8a7d#egg=metrohash
11+
-e git+https://github.com/escherba/python-metrohash@7df90e93a81300cead306e1b0dcd9ac178abcf44#egg=metrohash
1212
numpy==1.19.5
1313
packaging==21.3
1414
parso==0.7.1
1515
pexpect==4.8.0
1616
pickleshare==0.7.5
17-
pkg_resources==0.0.0
1817
pluggy==1.0.0
19-
prompt-toolkit==3.0.28
18+
prompt-toolkit==3.0.31
2019
ptyprocess==0.7.0
2120
py==1.11.0
2221
py-cpuinfo==8.0.0
23-
Pygments==2.11.2
24-
pyparsing==3.0.7
22+
Pygments==2.13.0
23+
pyparsing==3.0.9
2524
pytest==7.0.1
2625
six==1.16.0
2726
toml==0.10.2

python.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ $(EXTENSION_OBJS): $(BUILD_STAMP)
5757
.PHONY: test
5858
test: build ## run Python unit tests
5959
$(PYENV) pytest
60-
$(PYTHON) -m doctest README.md && echo "$(BOLD)doctests passed$(END)"
6160

6261
.PHONY: nuke
6362
nuke: clean ## clean and remove virtual environment
@@ -76,7 +75,7 @@ clean: ## remove temporary files
7675

7776
.PHONY: install
7877
install: $(BUILD_STAMP) ## install package
79-
$(PIP) install -e --force-reinstall .
78+
$(PIP) install -e .
8079

8180
.PRECIOUS: $(ENV_STAMP)
8281
.PHONY: env

setup.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3-
import struct
43
import os
5-
from os.path import join, dirname
4+
import platform
5+
import struct
66

77
from setuptools import setup
88
from setuptools.dist import Distribution
@@ -62,19 +62,21 @@ def get_system_bits():
6262
]
6363
)
6464

65-
# The "cibuildwheel" tool sets the variable below to
66-
# something like x86_64, aarch64, i686, and so on.
67-
TARGET_ARCH = os.environ.get("AUDITWHEEL_ARCH")
65+
# The "cibuildwheel" tool sets AUDITWHEEL_ARCH variable to architecture strings
66+
# such as 'x86_64', 'aarch64', 'i686', etc. If this variable is not set, we
67+
# assume that the build is not a CI build and target current machine
68+
# architecture.
69+
TARGET_ARCH = os.environ.get("AUDITWHEEL_ARCH", platform.machine())
70+
print("building for target architecture:", TARGET_ARCH)
6871

69-
if HAVE_SSE42 and (TARGET_ARCH in [None, "x86_64"]) and (BITS == 64):
72+
if HAVE_SSE42 and (TARGET_ARCH == "x86_64") and (BITS == 64):
7073
print("enabling SSE4.2 on compile")
7174
if SYSTEM == "nt":
7275
CXXFLAGS.append("/D__SSE4_2__")
7376
else:
7477
CXXFLAGS.append("-msse4.2")
7578

76-
77-
if HAVE_AES and (TARGET_ARCH in [None, "x86_64"]) and (BITS == 64):
79+
if HAVE_AES and (TARGET_ARCH == "x86_64") and (BITS == 64):
7880
print("enabling AES on compile")
7981
if SYSTEM == "nt":
8082
CXXFLAGS.append("/D__AES__")
@@ -104,7 +106,6 @@ def get_system_bits():
104106
CMDCLASS = {}
105107
SRC_EXT = ".cpp"
106108

107-
108109
EXT_MODULES = [
109110
Extension(
110111
"metrohash",
@@ -116,15 +117,15 @@ def get_system_bits():
116117
),
117118
]
118119

119-
VERSION = "0.3.1"
120+
VERSION = "0.3.2"
120121
URL = "https://github.com/escherba/python-metrohash"
121122

122123

123124
def get_long_description(relpath, encoding="utf-8"):
124125
_long_desc = """
125126
126127
"""
127-
fname = join(dirname(__file__), relpath)
128+
fname = os.path.join(os.path.dirname(__file__), relpath)
128129
try:
129130
with open(fname, "rb") as fh:
130131
return fh.read().decode(encoding)

0 commit comments

Comments
 (0)