Skip to content

Commit 6e9f8a1

Browse files
committed
Modify Python version dependency by default
This is required for all "complex" Poetry operations, e.g. when installing the project to run pytest or similar. To allow for building packages that can be installed on Python 2, this can be turned off explicitly by setting the environment variable IGNORE_DEPS_PYTHON.
1 parent 436ec5f commit 6e9f8a1

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

β€Ž.github/workflows/build.ymlβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ jobs:
113113

114114
- name: πŸŽ­πŸ‘· Build 🧱 project
115115
run: scripts/run-poetry.sh build
116+
env:
117+
IGNORE_DEPS_PYTHON: true # required to build "py2.py3" wheels
116118

117119
- name: πŸ“€ Upload build artifacts
118120
uses: actions/upload-artifact@v4

β€Žscripts/run-poetry.shβ€Ž

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,19 @@ rm -rf dist/
2727
# adjust metadata version strings:
2828
scripts/pom-to-pyproject.sh
2929

30-
# # sed -i 's/^python = ">=2.7"$/python = ">=3.10"/' pyproject.toml
30+
# in case the project needs to be "installed" (e.g. to run pytest and generate
31+
# coverage reports), the Python version specified in the project's dependencies
32+
# needs to be set to a version satisfying the other dependencies requirements -
33+
# this can be turned off e.g. for simply packaging for PyPi.
34+
PYPROJ="pyproject.toml"
35+
DEPS_PYTHON='>=3.10'
36+
if [ -z "$IGNORE_DEPS_PYTHON" ]; then
37+
echo "$PYPROJ: setting [python = \"$DEPS_PYTHON\"]"
38+
echo "Use 'export IGNORE_DEPS_PYTHON=true' to skip this step."
39+
sed -i 's/^python = ">=2.7"$/python = "'"$DEPS_PYTHON"'"/' $PYPROJ
40+
else
41+
echo "$PYPROJ: found 'IGNORE_DEPS_PYTHON' envvar, not modifying."
42+
fi
3143

3244
set +o errexit # otherwise the script stops if poetry exits non-zero
3345
poetry "$@" # run poetry with the parameters given to the script

0 commit comments

Comments
Β (0)