Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macOS arm64 support for cibuildwheel #7606

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ build_and_store_wheels: &BUILD_AND_STORE_WHEELS
delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}

install_cibuildwheel_script:
- $PYTHON -m pip install cibuildwheel==2.16.5
- $PYTHON -m pip install cibuildwheel==2.19.1

run_cibuildwheel_script:
- cibuildwheel
Expand Down Expand Up @@ -71,12 +71,12 @@ test_macos_arm64_task:
PATH: /opt/homebrew/bin:$PATH
PYTHON: python3.9
OPENSSL_OPTS: >
openssl-lib=/opt/homebrew/opt/openssl@3.0/lib
openssl-include=/opt/homebrew/opt/openssl@3.0/include
openssl-lib=/opt/homebrew/opt/openssl@3/lib
openssl-include=/opt/homebrew/opt/openssl@3/include

install_pre_requirements_script:
- brew install [email protected]
- brew install boost-build boost openssl@3.0
- brew install boost-build boost openssl@3
- echo "using darwin ;" >>~/user-config.jam

debug_script:
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: cibuildwheel
# sample.

# The full list of cibuildwheel's build targets can be found here:
# https://github.com/pypa/cibuildwheel/blob/v2.16.5/cibuildwheel/resources/build-platforms.toml
# https://github.com/pypa/cibuildwheel/blob/v2.19.1/cibuildwheel/resources/build-platforms.toml

# Notes on build targets we (don't) support:
# - pypy: libtorrent doesn't build with pypy as of writing
Expand Down Expand Up @@ -45,10 +45,11 @@ jobs:
MATRIX_PULL_REQUEST: |
{
"include": [
{"os": "ubuntu-latest", "CIBW_BUILD": "cp37-manylinux_*", "CIBW_ARCHS": "x86_64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp37-musllinux_*", "CIBW_ARCHS": "x86_64"},
{"os": "macos-12", "CIBW_BUILD": "cp37-*", "CIBW_ARCHS": "x86_64"},
{"os": "windows-2022", "CIBW_BUILD": "cp37-*", "CIBW_ARCHS": "AMD64"}
{"os": "ubuntu-latest", "CIBW_BUILD": "cp39-manylinux_*", "CIBW_ARCHS": "x86_64"},
{"os": "ubuntu-latest", "CIBW_BUILD": "cp39-musllinux_*", "CIBW_ARCHS": "x86_64"},
{"os": "macos-13", "CIBW_BUILD": "cp39-*", "CIBW_ARCHS": "x86_64"},
{"os": "macos-14", "CIBW_BUILD": "cp39-*", "CIBW_ARCHS": "arm64"},
{"os": "windows-2022", "CIBW_BUILD": "cp39-*", "CIBW_ARCHS": "AMD64"}
]
}
MATRIX_WORKFLOW_DISPATCH: |
Expand Down Expand Up @@ -104,7 +105,7 @@ jobs:
- uses: docker/setup-qemu-action@v3
if: steps.cache-wheel.outputs.cache-hit != 'true' && runner.os == 'Linux'

- uses: pypa/cibuildwheel@v2.16.5
- uses: pypa/cibuildwheel@v2.19.1
if: steps.cache-wheel.outputs.cache-hit != 'true'

- uses: actions/upload-artifact@v3
Expand All @@ -126,8 +127,8 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: wheelhouse
skip_existing: true
packages-dir: wheelhouse
skip-existing: true

upload_pypi_test:
needs: build_wheels
Expand All @@ -143,6 +144,6 @@ jobs:
- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
packages_dir: wheelhouse
skip_existing: true
packages-dir: wheelhouse
skip-existing: true
repository_url: https://test.pypi.org/legacy/
8 changes: 4 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

- name: install boost
run: |
brew install boost-build boost openssl@1.1
brew install boost-build boost openssl@3
echo "using darwin ;" >>~/user-config.jam

- name: build and run tests
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:

- name: install boost
run: |
brew install boost-build boost openssl@1.1
brew install boost-build boost openssl@3
echo "using darwin ;" >>~/user-config.jam

- name: build and run simulations
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:

- name: install boost
run: |
brew install boost-build boost openssl@1.1
brew install boost-build boost openssl@3
echo "using darwin ;" >>~/user-config.jam

- name: build library
Expand All @@ -124,7 +124,7 @@ jobs:

- name: install boost
run: |
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.78.0 https://github.com/boostorg/boost.git
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.82.0 https://github.com/boostorg/boost.git
cd boost
./bootstrap.sh

Expand Down
14 changes: 2 additions & 12 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: dependencies (MacOS)
if: runner.os == 'macOS'
run: |
brew install boost-build boost boost-python3 [email protected] openssl@1.1 python-setuptools
brew install boost-build boost boost-python3 [email protected] openssl@3 python-setuptools
export PATH=$(brew --prefix)/opt/[email protected]/bin:$PATH

- name: update package lists (linux)
Expand All @@ -57,7 +57,7 @@ jobs:
if: runner.os == 'Windows'
shell: cmd
run: |
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.78.0 https://github.com/boostorg/boost.git
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.82.0 https://github.com/boostorg/boost.git
cd boost
bootstrap.bat

Expand All @@ -68,16 +68,6 @@ jobs:
cd boost
.\b2 headers

- name: install openssl (windows)
if: runner.os == 'Windows'
uses: nick-fields/retry@v3
with:
shell: cmd
timeout_minutes: 5
retry_wait_seconds: 4
max_attempts: 3
command: choco install openssl --limitoutput --no-progress

- name: build/install (windows)
if: runner.os == 'Windows'
shell: cmd
Expand Down
36 changes: 6 additions & 30 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,9 @@ jobs:
with:
submodules: true

- name: install openssl (64 bit)
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
retry_wait_seconds: 4
max_attempts: 3
command: choco install openssl --limitoutput --no-progress

- name: install boost
run: |
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.78.0 https://github.com/boostorg/boost.git
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.82.0 https://github.com/boostorg/boost.git
cd boost
bootstrap.bat

Expand Down Expand Up @@ -78,7 +70,7 @@ jobs:

simulations:
name: Simulations
runs-on: windows-2019
runs-on: windows-latest

steps:
- name: checkout
Expand All @@ -88,7 +80,7 @@ jobs:

- name: install boost
run: |
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.78.0 https://github.com/boostorg/boost.git
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.82.0 https://github.com/boostorg/boost.git
cd boost
bootstrap.bat

Expand Down Expand Up @@ -126,7 +118,7 @@ jobs:

build:
name: Build
runs-on: windows-2019
runs-on: windows-latest
continue-on-error: true

strategy:
Expand All @@ -144,18 +136,10 @@ jobs:

- name: install boost
run: |
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.78.0 https://github.com/boostorg/boost.git
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.82.0 https://github.com/boostorg/boost.git
cd boost
bootstrap.bat

- name: install openssl (64 bit)
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
retry_wait_seconds: 4
max_attempts: 3
command: choco install openssl --limitoutput --no-progress

- name: boost headers
run: |
cd boost
Expand Down Expand Up @@ -199,17 +183,9 @@ jobs:
with:
submodules: true

- name: install openssl (64 bit)
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
retry_wait_seconds: 4
max_attempts: 3
command: choco install openssl --limitoutput --no-progress

- name: install boost
run: |
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.78.0 https://github.com/boostorg/boost.git
git clone --depth=1 --recurse-submodules -j10 --branch=boost-1.82.0 https://github.com/boostorg/boost.git
cd boost
bootstrap.bat

Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
#- id: trailing-whitespace
#- id: end-of-file-fixer
Expand Down Expand Up @@ -72,7 +72,7 @@ repos:
tools/update_copyright.py
)$
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.1
hooks:
- id: autoflake
args: [--in-place, --remove-unused-variables, --remove-all-unused-imports, --remove-duplicate-keys]
Expand All @@ -86,7 +86,7 @@ repos:
tools/libtorrent_lldb.py
)
- repo: https://github.com/psf/black
rev: 24.2.0
rev: 24.4.2
hooks:
- id: black
# Avoiding PR bloat
Expand Down Expand Up @@ -132,7 +132,7 @@ repos:
name: black (pyi)
types: [pyi]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.10.0
hooks:
- id: mypy
# Avoiding PR bloat
Expand Down
13 changes: 8 additions & 5 deletions bindings/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ def b2_escape(value: str) -> str:


def write_b2_python_config(
include_dirs: Sequence[str], library_dirs: Sequence[str], config: IO[str]
include_dirs: Sequence[str],
library_dirs: Sequence[str],
ext_suffix: str,
config: IO[str],
) -> None:
write = config.write
# b2 keys python environments by X.Y version, breaking ties by matching
Expand Down Expand Up @@ -150,9 +153,6 @@ def write_b2_python_config(
# other words we apply debian's override everywhere, and hope no other
# overrides ever disagree with us.

ext_suffix = sysconfig.get_config_var("EXT_SUFFIX")
ext_suffix = str(ext_suffix or "")

# python.jam appends the platform-specific final suffix on its own. I can't
# find a consistent value from sysconfig for this.
for plat_suffix in (".pyd", ".dll", ".so", ".sl"):
Expand Down Expand Up @@ -428,7 +428,10 @@ def _configure_b2_with_distutils(self) -> Iterator[None]:
if self._maybe_add_arg(f"python={sysconfig.get_python_version()}"):
config_writers.append(
functools.partial(
write_b2_python_config, self.include_dirs, self.library_dirs
write_b2_python_config,
self.include_dirs,
self.library_dirs,
os.path.basename(self.get_ext_fullpath("")),
)
)

Expand Down
17 changes: 7 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
requires-python = ">=3.7"
requires-python = ">=3.9"

[tool.cibuildwheel]
skip = "{pp*,}"
Expand All @@ -17,8 +17,7 @@ test-command = [
[tool.cibuildwheel.macos.environment]
BOOST_BUILD_PATH = "/tmp/boost/tools/build"
BOOST_ROOT = "/tmp/boost"
BOOST_VERSION = "1.81.0"
MACOSX_DEPLOYMENT_TARGET = "10.9" # required for full C++11 support
BOOST_VERSION = "1.82.0"
PATH = "/tmp/boost:$PATH"

[[tool.cibuildwheel.overrides]]
Expand All @@ -38,7 +37,7 @@ test-command = [
[tool.cibuildwheel.overrides.environment] # sub-table of previous block!
BOOST_BUILD_PATH = "/tmp/boost/tools/build"
BOOST_ROOT = "/tmp/boost"
BOOST_VERSION = "1.81.0"
BOOST_VERSION = "1.82.0"
PATH = "/usr/local/ccache/bin:/tmp/boost:$PATH"

[[tool.cibuildwheel.overrides]]
Expand All @@ -57,20 +56,18 @@ test-command = [
[tool.cibuildwheel.overrides.environment] # sub-table of previous block!
BOOST_BUILD_PATH = "/tmp/boost/tools/build"
BOOST_ROOT = "/tmp/boost"
BOOST_VERSION = "1.81.0"
BOOST_VERSION = "1.82.0"
PATH = "/usr/lib/ccache/bin:/tmp/boost:$PATH"

[[tool.cibuildwheel.overrides]]
before-all = [
"bash -c './tools/cibuildwheel/setup_boost.sh $BOOST_VERSION $BOOST_ROOT'",
"bash -c 'choco install --no-progress --x86 openssl'" # choco only allows EITHER 32 OR 64-bit version of a package
"bash -c './tools/cibuildwheel/setup_boost.sh $BOOST_VERSION $BOOST_ROOT'"
]
select = "*-win32"

[[tool.cibuildwheel.overrides]]
before-all = [
"bash -c './tools/cibuildwheel/setup_boost.sh $BOOST_VERSION $BOOST_ROOT'",
"bash -c 'choco install --no-progress openssl'" # choco only allows EITHER 32 OR 64-bit version of a package
"bash -c './tools/cibuildwheel/setup_boost.sh $BOOST_VERSION $BOOST_ROOT'"
]
select = "*-win_amd64"

Expand All @@ -80,7 +77,7 @@ test-command = '''bash -c "cd '{project}/bindings/python' && python test.py"'''
[tool.cibuildwheel.windows.environment]
BOOST_BUILD_PATH = 'c:/boost/tools/build'
BOOST_ROOT = 'c:/boost'
BOOST_VERSION = "1.81.0"
BOOST_VERSION = "1.82.0"
PATH = 'c:/boost;$PATH'

[tool.isort]
Expand Down
2 changes: 1 addition & 1 deletion simulation/libsimulator
Submodule libsimulator updated 1 files
+9 −4 Jamfile