diff --git a/.github/workflows/python-deps.yml b/.github/workflows/python-deps.yml index 097533a20..15ef15f2c 100644 --- a/.github/workflows/python-deps.yml +++ b/.github/workflows/python-deps.yml @@ -72,7 +72,7 @@ jobs: - name: Verify packages installed run: | - $GITHUB_WORKSPACE/python-setup/tests/check_requests_2_26_0.sh ${PYTHON_VERSION} + $GITHUB_WORKSPACE/python-setup/tests/check_requests.sh ${PYTHON_VERSION} 2.26.0 # This one shouldn't fail, but also won't install packages test-setup-python-scripts-non-standard-location: @@ -170,5 +170,5 @@ jobs: - name: Verify packages installed run: | - $cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\tests\\check_requests_2_26_0.ps1" - powershell -File $cmd $Env:PYTHON_VERSION + $cmd = $Env:GITHUB_WORKSPACE + "\\python-setup\\tests\\check_requests.ps1" + powershell -File $cmd $Env:PYTHON_VERSION 2.26.0 diff --git a/python-setup/tests/check_requests.ps1 b/python-setup/tests/check_requests.ps1 new file mode 100644 index 000000000..957600d9f --- /dev/null +++ b/python-setup/tests/check_requests.ps1 @@ -0,0 +1,27 @@ +#! /usr/bin/pwsh + +$EXPECTED_PYTHON_VERSION=$args[0] +$EXPECTED_REQUESTS_VERSION=$args[1] + +$FOUND_PYTHON_VERSION="$Env:LGTM_PYTHON_SETUP_VERSION" +$FOUND_PYTHONPATH="$Env:LGTM_INDEX_IMPORT_PATH" + +write-host "FOUND_PYTHON_VERSION=$FOUND_PYTHON_VERSION FOUND_PYTHONPATH=$FOUND_PYTHONPATH " + +if ($FOUND_PYTHON_VERSION -ne $EXPECTED_PYTHON_VERSION) { + write-host "Script told us to use Python $FOUND_PYTHON_VERSION, but expected $EXPECTED_PYTHON_VERSION" + exit 1 +} else { + write-host "Script told us to use Python $FOUND_PYTHON_VERSION, which was expected" +} + +$env:PYTHONPATH=$FOUND_PYTHONPATH + +$INSTALLED_REQUESTS_VERSION = (py -3 -c "import requests; print(requests.__version__)") + +if ($INSTALLED_REQUESTS_VERSION -ne $EXPECTED_REQUESTS_VERSION) { + write-host "Using $FOUND_PYTHONPATH as PYTHONPATH, we found version $INSTALLED_REQUESTS_VERSION of requests, but expected $EXPECTED_REQUESTS_VERSION" + exit 1 +} else { + write-host "Using $FOUND_PYTHONPATH as PYTHONPATH, we found version $INSTALLED_REQUESTS_VERSION of requests, which was expected" +} diff --git a/python-setup/tests/check_requests.sh b/python-setup/tests/check_requests.sh new file mode 100755 index 000000000..71d5a565e --- /dev/null +++ b/python-setup/tests/check_requests.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -e + +SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +EXPECTED_PYTHON_VERSION=$1 +EXPECTED_REQUESTS_VERSION=$2 + +FOUND_PYTHON_VERSION="$LGTM_PYTHON_SETUP_VERSION" +FOUND_PYTHONPATH="$LGTM_INDEX_IMPORT_PATH" + +echo "FOUND_PYTHON_VERSION=${FOUND_PYTHON_VERSION} FOUND_PYTHONPATH=${FOUND_PYTHONPATH} " + +if [[ $FOUND_PYTHON_VERSION != $EXPECTED_PYTHON_VERSION ]]; then + echo "Script told us to use Python ${FOUND_PYTHON_VERSION}, but expected ${EXPECTED_PYTHON_VERSION}" + exit 1 +else + echo "Script told us to use Python ${FOUND_PYTHON_VERSION}, which was expected" +fi + +PYTHON_EXE="python${EXPECTED_PYTHON_VERSION}" + +INSTALLED_REQUESTS_VERSION=$(PYTHONPATH="${FOUND_PYTHONPATH}" "${PYTHON_EXE}" -c 'import requests; print(requests.__version__)') + +if [[ "$INSTALLED_REQUESTS_VERSION" != "$EXPECTED_REQUESTS_VERSION" ]]; then + echo "Using ${FOUND_PYTHONPATH} as PYTHONPATH, we found version $INSTALLED_REQUESTS_VERSION of requests, but expected $EXPECTED_REQUESTS_VERSION" + exit 1 +else + echo "Using ${FOUND_PYTHONPATH} as PYTHONPATH, we found version $INSTALLED_REQUESTS_VERSION of requests, which was expected" +fi diff --git a/python-setup/tests/check_requests_2_26_0.ps1 b/python-setup/tests/check_requests_2_26_0.ps1 deleted file mode 100644 index 616519505..000000000 --- a/python-setup/tests/check_requests_2_26_0.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#! /usr/bin/pwsh - -$EXPECTED_VERSION=$args[0] - -$FOUND_VERSION="$Env:LGTM_PYTHON_SETUP_VERSION" -$FOUND_PYTHONPATH="$Env:LGTM_INDEX_IMPORT_PATH" - -write-host "FOUND_VERSION=$FOUND_VERSION FOUND_PYTHONPATH=$FOUND_PYTHONPATH " - -if ($FOUND_VERSION -ne $EXPECTED_VERSION) { - write-host "Script told us to use Python $FOUND_VERSION, but expected $EXPECTED_VERSION" - exit 1 -} else { - write-host "Script told us to use Python $FOUND_VERSION, which was expected" -} - -$env:PYTHONPATH=$FOUND_PYTHONPATH - -$INSTALLED_REQUESTS_VERSION = (py -3 -c "import requests; print(requests.__version__)") - -$EXPECTED_REQUESTS="2.26.0" - -if ($INSTALLED_REQUESTS_VERSION -ne $EXPECTED_REQUESTS) { - write-host "Using $FOUND_PYTHONPATH as PYTHONPATH, we found version $INSTALLED_REQUESTS_VERSION of requests, but expected $EXPECTED_REQUESTS" - exit 1 -} else { - write-host "Using $FOUND_PYTHONPATH as PYTHONPATH, we found version $INSTALLED_REQUESTS_VERSION of requests, which was expected" -} diff --git a/python-setup/tests/check_requests_2_26_0.sh b/python-setup/tests/check_requests_2_26_0.sh deleted file mode 100755 index 2cd2d5405..000000000 --- a/python-setup/tests/check_requests_2_26_0.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -set -e - -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -EXPECTED_VERSION=$1 - -FOUND_VERSION="$LGTM_PYTHON_SETUP_VERSION" -FOUND_PYTHONPATH="$LGTM_INDEX_IMPORT_PATH" - -echo "FOUND_VERSION=${FOUND_VERSION} FOUND_PYTHONPATH=${FOUND_PYTHONPATH} " - -if [[ $FOUND_VERSION != $EXPECTED_VERSION ]]; then - echo "Script told us to use Python ${FOUND_VERSION}, but expected ${EXPECTED_VERSION}" - exit 1 -else - echo "Script told us to use Python ${FOUND_VERSION}, which was expected" -fi - -PYTHON_EXE="python${EXPECTED_VERSION}" - -INSTALLED_REQUESTS_VERSION=$(PYTHONPATH="${FOUND_PYTHONPATH}" "${PYTHON_EXE}" -c 'import requests; print(requests.__version__)') - -EXPECTED_REQUESTS="2.26.0" - -if [[ "$INSTALLED_REQUESTS_VERSION" != "$EXPECTED_REQUESTS" ]]; then - echo "Using ${FOUND_PYTHONPATH} as PYTHONPATH, we found version $INSTALLED_REQUESTS_VERSION of requests, but expected $EXPECTED_REQUESTS" - exit 1 -else - echo "Using ${FOUND_PYTHONPATH} as PYTHONPATH, we found version $INSTALLED_REQUESTS_VERSION of requests, which was expected" -fi