Skip to content

Commit

Permalink
Remove setuptools<64 restriction (#2180)
Browse files Browse the repository at this point in the history
We had to require setuptools<64 because it change its temporary build directory from a known path to a randomly named temporary directory. However, setuptools<64 doesn't work with for Python3.12 (#2179). Therefore, this adds an option to change the setuptools temporary build directory via the `AMICI_BUILD_TEMP` environment variable, so we have those temp files in a known path for coverage analysis. Not meant to be used by users.
  • Loading branch information
dweindl authored Nov 3, 2023
1 parent 71295a5 commit 269910b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_python_cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,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
Expand Down
10 changes: 10 additions & 0 deletions python/sdist/amici/custom_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions scripts/installAmiciSource.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ 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
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

0 comments on commit 269910b

Please sign in to comment.