From 30a943edf44c8bd5142b9dbf828bc4f9acbbd356 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 23 Oct 2023 10:56:19 +0200 Subject: [PATCH 1/3] Remove setuptools<64 restriction --- scripts/installAmiciSource.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/installAmiciSource.sh b/scripts/installAmiciSource.sh index aa330bef22..93482be291 100755 --- a/scripts/installAmiciSource.sh +++ b/scripts/installAmiciSource.sh @@ -27,7 +27,6 @@ else source ${AMICI_PATH}/build/venv/bin/activate fi -pip install -U "setuptools<64" pip install --upgrade pip wheel pip install --upgrade pip scipy matplotlib coverage pytest \ pytest-cov cmake_build_extension numpy From 1115da00ad758b8445623607ee48e8e9997ef7f1 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 1 Nov 2023 13:09:02 +0100 Subject: [PATCH 2/3] Enable overriding setuptools' `build_temp` directory --- .github/workflows/test_python_cplusplus.yml | 2 +- python/sdist/amici/custom_commands.py | 6 ++++++ scripts/installAmiciSource.sh | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml index 416252ee4b..b1b0942ab5 100644 --- a/.github/workflows/test_python_cplusplus.yml +++ b/.github/workflows/test_python_cplusplus.yml @@ -135,7 +135,7 @@ jobs: -d ${AMICI_DIR}/build/CMakeFiles/amici.dir/src \ -b ${AMICI_DIR} -c -o coverage_cpp.info \ && lcov --compat-libtool --no-external \ - -d ${AMICI_DIR}/python/sdist/build/$(python -c "import sys, sysconfig; print(f'temp.{sysconfig.get_platform()}-{sys.implementation.cache_tag}_amici')")/CMakeFiles/amici.dir/src \ + -d ${AMICI_DIR}/python/sdist/build/temp_amici/CMakeFiles/amici.dir/src \ -b ${AMICI_DIR}/python/sdist -c -o coverage_py.info \ && lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info diff --git a/python/sdist/amici/custom_commands.py b/python/sdist/amici/custom_commands.py index d54060a009..6ebd5192b1 100644 --- a/python/sdist/amici/custom_commands.py +++ b/python/sdist/amici/custom_commands.py @@ -178,3 +178,9 @@ def build_extension(self, ext: CMakeExtension) -> None: super().build_extension(ext) print("-" * 30, ext.name, "-" * 30, file=sys.stderr) + + def finalize_options(self): + super().finalize_options() + + if os.getenv("AMICI_BUILD_TEMP"): + self.build_temp = os.getenv("AMICI_BUILD_TEMP") diff --git a/scripts/installAmiciSource.sh b/scripts/installAmiciSource.sh index 93482be291..4e693468b7 100755 --- a/scripts/installAmiciSource.sh +++ b/scripts/installAmiciSource.sh @@ -31,5 +31,5 @@ pip install --upgrade pip wheel pip install --upgrade pip scipy matplotlib coverage pytest \ pytest-cov cmake_build_extension numpy pip install git+https://github.com/FFroehlich/pysb@fix_pattern_matching # pin to PR for SPM with compartments -pip install --verbose -e ${AMICI_PATH}/python/sdist[petab,test,vis] --no-build-isolation +AMICI_BUILD_TEMP="${AMICI_PATH}/python/sdist/build/temp" pip install --verbose -e ${AMICI_PATH}/python/sdist[petab,test,vis] --no-build-isolation deactivate From ed7d95bc6483f17cfe3e98644edd53ac3dfd2412 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 1 Nov 2023 15:25:05 +0100 Subject: [PATCH 3/3] .. --- python/sdist/amici/custom_commands.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/python/sdist/amici/custom_commands.py b/python/sdist/amici/custom_commands.py index 6ebd5192b1..46abfe3290 100644 --- a/python/sdist/amici/custom_commands.py +++ b/python/sdist/amici/custom_commands.py @@ -126,6 +126,16 @@ def run(self): class AmiciBuildCMakeExtension(BuildExtension): + def finalize_options(self): + # Allow overriding the - since setuptools version 64 randomly named - + # setuptools/distutils temporary build directory via environment variable. + # This is useful for CI builds where we need the files in this directory + # for code coverage analysis. + if os.getenv("AMICI_BUILD_TEMP"): + self.build_temp = os.getenv("AMICI_BUILD_TEMP") + + super().finalize_options() + def run(self): """Copy the generated clibs to the extensions folder to be included in the wheel @@ -178,9 +188,3 @@ def build_extension(self, ext: CMakeExtension) -> None: super().build_extension(ext) print("-" * 30, ext.name, "-" * 30, file=sys.stderr) - - def finalize_options(self): - super().finalize_options() - - if os.getenv("AMICI_BUILD_TEMP"): - self.build_temp = os.getenv("AMICI_BUILD_TEMP")