From 6bd4377588786ed2ceb689bf50c0d70fe15f0a15 Mon Sep 17 00:00:00 2001 From: Adrian Stanea Date: Thu, 17 Oct 2024 12:15:17 +0300 Subject: [PATCH] ci: override the python version of the builds - Always use a predfeined python version for the builds instead of the system default one. Signed-off-by: Adrian Stanea --- CI/macOS/make_macOS | 4 ++-- CI/ubuntu/install_deps | 2 +- CI/ubuntu/make_linux | 4 ++-- azure-pipelines.yml | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CI/macOS/make_macOS b/CI/macOS/make_macOS index e1f0af6c..3bcece4b 100755 --- a/CI/macOS/make_macOS +++ b/CI/macOS/make_macOS @@ -9,7 +9,7 @@ make_package() { echo "### Make OSX packague" mkdir -p "${WORKDIR}"/build && cd "${WORKDIR}"/build cmake "$WORKDIR" \ - -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '/python')") \ + -DPYTHON_EXECUTABLE:FILEPATH="$(${PYTHON} -c 'import os, sys; print(os.path.dirname(sys.executable))')/${PYTHON}" \ -DOSX_PACKAGE=ON \ -DENABLE_TOOLS=ON \ -DENABLE_PYTHON=ON \ @@ -25,7 +25,7 @@ make_tar() { echo "### Make OSX tar" mkdir -p "${WORKDIR}"/build_tar && cd "${WORKDIR}"/build_tar cmake "${WORKDIR}" \ - -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '/python')") \ + -DPYTHON_EXECUTABLE:FILEPATH="$(${PYTHON} -c 'import os, sys; print(os.path.dirname(sys.executable))')/${PYTHON}" \ -DOSX_PACKAGE=OFF \ -DENABLE_PACKAGING=ON \ -DENABLE_PYTHON=ON \ diff --git a/CI/ubuntu/install_deps b/CI/ubuntu/install_deps index 8499c11e..fc7bf9bf 100755 --- a/CI/ubuntu/install_deps +++ b/CI/ubuntu/install_deps @@ -100,7 +100,7 @@ build_libiio() { -DCPACK_SYSTEM_NAME=${ARTIFACTNAME} \ -DENABLE_PACKAGING=ON \ -DPYTHON_BINDINGS=ON \ - -DPYTHON_EXECUTABLE:FILEPATH="$("$PYTHON" -c 'import os, sys; print(os.path.dirname(sys.executable) + "/python")')" \ + -DPYTHON_EXECUTABLE:FILEPATH="$(${PYTHON} -c 'import os, sys; print(os.path.dirname(sys.executable))')/${PYTHON}" \ -DWITH_DOC=ON \ -DWITH_MAN=ON \ -DWITH_SERIAL_BACKEND=ON diff --git a/CI/ubuntu/make_linux b/CI/ubuntu/make_linux index bca3c625..a78c3c45 100755 --- a/CI/ubuntu/make_linux +++ b/CI/ubuntu/make_linux @@ -15,7 +15,7 @@ handle_default() { -DENABLE_LOG=ON \ -DENABLE_PYTHON=ON \ -DENABLE_TOOLS=ON \ - -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '/python')") + -DPYTHON_EXECUTABLE:FILEPATH="$(${PYTHON} -c 'import os, sys; print(os.path.dirname(sys.executable))')/${PYTHON}" \ make sudo python3 setup.py --command-packages=stdeb.command sdist_dsc cd "$(find . -type d -name "debian" | head -n 1)" @@ -35,7 +35,7 @@ handle_default() { -DENABLE_LOG=ON \ -DENABLE_PACKAGING=ON \ -DENABLE_PYTHON=OFF \ - -DPYTHON_EXECUTABLE:FILEPATH=$(python -c "import os, sys; print(os.path.dirname(sys.executable) + '/python')") + -DPYTHON_EXECUTABLE:FILEPATH="$(${PYTHON} -c 'import os, sys; print(os.path.dirname(sys.executable))')/${PYTHON}" \ make && make package ls } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ccc07ce8..03699469 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,6 +1,6 @@ variables: libiioPipelineId: 9 - PYTHON: python + PYTHON: python3.11 PIP: pip AnalogDevices_OpenSource_GUID: '02a28b00-b3c8-4fdf-af9c-c2460499147f' IS_PULL_REQUEST: ${{ eq('$(Build.Reason)', 'PullRequest') }} @@ -66,7 +66,7 @@ jobs: persistCredentials: true - task: UsePythonVersion@0 inputs: - versionSpec: '3.11' + versionSpec: '$(PYTHON)' addToPath: true - script: ./CI/ubuntu/install_deps displayName: "Install Dependencies" @@ -123,7 +123,7 @@ jobs: # clean: true # - task: UsePythonVersion@0 # inputs: -# versionSpec: '3.11' +# versionSpec: '$(PYTHON)' # addToPath: true # - script: ./CI/macOS/install_deps # displayName: "Install Dependencies" @@ -213,7 +213,7 @@ jobs: # clean: true # - task: UsePythonVersion@0 # inputs: -# versionSpec: '3.11' +# versionSpec: '$(PYTHON)' # - task: PowerShell@2 # displayName: 'Install Dependencies' # inputs: