From 145235962bd061541dfd7b84b91e3c16e7c602f7 Mon Sep 17 00:00:00 2001 From: xavier2k6 <42386382+xavier2k6@users.noreply.github.com> Date: Tue, 14 Nov 2023 18:44:25 +0000 Subject: [PATCH] Add macOS arm64 support --- .cirrus.yml | 8 ++++---- .github/workflows/cibuildwheel.yml | 21 +++++++++++---------- .github/workflows/macos.yml | 8 ++++---- .github/workflows/python.yml | 4 ++-- .github/workflows/windows.yml | 8 ++++---- .pre-commit-config.yaml | 8 ++++---- bindings/python/setup.py | 13 ++++++++----- pyproject.toml | 16 +++++++--------- simulation/libsimulator | 2 +- 9 files changed, 45 insertions(+), 43 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 3856f66037d..91c4209e06c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -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.0 run_cibuildwheel_script: - cibuildwheel @@ -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 python@3.9 - - brew install boost-build boost openssl@3.0 + - brew install boost-build boost openssl@3 - echo "using darwin ;" >>~/user-config.jam debug_script: diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 1f9390eec3c..5ea20707bf1 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -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.0/cibuildwheel/resources/build-platforms.toml # Notes on build targets we (don't) support: # - pypy: libtorrent doesn't build with pypy as of writing @@ -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: | @@ -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.0 if: steps.cache-wheel.outputs.cache-hit != 'true' - uses: actions/upload-artifact@v3 @@ -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 @@ -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/ diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index d6ad03092f0..a575f38581e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 6072e41e496..3d1621712eb 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -31,7 +31,7 @@ jobs: - name: dependencies (MacOS) if: runner.os == 'macOS' run: | - brew install boost-build boost boost-python3 python@3.12 openssl@1.1 python-setuptools + brew install boost-build boost boost-python3 python@3.12 openssl@3 python-setuptools export PATH=$(brew --prefix)/opt/python@3.12/bin:$PATH - name: update package lists (linux) @@ -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 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 760ef6b3267..694e59cc4b0 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -43,7 +43,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 @@ -88,7 +88,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 @@ -144,7 +144,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 @@ -209,7 +209,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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 88b60f3ecc1..71be5926cc3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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] @@ -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 @@ -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 diff --git a/bindings/python/setup.py b/bindings/python/setup.py index d720c475beb..7880f9fd50e 100644 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -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 @@ -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"): @@ -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("")), ) ) diff --git a/pyproject.toml b/pyproject.toml index a3b0b8c6955..2e671e9ed1b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -requires-python = ">=3.7" +requires-python = ">=3.9" [tool.cibuildwheel] skip = "{pp*,}" @@ -17,7 +17,7 @@ test-command = [ [tool.cibuildwheel.macos.environment] BOOST_BUILD_PATH = "/tmp/boost/tools/build" BOOST_ROOT = "/tmp/boost" -BOOST_VERSION = "1.81.0" +BOOST_VERSION = "1.82.0" MACOSX_DEPLOYMENT_TARGET = "10.9" # required for full C++11 support PATH = "/tmp/boost:$PATH" @@ -38,7 +38,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]] @@ -57,20 +57,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" @@ -80,7 +78,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] diff --git a/simulation/libsimulator b/simulation/libsimulator index c25c485a61d..66ac6cc0b24 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit c25c485a61d22103910e5861946e33d7bcd36a31 +Subproject commit 66ac6cc0b248e4655b8d21004fd24e3b62b5908d