Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
submodules: recursive

- name: Build wheel
uses: pypa/cibuildwheel@v2.23.3
uses: pypa/cibuildwheel@v3.0.0b1
env:
CIBW_ARCHS: "${{ matrix.archs }}"
CIBW_BUILD: "cp312-${{ matrix.build }}*"
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/build-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ jobs:
- platform: "macos"
archs: "arm64"
runs-on: macos-14
- platform: "ios"
archs: "x86_64_iphonesimulator"
runs-on: macos-13
- platform: "ios"
archs: "arm64_iphonesimulator,arm64_iphoneos"
runs-on: macos-14

steps:
- name: Set git to use LF
Expand All @@ -65,6 +71,14 @@ jobs:
uses: docker/[email protected]
if: runner.os == 'Linux' && runner.arch == 'X64'

- name: Install cmake
if: runner.os == 'macOS'
run: |
# workaround https://gitlab.kitware.com/cmake/cmake/-/issues/26570
pipx install -f cmake
which cmake
cmake --version

# see https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64
- name: "Install python 3.8 universal2 on macOS arm64"
if: runner.os == 'macOS' && runner.arch == 'ARM64'
Expand All @@ -75,7 +89,7 @@ jobs:
python-version: 3.8

- name: Build wheels
uses: pypa/cibuildwheel@v2.23.3
uses: pypa/cibuildwheel@v3.0.0b1
env:
CIBW_ARCHS: "${{ matrix.archs }}"
CIBW_BUILD: "${{ matrix.build && '*-' || ''}}${{ matrix.build }}*"
Expand Down Expand Up @@ -132,8 +146,10 @@ jobs:
path: dist
merge-multiple: true
- run: |
set -x
WHEEL_COUNT=$(find dist -name '*.whl' | wc -l)
test ${WHEEL_COUNT} -eq 142
EXPECTED_WHEEL_COUNT=${{ startsWith(github.ref, 'refs/tags/v') && '145' || '179' }}
test ${WHEEL_COUNT} -eq ${EXPECTED_WHEEL_COUNT}
pipx run twine check --strict dist/*

upload_test_pypi:
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ build-backend = "setuptools.build_meta"

[tool.cibuildwheel]
build-verbosity = 1
enable = ["cpython-freethreading", "pypy"]
enable = ["cpython-freethreading", "pypy", "pypy-eol"]
test-requires = "-r requirements-test.txt"
test-command = "pytest {project}/tests"
test-sources = ["conftest.py", "pyproject.toml", "tests"]
test-command = "python -m pytest"
xbuild-tools = ["cmake"]
manylinux-i686-image = "manylinux2014"
manylinux-pypy_i686-image = "manylinux2014"
manylinux-x86_64-image = "manylinux_2_28"
Expand Down
16 changes: 13 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
IS_64BIT = sys.maxsize > 2**32
IS_WINDOWS = sys.platform.startswith("win32")
IS_MACOS = sys.platform.startswith("darwin")
IS_IOS = sys.platform.startswith("ios")

log = logging.getLogger("pybase64-setup")

Expand Down Expand Up @@ -97,7 +98,7 @@ def get_cmake_extra_config(plat_name: str | None, build_type: str) -> tuple[bool
extra_config.append("-A Win32")
if platform == "win-arm64" and machine != "arm64":
extra_config.append("-A ARM64")
elif IS_MACOS:
elif IS_MACOS or IS_IOS:
known_archs = {
"arm64",
"arm64e",
Expand All @@ -108,10 +109,18 @@ def get_cmake_extra_config(plat_name: str | None, build_type: str) -> tuple[bool
"ppc",
"ppc64",
}
if not platform.startswith("macosx-"):
if not platform.startswith(("macosx-", "ios-")):
msg = f"Building {platform} is not supported on macOS"
raise ValueError(msg)
_, _, platform_arch = platform.split("-")
if IS_IOS:
_, min_ver, platform_arch, sdk = platform.split("-")
min_ver = os.getenv("IPHONEOS_DEPLOYMENT_TARGET", min_ver)
extra_config.append("-DCMAKE_SYSTEM_NAME=iOS")
extra_config.append(f"-DCMAKE_OSX_SYSROOT={sdk}")
else:
_, min_ver, platform_arch = platform.split("-")
min_ver = os.getenv("MACOSX_DEPLOYMENT_TARGET", min_ver)
extra_config.append(f"-DCMAKE_OSX_DEPLOYMENT_TARGET={min_ver}")
if platform_arch.startswith(("universal", "fat")):
msg = f"multiple arch `{platform_arch}` is not supported"
raise ValueError(msg)
Expand Down Expand Up @@ -153,6 +162,7 @@ def base64_build(plat_name: str | None) -> Generator[bool, None, None]:
"-DBASE64_BUILD_TESTS:BOOL=OFF",
"-DBASE64_BUILD_CLI:BOOL=OFF",
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
"-DBUILD_SHARED_LIBS:BOOL=OFF",
]
if build_dir.exists():
shutil.rmtree(build_dir)
Expand Down
1 change: 1 addition & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def test_decode(
assert captured.out == b"hello world !/?\n"


@pytest.mark.skipif(sys.platform.startswith("ios"), reason="subprocess not supported")
def test_subprocess() -> None:
import subprocess

Expand Down
Loading