From 40fb106cc5b8285937b07002f7bd05f33dd878be Mon Sep 17 00:00:00 2001 From: William Silversmith Date: Thu, 8 Aug 2024 14:27:42 -0400 Subject: [PATCH] ci: update build system for numpy 2.0 --- .github/workflows/build_wheel.yml | 4 ++-- pyproject.toml | 2 +- setup.py | 12 ++++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml index 75e6b00..cf16e72 100644 --- a/.github/workflows/build_wheel.yml +++ b/.github/workflows/build_wheel.yml @@ -28,10 +28,10 @@ jobs: uses: ssrobins/install-cmake@v1 - name: Build wheels - uses: pypa/cibuildwheel@v2.16.5 + uses: pypa/cibuildwheel@v2.19.1 # to supply options, put them in 'env', like: env: - CIBW_BEFORE_BUILD: git submodule init && git submodule update && pip install cython oldest-supported-numpy scikit-build + CIBW_BEFORE_BUILD: git submodule init && git submodule update && pip install cython numpy scikit-build CPPFLAGS: -I/usr/local/opt/zlib/include LDFLAGS: -L/usr/local/opt/zlib/lib CIBW_ARCHS_MACOS: "x86_64 arm64" diff --git a/pyproject.toml b/pyproject.toml index 13196d6..f4bc2c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,5 +3,5 @@ requires = [ "setuptools", "scikit-build >= 0.9.0", "wheel", - "oldest-supported-numpy" + "numpy" ] \ No newline at end of file diff --git a/setup.py b/setup.py index d745f76..6f08689 100644 --- a/setup.py +++ b/setup.py @@ -8,9 +8,17 @@ from skbuild.exceptions import SKBuildError from skbuild.cmaker import get_cmake_version -import numpy as np import multiprocessing as mp +class NumpyImport: + def __repr__(self): + import numpy as np + + return np.get_include() + + __fspath__ = __repr__ + + if not "CMAKE_BUILD_PARALLEL_LEVEL" in os.environ: os.environ["CMAKE_BUILD_PARALLEL_LEVEL"] = str(mp.cpu_count()) @@ -90,7 +98,7 @@ def read(fname): depends=[ os.path.join(src_dir, 'DracoPy.h') ], language='c++', include_dirs = [ - np.get_include(), + str(NumpyImport()), os.path.join(CMAKE_INSTALL_DIR(), 'include/'), ], extra_compile_args=extra_compile_args,