Skip to content

Commit 474caef

Browse files
authored
Merge pull request #103 from blink1073/py311-arm64
Build Python 3.11 and MacOS arm64
2 parents 0fe0933 + efc658a commit 474caef

File tree

7 files changed

+67
-34
lines changed

7 files changed

+67
-34
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
# Set update schedule for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
# Check for updates to GitHub Actions every weekday
8+
interval: "weekly"

.github/workflows/build_wheel.yml

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ on:
1313

1414
jobs:
1515
osx:
16-
runs-on: macos-latest
16+
runs-on: macos-11
1717

1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10"]
21+
PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10", "3.11"]
22+
ARCH: ["x86_64", "arm64"]
2223

2324
env:
2425
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION }}
@@ -27,83 +28,91 @@ jobs:
2728

2829
steps:
2930
- name: Checkout
30-
uses: actions/checkout@v2
31+
uses: actions/checkout@v3
3132

3233
- name: Install Python
33-
uses: actions/setup-python@v2
34+
uses: actions/setup-python@v4
3435
with:
3536
python-version: ${{ matrix.PYTHON_VERSION }}
3637

3738
- name: Setup xcode
3839
uses: maxim-lobanov/setup-xcode@v1
3940
with:
40-
xcode-version: '11'
41+
xcode-version: '13.1.0'
4142

4243
- name: Build wheel
4344
run: |
45+
set -eux
46+
pip install delocate
4447
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
45-
python -m pip wheel . --verbose -w wheelhouse
48+
if [ ${{ matrix.ARCH }} == "arm64" ]; then
49+
export _PYTHON_HOST_PLATFORM=macosx-11.0-arm64
50+
export ARCHFLAGS="-arch arm64"
51+
export LIBSODIUM_CONFIG_COMMAND="./configure --host=arm64-apple-darwin"
52+
export OPENSSL_CONFIG_COMMAND="perl Configure darwin64-arm64-cc"
53+
export DCMAKE_OSX_ARCHITECTURES="arm64"
54+
fi
55+
python -m pip wheel . --verbose -w wheelhouse_dirty
56+
delocate-wheel -w wheelhouse --require-archs=${{ matrix.arch }} -v wheelhouse_dirty/xeus_python-*.whl
4657
4758
- name: List wheels
4859
run: ls wheelhouse
4960

50-
- uses: actions/upload-artifact@v2
61+
- uses: actions/upload-artifact@v3
5162
with:
5263
name: wheelhouse
5364
path: wheelhouse/xeus_python-*.whl
5465
if-no-files-found: error
5566

5667
linux:
57-
runs-on: ubuntu-latest
68+
runs-on: ubuntu-20.04
5869

5970
strategy:
6071
fail-fast: false
6172
matrix:
62-
PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10"]
73+
PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10", "3.11"]
6374

6475
container:
65-
image: "quay.io/pypa/manylinux2010_x86_64"
76+
image: "quay.io/pypa/manylinux_2_24_x86_64"
6677

6778
steps:
68-
# We need checkout v1, as checkout v2 does not work for the manylinux2010 image
69-
# See https://github.com/actions/runner/issues/334
7079
- name: Checkout
71-
uses: actions/checkout@v1
80+
uses: actions/checkout@v3
7281

7382
- name: Build wheel
7483
run: |
84+
set -eux
7585
pyver=`echo '${{ matrix.PYTHON_VERSION }}' | tr -d '.'`
7686
pypath=`echo /opt/python/cp${pyver}-cp${pyver}*/bin`
7787
export PATH=$pypath:$PATH
7888
python -m pip wheel --verbose . -w wheelhouse_dirty
79-
auditwheel repair wheelhouse_dirty/xeus_python-*.whl --plat manylinux2010_x86_64 -w wheelhouse
89+
auditwheel repair wheelhouse_dirty/xeus_python-*.whl --plat manylinux_2_24_x86_64 -w wheelhouse
8090
8191
- name: List wheels
8292
run: ls wheelhouse
8393

8494
- name: Get wheel name
8595
run: echo "WHEEL=$(find wheelhouse -type f -iname 'xeus_python-*.whl')" >> $GITHUB_ENV
8696

87-
# We need upload-artifact v1, same issue as for checkout v2
88-
- uses: actions/upload-artifact@v1
97+
- uses: actions/upload-artifact@v3
8998
with:
9099
name: wheelhouse
91100
path: ${{ env.WHEEL }}
92101

93102
windows:
94-
runs-on: windows-2019
103+
runs-on: windows-2022
95104

96105
strategy:
97106
fail-fast: false
98107
matrix:
99-
PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10"]
108+
PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10", "3.11"]
100109

101110
steps:
102111
- name: Checkout
103-
uses: actions/checkout@v2
112+
uses: actions/checkout@v3
104113

105114
- name: Install Python
106-
uses: actions/setup-python@v2
115+
uses: actions/setup-python@v4
107116
with:
108117
python-version: ${{ matrix.PYTHON_VERSION }}
109118

@@ -119,7 +128,7 @@ jobs:
119128
- name: List wheels
120129
run: ls wheelhouse
121130

122-
- uses: actions/upload-artifact@v2
131+
- uses: actions/upload-artifact@v3
123132
with:
124133
name: wheelhouse
125134
path: wheelhouse/xeus_python-*.whl
@@ -133,7 +142,7 @@ jobs:
133142
fail-fast: false
134143
matrix:
135144
os: [ubuntu, macos, windows]
136-
PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10"]
145+
PYTHON_VERSION: ["3.7", "3.8", "3.9", "3.10", "3.11"]
137146
include:
138147
- PYTHON_VERSION: "3.7"
139148
os: ubuntu
@@ -147,18 +156,24 @@ jobs:
147156
- PYTHON_VERSION: "3.10"
148157
os: ubuntu
149158
whl: 'xeus_python-*-cp310*linux*.whl'
159+
- PYTHON_VERSION: "3.11"
160+
os: ubuntu
161+
whl: 'xeus_python-*-cp311*linux*.whl'
150162
- PYTHON_VERSION: "3.7"
151163
os: macos
152-
whl: 'xeus_python-*-cp37*macos*.whl'
164+
whl: 'xeus_python-*-cp37*macos*x86_64.whl'
153165
- PYTHON_VERSION: "3.8"
154166
os: macos
155-
whl: 'xeus_python-*-cp38*macos*.whl'
167+
whl: 'xeus_python-*-cp38*macos*x86_64.whl'
156168
- PYTHON_VERSION: "3.9"
157169
os: macos
158-
whl: 'xeus_python-*-cp39*macos*.whl'
170+
whl: 'xeus_python-*-cp39*macos*x86_64.whl'
159171
- PYTHON_VERSION: "3.10"
160172
os: macos
161-
whl: 'xeus_python-*-cp310*macos*.whl'
173+
whl: 'xeus_python-*-cp310*macos*x86_64.whl'
174+
- PYTHON_VERSION: "3.11"
175+
os: macos
176+
whl: 'xeus_python-*-cp311*macos*x86_64.whl'
162177
- PYTHON_VERSION: "3.7"
163178
os: windows
164179
whl: 'xeus_python-*-cp37*win*.whl'
@@ -171,18 +186,21 @@ jobs:
171186
- PYTHON_VERSION: "3.10"
172187
os: windows
173188
whl: 'xeus_python-*-cp310*win*.whl'
189+
- PYTHON_VERSION: "3.11"
190+
os: windows
191+
whl: 'xeus_python-*-cp311*win*.whl'
174192

175193
steps:
176194
- name: Checkout
177-
uses: actions/checkout@v2
195+
uses: actions/checkout@v3
178196

179-
- uses: actions/download-artifact@v2
197+
- uses: actions/download-artifact@v3
180198
with:
181199
name: wheelhouse
182200
path: ./wheelhouse
183201

184202
- name: Install Python
185-
uses: actions/setup-python@v2
203+
uses: actions/setup-python@v4
186204
with:
187205
python-version: ${{ matrix.PYTHON_VERSION }}
188206

@@ -212,7 +230,7 @@ jobs:
212230

213231
steps:
214232

215-
- uses: actions/download-artifact@v2
233+
- uses: actions/download-artifact@v3
216234
with:
217235
name: wheelhouse
218236
path: ./wheelhouse

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ set(BUILD_SHARED_LIBS OFF CACHE BOOL "disable shared build of xeus" FORCE)
1717

1818
message(STATUS "PYTHON_EXECUTABLE is ${PYTHON_EXECUTABLE}")
1919
message(STATUS "CMAKE_LIBRARY_PATH is ${CMAKE_LIBRARY_PATH}")
20+
message(STATUS "OPENSSL_CONFIG is ${OPENSSL_CONFIG}")
21+
message(STATUS "LIBSODIUM CONFIG is ${LIBSODIUM_CONFIG}")
2022

2123
# Dependencies
2224
# ============

External_OpenSSL.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if (WIN32)
2828
set(OPENSSL_POSTINSTALL_SSL_COMMAND ${CMAKE_COMMAND} -E copy libssl_static.lib ${EP_INSTALL_DIR}/lib/libssl_static.lib)
2929
else()
3030
set(OPENSSL_PATCH_COMMAND git apply --ignore-space-change --ignore-whitespace ${CMAKE_SOURCE_DIR}/commoncrypto.patch)
31-
set(OPENSSL_CONFIG_COMMAND CFLAGS=-fPIC ./config --prefix=${EP_INSTALL_DIR})
31+
set(OPENSSL_CONFIG_COMMAND @OPENSSL_CONFIG@ CFLAGS=-fPIC --prefix=${EP_INSTALL_DIR})
3232
set(OPENSSL_BUILD_COMMAND make -j ${CPU_COUNT})
3333
if(APPLE)
3434
set(OPENSSL_INSTALL_COMMAND make install_sw install_ssldirs)

External_libsodium.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ endif()
1919

2020
if (WIN32)
2121
else ()
22-
set(LIBSODIUM_CONFIG_COMMAND CFLAGS=-fPIC ./configure --prefix=${EP_INSTALL_DIR})
22+
set(LIBSODIUM_CONFIG_COMMAND CFLAGS=-fPIC @LIBSODIUM_CONFIG@ --prefix=${EP_INSTALL_DIR})
2323
set(LIBSODIUM_BUILD_COMMAND make -j ${CPU_COUNT})
2424
set(LIBSODIUM_INSTALL_COMMAND make install)
2525
endif ()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ requires = [
33
"setuptools",
44
"wheel",
55
"scikit-build>=0.11.0,<0.14",
6-
"cmake",
6+
"cmake>=3.4",
77
"ninja"
88
]

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import sys
23

34
try:
@@ -60,6 +61,9 @@ def cmake_process_manifest_hook(cmake_manifest):
6061
return cmake_manifest
6162

6263

64+
openssl_config = os.environ.get('OPENSSL_CONFIG_COMMAND', './config')
65+
libsodium_config = os.environ.get('LIBSODIUM_CONFIG_COMMAND', './configure')
66+
6367
setup(
6468
name="xeus-python",
6569
version=xeus_version,
@@ -73,6 +77,7 @@ def cmake_process_manifest_hook(cmake_manifest):
7377
'xeus-python-shell[ipython]>=0.5,<0.6'
7478
],
7579
setup_requires=setup_requires,
76-
cmake_args=['-DCMAKE_INSTALL_LIBDIR=lib', '-DPYTHON_EXECUTABLE:FILEPATH=' + python_path],
80+
cmake_args=['-DCMAKE_INSTALL_LIBDIR=lib', '-DPYTHON_EXECUTABLE:FILEPATH=' + python_path, f'-DOPENSSL_CONFIG:INTERNAL={openssl_config}',
81+
f'-DLIBSODIUM_CONFIG:INTERNAL="{libsodium_config}"'],
7782
cmake_process_manifest_hook=cmake_process_manifest_hook
7883
)

0 commit comments

Comments
 (0)