Skip to content

Commit 0ac7eed

Browse files
authored
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.
1 parent 25453b8 commit 0ac7eed

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
pull_request:
1111
env:
1212
DOCKER_COMPOSE_VERSION: 1.24.1
13+
defaults:
14+
run:
15+
shell: bash
1316
jobs:
1417
test:
1518
strategy:

install/geoip.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
if [ ! -f 'install.sh' ]; then echo 'Where are you?'; exit 1; fi
3+
if [[ ! -f 'install.sh' ]]; then echo 'Where are you?'; exit 1; fi
44

55
source ./install/docker-aliases.sh
66

@@ -25,8 +25,7 @@ install_geoip() {
2525
else
2626
echo "IP address geolocation is configured for updates."
2727
echo "Updating IP address geolocation database ... "
28-
$dcr geoipupdate
29-
if [ $? -gt 0 ]; then
28+
if ! $dcr geoipupdate; then
3029
result='Error'
3130
fi
3231
echo "$result updating IP address geolocation database."

install/py2-warning.sh

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
#!/usr/bin/env bash
22

3-
if [ ! -f 'install.sh' ]; then echo 'Where are you?'; exit 1; fi
3+
if [[ ! -f 'install.sh' ]]; then echo 'Where are you?'; exit 1; fi
44

55
source ./install/docker-aliases.sh
66

7-
py2_warning() {
8-
if [[ -n $($dcr --no-deps --entrypoint python web --version | grep 'Python 2') ]]; then
9-
cat <<"EOW"
7+
# Note the stderr>stdout redirection because Python thinks `--version` should
8+
# be on stderr: https://stackoverflow.com/a/31715011/90297
9+
if $dcr --no-deps --entrypoint python web --version 2>&1 | grep -q 'Python 2'; then
10+
echo "
1011
_ _ ____ ____ _ _______ ____ _____ _____ ____ _____ ______ _ _
1112
| || | |_ _| |_ _|/ \ |_ __ \ |_ \|_ _||_ _||_ \|_ _|.' ___ | | || |
1213
| || | \ \ /\ / / / _ \ | |__) | | \ | | | | | \ | | / .' \_| | || |
1314
| || | \ \/ \/ / / ___ \ | __ / | |\ \| | | | | |\ \| | | | ____ | || |
14-
|_||_| \ /\ /_/ / \ \_ _| | \ \_ _| |_\ |_ _| |_ _| |_\ |_\ `.___] ||_||_|
15-
(_)(_) \/ \/|____| |____||____| |___||_____|\____||_____||_____|\____|`._____.' (_)(_)
15+
|_||_| \ /\ /_/ / \ \_ _| | \ \_ _| |_\ |_ _| |_ _| |_\ |_\ \`.___] ||_||_|
16+
(_)(_) \/ \/|____| |____||____| |___||_____|\____||_____||_____|\____|\`._____.' (_)(_)
1617
17-
EOW
18-
echo 'You are using Sentry with Python 2, which is deprecated.'
19-
echo 'Sentry 21.1 will be the last version with Python 2 support.'
20-
fi
21-
}
22-
23-
py2_warning
24-
# Run a simple command that would exit with code 0 so the calling script won't think
25-
# there was a failure in this script. (otherwise it fails when Python 2 is *NOT* detected)
26-
# as the exit code for the `grep` call will be `-1` indicating no match found.
27-
echo ''
18+
"
19+
echo '-----------------------------------------------------------'
20+
echo 'You are using Sentry with Python 2, which is deprecated.'
21+
echo 'Sentry 21.1 will be the last version with Python 2 support.'
22+
fi

0 commit comments

Comments
 (0)