diff --git a/.github/workflows/build_osx.yml b/.github/workflows/build_osx.yml index 13e7b710f6..360b32fb7c 100644 --- a/.github/workflows/build_osx.yml +++ b/.github/workflows/build_osx.yml @@ -72,6 +72,10 @@ jobs: # We don't use gmpcxx, but it comes preinstalled on macos runner as arm64 bottle # and CGAL detects it and breaks cross compilation. brew uninstall --ignore-dependencies gmp + # Otherwise Python will fallback to use arm64 `pkg-config`, + # will pick up arm64 libraries ('zstd' in particular), + # and break the build. + /usr/local/bin/brew install pkg-config # Required by Python. /usr/local/bin/brew install gettext openssl fi diff --git a/.github/workflows/ci-ifcopenshell-python-pypi.yml b/.github/workflows/ci-ifcopenshell-python-pypi.yml index 0389f1c84f..7d7cf44d3c 100644 --- a/.github/workflows/ci-ifcopenshell-python-pypi.yml +++ b/.github/workflows/ci-ifcopenshell-python-pypi.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - pyver: [py39, py310, py311, py312, py313] + pyver: [py39, py310, py311, py312, py313, py314] config: - { name: "Windows 64bit", diff --git a/.github/workflows/ci-ifcopenshell-python.yml b/.github/workflows/ci-ifcopenshell-python.yml index 6ebefeb5d7..51867ac1cb 100644 --- a/.github/workflows/ci-ifcopenshell-python.yml +++ b/.github/workflows/ci-ifcopenshell-python.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - pyver: [py39, py310, py311, py312, py313] + pyver: [py39, py310, py311, py312, py313, py314] config: - { name: "Windows 64bit", diff --git a/nix/build-all.py b/nix/build-all.py index f6c1ffba38..32166e67e0 100644 --- a/nix/build-all.py +++ b/nix/build-all.py @@ -135,7 +135,7 @@ PROJECT_NAME = "IfcOpenShell" USE_CURRENT_PYTHON_VERSION = os.getenv("USE_CURRENT_PYTHON_VERSION") ADD_COMMIT_SHA = os.getenv("ADD_COMMIT_SHA") -PYTHON_VERSIONS = ["3.9.11", "3.10.3", "3.11.8", "3.12.1", "3.13.6"] +PYTHON_VERSIONS = ["3.9.11", "3.10.3", "3.11.8", "3.12.1", "3.13.6", "3.14.0"] JSON_VERSION = "3.11.3" OCE_VERSION = "0.18.3" OCCT_VERSION = "7.8.1" @@ -373,8 +373,9 @@ for cmd in required_commands: if missing_commands: raise ValueError(f"Required tools not installed or not added to PATH: {', '.join(missing_commands)}") +MAC_INTEL_BIN_PATH = "/usr/local/bin" if MAC_CROSS_COMPILE_INTEL: - brew = "/usr/local/bin/brew" + brew = f"{MAC_INTEL_BIN_PATH}/brew" assert os.path.exists(brew), f"For intel cross compilation the brew path is expected to be '{brew}'." # identifiers for the download tool (could be less memory consuming as ints, but are more verbose as strings) @@ -1012,6 +1013,7 @@ if "python" in targets and not USE_CURRENT_PYTHON_VERSION and "wasm" not in flag # On OSX a dynamic python library is built or it would not be compatible # with the system python because of some threading initialization PYTHON_CONFIGURE_ARGS: "list[str]" = [] + original_path = "" if platform.system() == "Darwin": PYTHON_CONFIGURE_ARGS = ["--enable-shared"] open_ssl_prefix = run([brew, "--prefix", "openssl@3"]).strip() @@ -1020,6 +1022,10 @@ if "python" in targets and not USE_CURRENT_PYTHON_VERSION and "wasm" not in flag PYTHON_CONFIGURE_ARGS.append(f"--with-openssl={open_ssl_prefix}") if MAC_CROSS_COMPILE_INTEL: + original_path = os.environ["PATH"] + # Need to ensure python will pick up intel's `pkg-config`, + # otherwise it might attempt to use ARM libraries (e.g. `zstd`) and fail. + os.environ["PATH"] = f"{MAC_INTEL_BIN_PATH}{os.pathsep}{original_path}" PYTHON_CONFIGURE_ARGS.extend(["--with-universal-archs=intel-64", "--enable-universalsdk"]) for PYTHON_VERSION in PYTHON_VERSIONS: @@ -1041,6 +1047,9 @@ if "python" in targets and not USE_CURRENT_PYTHON_VERSION and "wasm" not in flag if not os.path.exists(os.path.join(DEPS_DIR, "install", f"python-{PYTHON_VERSION}")): raise e + if MAC_CROSS_COMPILE_INTEL: + assert original_path + os.environ["PATH"] = original_path os.environ["CPPFLAGS"] = OLD_CPP_FLAGS os.environ["CXXFLAGS"] = OLD_CXX_FLAGS os.environ["CFLAGS"] = OLD_C_FLAGS diff --git a/src/ifcopenshell-python/Makefile b/src/ifcopenshell-python/Makefile index 78305f19d0..c0ecb4ff1f 100644 --- a/src/ifcopenshell-python/Makefile +++ b/src/ifcopenshell-python/Makefile @@ -43,6 +43,9 @@ endif ifeq ($(PYVERSION), py313) PYNUMBER:=313 endif +ifeq ($(PYVERSION), py314) +PYNUMBER:=314 +endif ifndef PYNUMBER $(error Unsupported PYVERSION '$(PYVERSION)') endif diff --git a/src/ifcopenshell-python/docs/ifcopenshell-python/installation.rst b/src/ifcopenshell-python/docs/ifcopenshell-python/installation.rst index 48b7b98d01..824bd86940 100644 --- a/src/ifcopenshell-python/docs/ifcopenshell-python/installation.rst +++ b/src/ifcopenshell-python/docs/ifcopenshell-python/installation.rst @@ -44,6 +44,8 @@ ZIP packages +-------------+---------------------------------+-------------------------------+---------------------------------+-----------------------------------+ | Python 3.13 | :ios_python_url:`py313-linux64` | :ios_python_url:`py313-win64` | :ios_python_url:`py313-macos64` | :ios_python_url:`py313-macosm164` | +-------------+---------------------------------+-------------------------------+---------------------------------+-----------------------------------+ + | Python 3.14 | :ios_python_url:`py314-linux64` | :ios_python_url:`py314-win64` | :ios_python_url:`py314-macos64` | :ios_python_url:`py314-macosm164` | + +-------------+---------------------------------+-------------------------------+---------------------------------+-----------------------------------+ 2. Unzip the downloaded file and copy the ``ifcopenshell`` directory into your Python path. If you're not sure where your Python path is, run the following diff --git a/src/ifcopenshell-python/test/test_package.py b/src/ifcopenshell-python/test/test_package.py index 0c0f88cc76..f27c9ea121 100644 --- a/src/ifcopenshell-python/test/test_package.py +++ b/src/ifcopenshell-python/test/test_package.py @@ -30,7 +30,7 @@ import test.bootstrap # - .github/workflows/ci-ifcopenshell-python.yml # - .github/workflows/ci-ifcopenshell-python-pypi.yml # - src/ifcopenshell-python/Makefile (PYVERSION check) -SUPPORTED_PY_VERSIONS = ("39", "310", "311", "312", "313") +SUPPORTED_PY_VERSIONS = ("39", "310", "311", "312", "313", "314") SUPPORTED_PLATFORMS = ("win64", "linux64", "macos64", "macosm164") diff --git a/win/build-all-win.py b/win/build-all-win.py index f0a005ca67..5c2c6ababa 100644 --- a/win/build-all-win.py +++ b/win/build-all-win.py @@ -11,7 +11,7 @@ from zipfile import ZipFile assert Path.cwd() == Path(__file__).parent, "Run this script from the 'win' directory." -PYTHON_VERSIONS = ["3.9.13", "3.10.3", "3.11.8", "3.12.1", "3.13.0"] +PYTHON_VERSIONS = ["3.9.13", "3.10.3", "3.11.8", "3.12.1", "3.13.0", "3.14.0"] REPO_PATH = Path(__file__).parent.parent REPO_WIN = REPO_PATH / "win" VERSION = (REPO_PATH / "VERSION").read_text().strip()