From 235606f7cca2b2110f7944dc25a74d7afa0e35af Mon Sep 17 00:00:00 2001 From: Michael Helmling Date: Sat, 16 Mar 2024 21:43:33 +0100 Subject: [PATCH 1/9] cibuildwheel: don't force clean build --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 1a37e6a..7474e45 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,5 +40,5 @@ package-dir = { "" = "src" } [tool.cibuildwheel] test-extras = ["tests"] test-command = "pytest {project}/tests" -before-build = "python build_taglib.py --clean" +before-build = "python build_taglib.py" skip = "cp36-* cp37-*" From 93f9996ef9247b41e10656c153bed00ecb5fcd18 Mon Sep 17 00:00:00 2001 From: Michael Helmling Date: Sat, 16 Mar 2024 21:44:24 +0100 Subject: [PATCH 2/9] CI: enable taglib build cache for all OS'es --- .github/workflows/default.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 45ce74c..e0fa7e7 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -19,12 +19,11 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.x" - - name: cache built taglib on windows (very slow) + - name: cache native taglib build artifacts uses: actions/cache@v4 - if: ${{ runner.os == 'Windows' }} with: path: build/taglib - key: taglib-windows-${{ hashFiles('build_taglib.py') }} + key: taglib-${{ matrix.os }}-${{ hashFiles('build_taglib.py') }} - name: install pip dependencies (Linux) if: ${{ runner.os == 'Linux' }} run: | From 78b30a47d0af208e5f880b4acd915ca1a78db508 Mon Sep 17 00:00:00 2001 From: Michael Helmling Date: Sat, 16 Mar 2024 21:58:22 +0100 Subject: [PATCH 3/9] CI: enable native arm64 builds --- .github/workflows/default.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index e0fa7e7..0bbf958 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -6,13 +6,11 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-13, macos-14, windows-latest] runs-on: ${{ matrix.os }} env: CIBW_SKIP: "*p36-* *p37-*" CIBW_ARCHS: auto64 - CIBW_ARCHS_MACOS: "x86_64 arm64" - MACOSX_DEPLOYMENT_TARGET: "10.14" steps: - uses: actions/checkout@v4 - name: Set up Python From 2d6f249bb0917253bcab58695a8741bec38bc556 Mon Sep 17 00:00:00 2001 From: Michael Helmling Date: Sat, 16 Mar 2024 22:09:46 +0100 Subject: [PATCH 4/9] build_taglib.py: make taglib build dir implementation-dependent --- build_taglib.py | 3 ++- setup.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/build_taglib.py b/build_taglib.py index 6ab7f12..83c40f7 100644 --- a/build_taglib.py +++ b/build_taglib.py @@ -13,6 +13,7 @@ arch = "x64" if is_x64 else "x32" system = platform.system() python_version = platform.python_version() +python_implementation = sys.implementation.name here = Path(__file__).resolve().parent taglib_version = "2.0" @@ -26,7 +27,7 @@ class Configuration: def __init__(self): self.build_path = here / "build" - self.tl_install_dir = self.build_path / "taglib" / f"{system}-{arch}-py{python_version}" + self.tl_install_dir = self.build_path / "taglib" / f"{system}-{arch}-{python_implementation}-{python_version}" self.clean = False @property diff --git a/setup.py b/setup.py index bd6df2f..1865a08 100644 --- a/setup.py +++ b/setup.py @@ -19,8 +19,9 @@ arch = "x64" if is_x64 else "x32" system = platform.system() python_version = platform.python_version() +python_implementation = sys.implementation.name here = Path(__file__).resolve().parent -default_taglib_path = here / "build" / "taglib" / f"{system}-{arch}-py{python_version}" +default_taglib_path = here / "build" / "taglib" / f"{system}-{arch}-{python_implementation}-{python_version}" src = Path("src") From 7e9defca6aa904151f5ea0d88937f41651e393ca Mon Sep 17 00:00:00 2001 From: Michael Helmling Date: Sat, 16 Mar 2024 22:12:18 +0100 Subject: [PATCH 5/9] pyproject: fix README link --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7474e45..c07b360 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ description = "cross-platform, Python audio metadata (\"tagging\") library based authors = [ { name = "Michael Helmling", email = "michaelhelmling@posteo.de" } ] -readme = "Readme.md" +readme = "README.md" license = { text = "GPLv3+" } classifiers = [ "Development Status :: 5 - Production/Stable", From 7f89854fc637edaeaf41ebdf04ea7c50dbe4f2a8 Mon Sep 17 00:00:00 2001 From: Michael Helmling Date: Sat, 16 Mar 2024 22:19:40 +0100 Subject: [PATCH 6/9] build scripts: simplify output directory handling Note: the scripts still work on 32-bit! --- build_taglib.py | 9 +++------ setup.py | 4 +--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/build_taglib.py b/build_taglib.py index 83c40f7..1ead703 100644 --- a/build_taglib.py +++ b/build_taglib.py @@ -9,8 +9,6 @@ from argparse import ArgumentParser from pathlib import Path -is_x64 = sys.maxsize > 2 ** 32 -arch = "x64" if is_x64 else "x32" system = platform.system() python_version = platform.python_version() python_implementation = sys.implementation.name @@ -27,7 +25,7 @@ class Configuration: def __init__(self): self.build_path = here / "build" - self.tl_install_dir = self.build_path / "taglib" / f"{system}-{arch}-{python_implementation}-{python_version}" + self.tl_install_dir = self.build_path / "taglib" / f"{system}-{python_implementation}-{python_version}" self.clean = False @property @@ -116,8 +114,7 @@ def cmake_config(config: Configuration): print("running cmake ...") args = ["-DWITH_ZLIB=OFF"] # todo fix building wheels with zlib support if system == "Windows": - cmake_arch = "x64" if is_x64 else "Win32" - args += ["-A", cmake_arch] + args += ["-A", "x64"] elif system == "Linux": args.append("-DCMAKE_POSITION_INDEPENDENT_CODE=ON") args.append(f"-DCMAKE_INSTALL_PREFIX={config.tl_install_dir}") @@ -166,7 +163,7 @@ def parse_args() -> Configuration: def run(): - print(f"building taglib on {system}, arch {arch}, for python {python_version} ...") + print(f"building taglib on {system}, for {python_implementation} {python_version} ...") config = parse_args() tag_lib = ( config.tl_install_dir diff --git a/setup.py b/setup.py index 1865a08..97c9e68 100644 --- a/setup.py +++ b/setup.py @@ -15,13 +15,11 @@ from Cython.Build import cythonize from setuptools import setup, Extension -is_x64 = sys.maxsize > 2 ** 32 -arch = "x64" if is_x64 else "x32" system = platform.system() python_version = platform.python_version() python_implementation = sys.implementation.name here = Path(__file__).resolve().parent -default_taglib_path = here / "build" / "taglib" / f"{system}-{arch}-{python_implementation}-{python_version}" +default_taglib_path = here / "build" / "taglib" / f"{system}-{python_implementation}-{python_version}" src = Path("src") From 5c2fe863e209c551abb56b5bc3e90308813533ab Mon Sep 17 00:00:00 2001 From: Michael Helmling Date: Sat, 16 Mar 2024 22:25:32 +0100 Subject: [PATCH 7/9] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9941496..ffd5400 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ a major upgrade of the underlying C++ Taglib library. - [!123](https://github.com/supermihi/pytaglib/pull/123): upgrade to Taglib 2.0 Thanks to [Urs Fleisch](https://github.com/ufleisch) for help +- [#135](https://github.com/supermihi/pytaglib/pull/135): natively build arm64 wheels on macos-14 runner ## pytaglib 2.1.0 (2023-11-17) From f02204a726422e9189a1d15d4510b5badf4423a8 Mon Sep 17 00:00:00 2001 From: Michael Helmling Date: Sat, 16 Mar 2024 22:41:36 +0100 Subject: [PATCH 8/9] build scripts: ensure taglib build path is specific for used compiler --- build_taglib.py | 14 +++++++------- setup.py | 6 ++---- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/build_taglib.py b/build_taglib.py index 1ead703..03ce5e2 100644 --- a/build_taglib.py +++ b/build_taglib.py @@ -10,8 +10,6 @@ from pathlib import Path system = platform.system() -python_version = platform.python_version() -python_implementation = sys.implementation.name here = Path(__file__).resolve().parent taglib_version = "2.0" @@ -21,20 +19,22 @@ utfcpp_version = "4.0.5" utfcpp_release = f"https://github.com/nemtrif/utfcpp/archive/refs/tags/v{utfcpp_version}.tar.gz" +sys_identifier = f"{system}-{platform.machine()}-{sys.implementation.name}-{platform.python_version()}" class Configuration: def __init__(self): - self.build_path = here / "build" - self.tl_install_dir = self.build_path / "taglib" / f"{system}-{python_implementation}-{python_version}" + self.build_base = here / "build" + self.build_path = self.build_base / sys_identifier + self.tl_install_dir = self.build_path / "taglib" self.clean = False @property def tl_download_dest(self): - return self.build_path / f"taglib-{taglib_version}.tar.gz" + return self.build_base / f"taglib-{taglib_version}.tar.gz" @property def utfcpp_download_dest(self): - return self.build_path / f"utfcpp-{utfcpp_version}.tar.gz" + return self.build_base / f"utfcpp-{utfcpp_version}.tar.gz" @property def tl_extract_dir(self): @@ -163,7 +163,7 @@ def parse_args() -> Configuration: def run(): - print(f"building taglib on {system}, for {python_implementation} {python_version} ...") + print(f"building taglib on {sys_identifier} ...") config = parse_args() tag_lib = ( config.tl_install_dir diff --git a/setup.py b/setup.py index 97c9e68..f16e107 100644 --- a/setup.py +++ b/setup.py @@ -15,11 +15,9 @@ from Cython.Build import cythonize from setuptools import setup, Extension -system = platform.system() -python_version = platform.python_version() -python_implementation = sys.implementation.name +sys_identifier = f"{platform.system()}-{platform.machine()}-{sys.implementation.name}-{platform.python_version()}" here = Path(__file__).resolve().parent -default_taglib_path = here / "build" / "taglib" / f"{system}-{python_implementation}-{python_version}" +default_taglib_path = here / "build" / sys_identifier / "taglib" src = Path("src") From 381dbfda043272d5df52f0cb78f466942ca77b69 Mon Sep 17 00:00:00 2001 From: Michael Helmling Date: Sat, 16 Mar 2024 23:03:11 +0100 Subject: [PATCH 9/9] CI: fix cache path --- .github/workflows/default.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index 0bbf958..7f82866 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -17,10 +17,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.x" - - name: cache native taglib build artifacts + - name: cache native build artifacts uses: actions/cache@v4 with: - path: build/taglib + path: build key: taglib-${{ matrix.os }}-${{ hashFiles('build_taglib.py') }} - name: install pip dependencies (Linux) if: ${{ runner.os == 'Linux' }}