fix: use python3 for all python invocations (#10832)

This commit is contained in:
Carlo Sala 2022-04-09 14:45:42 +02:00 committed by GitHub
commit 0818df057c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 17 additions and 17 deletions

View file

@ -8,7 +8,7 @@ fi
# If method undefined, find the first one that is installed
if [[ -z "$JSONTOOLS_METHOD" ]]; then
for JSONTOOLS_METHOD in node python ruby; do
for JSONTOOLS_METHOD in node python3 ruby; do
# If method found, break out of loop
(( $+commands[$JSONTOOLS_METHOD] )) && break
# Otherwise unset the variable
@ -45,12 +45,12 @@ case "$JSONTOOLS_METHOD" in
xargs -0 node -e "console.log(decodeURIComponent(process.argv[1]))"
}
;;
python)
python3)
function pp_json() {
python -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
python3 -c 'import sys; del sys.path[0]; import runpy; runpy._run_module_as_main("json.tool")'
}
function is_json() {
python -c '
python3 -c '
import sys; del sys.path[0];
import json
try:
@ -61,14 +61,14 @@ except ValueError:
'
}
function urlencode_json() {
python -c '
python3 -c '
import sys; del sys.path[0];
from urllib.parse import quote_plus
print(quote_plus(sys.stdin.read()))
'
}
function urldecode_json() {
python -c '
python3 -c '
import sys; del sys.path[0];
from urllib.parse import unquote_plus
print(unquote_plus(sys.stdin.read()))