fix: Fix Py2 warning (#813)

Removes the obsolete `echo ''` at the end, fixes detection as `python --version` outputs to `stderr` instead of `stdout` in versions prior to 3.4 or something.
This commit is contained in:
Burak Yigit Kaya 2021-01-15 01:35:57 +03:00 committed by GitHub
parent 25453b8649
commit 0ac7eed028
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 20 deletions

View File

@ -10,6 +10,9 @@ on:
pull_request:
env:
DOCKER_COMPOSE_VERSION: 1.24.1
defaults:
run:
shell: bash
jobs:
test:
strategy:

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
if [ ! -f 'install.sh' ]; then echo 'Where are you?'; exit 1; fi
if [[ ! -f 'install.sh' ]]; then echo 'Where are you?'; exit 1; fi
source ./install/docker-aliases.sh
@ -25,8 +25,7 @@ install_geoip() {
else
echo "IP address geolocation is configured for updates."
echo "Updating IP address geolocation database ... "
$dcr geoipupdate
if [ $? -gt 0 ]; then
if ! $dcr geoipupdate; then
result='Error'
fi
echo "$result updating IP address geolocation database."

View File

@ -1,27 +1,22 @@
#!/usr/bin/env bash
if [ ! -f 'install.sh' ]; then echo 'Where are you?'; exit 1; fi
if [[ ! -f 'install.sh' ]]; then echo 'Where are you?'; exit 1; fi
source ./install/docker-aliases.sh
py2_warning() {
if [[ -n $($dcr --no-deps --entrypoint python web --version | grep 'Python 2') ]]; then
cat <<"EOW"
# Note the stderr>stdout redirection because Python thinks `--version` should
# be on stderr: https://stackoverflow.com/a/31715011/90297
if $dcr --no-deps --entrypoint python web --version 2>&1 | grep -q 'Python 2'; then
echo "
_ _ ____ ____ _ _______ ____ _____ _____ ____ _____ ______ _ _
| || | |_ _| |_ _|/ \ |_ __ \ |_ \|_ _||_ _||_ \|_ _|.' ___ | | || |
| || | \ \ /\ / / / _ \ | |__) | | \ | | | | | \ | | / .' \_| | || |
| || | \ \/ \/ / / ___ \ | __ / | |\ \| | | | | |\ \| | | | ____ | || |
|_||_| \ /\ /_/ / \ \_ _| | \ \_ _| |_\ |_ _| |_ _| |_\ |_\ `.___] ||_||_|
(_)(_) \/ \/|____| |____||____| |___||_____|\____||_____||_____|\____|`._____.' (_)(_)
|_||_| \ /\ /_/ / \ \_ _| | \ \_ _| |_\ |_ _| |_ _| |_\ |_\ \`.___] ||_||_|
(_)(_) \/ \/|____| |____||____| |___||_____|\____||_____||_____|\____|\`._____.' (_)(_)
EOW
echo 'You are using Sentry with Python 2, which is deprecated.'
echo 'Sentry 21.1 will be the last version with Python 2 support.'
fi
}
py2_warning
# Run a simple command that would exit with code 0 so the calling script won't think
# there was a failure in this script. (otherwise it fails when Python 2 is *NOT* detected)
# as the exit code for the `grep` call will be `-1` indicating no match found.
echo ''
"
echo '-----------------------------------------------------------'
echo 'You are using Sentry with Python 2, which is deprecated.'
echo 'Sentry 21.1 will be the last version with Python 2 support.'
fi