-#!/usr/bin/python
+#!/usr/bin/python3
from wsgiref.handlers import format_date_time
from email.utils import parsedate
-#!/usr/bin/python
+#!/usr/bin/python3
from __future__ import print_function
-#!/usr/bin/python
+#!/usr/bin/python3
from __future__ import print_function
. $(dirname $0)/libtest.sh
-$(dirname $0)/test-webserver.sh "" "python $test_srcdir/http-utils-test-server.py 0"
+$(dirname $0)/test-webserver.sh "" "python3 $test_srcdir/http-utils-test-server.py 0"
FLATPAK_HTTP_PID=$(cat httpd-pid)
mv httpd-port httpd-port-main
port=$(cat httpd-port-main)
# Start the fake registry server
-$(dirname $0)/test-webserver.sh "" "python $test_srcdir/oci-registry-server.py 0"
+$(dirname $0)/test-webserver.sh "" "python3 $test_srcdir/oci-registry-server.py 0"
FLATPAK_HTTP_PID=$(cat httpd-pid)
mv httpd-port httpd-port-main
port=$(cat httpd-port-main)
-client="python $test_srcdir/oci-registry-client.py 127.0.0.1:$port"
+client="python3 $test_srcdir/oci-registry-client.py 127.0.0.1:$port"
setup_repo_no_add oci
set -euo pipefail
dir=$1
-cmd=${2:-python -m SimpleHTTPServer 0}
+cmd=${2:-python3 -m http.server 0}
test_tmpdir=$(pwd)
[ "$dir" != "" ] && cd ${dir}
echo >&2
# If it's non-empty, see whether it matches our regexp
if test -s ${test_tmpdir}/httpd-output.tmp; then
- sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output.tmp > ${test_tmpdir}/httpd-port
+ sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) .*,\1,' < ${test_tmpdir}/httpd-output.tmp > ${test_tmpdir}/httpd-port
if ! cmp ${test_tmpdir}/httpd-output.tmp ${test_tmpdir}/httpd-port 1>/dev/null; then
# If so, we've successfully extracted the port
break