-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parameterize check scripts over requests version
- Loading branch information
Henry Mercer
committed
May 23, 2023
1 parent
1245696
commit 292bb7c
Showing
5 changed files
with
61 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.