From 0c615a208dc77f8f47b305763b81fade7eda2907 Mon Sep 17 00:00:00 2001 From: Peguen <73380451+Peguen@users.noreply.github.com> Date: Mon, 23 Sep 2024 09:58:02 +0200 Subject: [PATCH] [Python] Wheel build tool: hatchling. cibuildwheel version updated to v2.21 (#1741) --- .github/workflows/build_wheels.yml | 4 +-- pyproject.toml | 43 +++++++++++++++++------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 0135a3f516..7400ead64e 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -27,7 +27,7 @@ jobs: fetch-depth: 0 - name: Build wheels - uses: pypa/cibuildwheel@v2.17 + uses: pypa/cibuildwheel@v2.21 env: CIBW_ARCHS: auto64 @@ -55,7 +55,7 @@ jobs: platforms: arm64 - name: Build wheels - uses: pypa/cibuildwheel@v2.17 + uses: pypa/cibuildwheel@v2.21 env: CIBW_ARCHS_LINUX: aarch64 diff --git a/pyproject.toml b/pyproject.toml index 4f69e2e26d..7e8b30cd61 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,28 +17,26 @@ dynamic = ["version"] "Source" = "https://github.com/eclipse-ecal/ecal" [build-system] # How pip and other frontends should build this project -# Version 8 of setuptools_scm drops Python 3.7 -requires = ["scikit-build-core>=0.8", "setuptools_scm~=7.1"] -build-backend = "scikit_build_core.build" +requires = ["hatchling", "hatch-vcs", "scikit-build-core~=0.10.6"] +build-backend = "hatchling.build" -[tool.setuptools_scm] -write_to = "lang/python/core/ecal/_version.py" +[tool.hatch.build.targets.wheel.hooks.scikit-build] +experimental = true -[tool.scikit-build] -# Setuptools-scm to provide the package version from git -metadata.version.provider = "scikit_build_core.metadata.setuptools_scm" -# Will be installed from PyPI if system version is too old/missing -cmake.version = ">=3.18" -cmake.targets = ["ecal_python"] # Targets to build -build-dir = "./_python_build" # Build directory for unisolated builds -install.components = ["python"] # CMake component to install +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "lang/python/core/ecal/_version.py" + +[tool.hatch.build.targets] # Directory structure to copy as Python package, last path component is # the package name +# wheel.packages = ["lang/python/package/ecal"] wheel.packages = ["lang/python/core/ecal", "lang/python/ecalhdf5/ecal"] # Files to include in the source archive to build from -sdist.exclude = ["*"] -sdist.include = [ +sdist.only-include = [ "/CMakeLists.txt", "/pyproject.toml", "/LICENSE.txt", @@ -50,19 +48,19 @@ sdist.include = [ "/cmake/", "/contrib/", "/cpack/", - "/ecal/core/", - "/ecal/service/", - "/ecal/CMakeLists.txt", + "/ecal/", "/lib/", "/licenses/", "lang/python/", "thirdparty/cmakefunctions/", + "thirdparty/ecaludp/", "thirdparty/protobuf/", "thirdparty/recycle/", "thirdparty/simpleini/", "thirdparty/tclap/", "thirdparty/tcp_pubsub/", + "thirdparty/yaml-cpp/", "thirdparty/asio/", "!thirdparty/asio/asio/asio/src/", @@ -79,6 +77,13 @@ sdist.include = [ ] +[tool.scikit-build] +# Will be installed from PyPI if system version is too old/missing +cmake.version = ">=3.18" +build.targets = ["ecal_python"] # Targets to build +build-dir = "./_python_build" # Build directory for unisolated builds +install.components = ["python"] # CMake component to install + [tool.scikit-build.cmake.define] CMAKE_PROJECT_TOP_LEVEL_INCLUDES = "cmake/submodule_dependencies.cmake" HAS_HDF5 = "ON" @@ -111,4 +116,4 @@ HDF5_EXTERNALLY_CONFIGURED = "ON" # architecture changes and causes link errors with Python archs = ["auto64"] # eCAL has build errors on musl libc -skip = [ "*-musllinux*" ] +skip = [ "*-musllinux*" ] \ No newline at end of file