From 9b7f908c9a18bdc1170f840d9c553915b58da832 Mon Sep 17 00:00:00 2001 From: Declan <5962877+dec1@users.noreply.github.com> Date: Thu, 20 Jun 2024 18:43:31 +0200 Subject: [PATCH] allow ci python version to override default in venv script --- .github/workflows/ci.yaml | 6 +++--- prj/script/venv_create.sh | 8 ++++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d262c28..9fb9e53 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,16 +21,16 @@ jobs: - name: Check out the repository uses: actions/checkout@v4 - - name: Set up Python 3.11 + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.12' - name: Set up dependencies (Linux) if: runner.os == 'Linux' run: | cd prj/script - ./venv_create.sh + ./venv_create.sh 3.12 cd ../.. - name: Set up dependencies (Windows) diff --git a/prj/script/venv_create.sh b/prj/script/venv_create.sh index 6c4d139..7edfd50 100755 --- a/prj/script/venv_create.sh +++ b/prj/script/venv_create.sh @@ -3,6 +3,14 @@ script_dir=$(dirname "$0") source ${script_dir}/common.sh +# let caller (eg ci pipeline) override python version, by passing as arg to his script, eg +# - `venv_create.sh 3.11` +# if none passed then the python version used is +# - that set in `common.sh` if any, or if not set there then +# - whatever is found as "python" on path +py_ver=${1:-$py_ver} + + echo "using python version: " ${py_ver} python${py_ver} -m venv ${venv_dir}