Skip to content
Snippets Groups Projects
Commit b4f85647 authored by Simon McVittie's avatar Simon McVittie
Browse files

scripts: Assert that we have the desired Python version


In Steam Runtime 1 'scout' and Steam Runtime 1½ 'heavy' SDK
environments, we have a backport of python3.5 in order to run Meson,
and meson.build automatically selects it if available.

In newer environments like a developer's laptop, we expect to have a
strictly newer Python version, like the python3.7 in Debian 10.

One notable exception is that we only require Python 3.4+ for scripts
that are meant to run on test machines or on non-developer Steam users'
systems, which right now just means the test UI. This version was chosen
because SteamOS 2 'brewmaster' and Ubuntu 14.04 'trusty' both have 3.4.

Ubuntu 12.04 'precise' only has 3.2, but the Steam client doesn't
actually work on 12.04 any more for orthogonal reasons.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 80f1bb77
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ import os ...@@ -30,6 +30,7 @@ import os
import re import re
import shutil import shutil
import subprocess import subprocess
import sys
import tempfile import tempfile
try: try:
...@@ -659,6 +660,9 @@ def main(): ...@@ -659,6 +660,9 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
assert sys.version_info >= (3, 5), \
'Python 3.5+ is required (configure with -Dpython=python3.5 ' \
'if necessary)'
logging.basicConfig() logging.basicConfig()
main() main()
......
...@@ -24,6 +24,7 @@ Multi-Arch: foreign ...@@ -24,6 +24,7 @@ Multi-Arch: foreign
Depends: Depends:
bubblewrap, bubblewrap,
libcapsule-tools-relocatable, libcapsule-tools-relocatable,
python3 (>= 3.5) | python3.5,
steam-runtime-tools-bin, steam-runtime-tools-bin,
${misc:Depends}, ${misc:Depends},
${shlibs:Depends}, ${shlibs:Depends},
......
...@@ -153,7 +153,7 @@ build:scout: ...@@ -153,7 +153,7 @@ build:scout:
--archive "$(pwd)/_build" \ --archive "$(pwd)/_build" \
${CI_ALLOW_MISSING_SOURCES:+--allow-missing-sources} \ ${CI_ALLOW_MISSING_SOURCES:+--allow-missing-sources} \
${NULL+} ${NULL+}
prove -v ./tests/relocatable-install.py :: \ prove -epython3.5 -v ./tests/relocatable-install.py :: \
"$(pwd)/_build/relocatable-install" "$(pwd)/_build/relocatable-install"
fi fi
......
...@@ -20,7 +20,13 @@ apt-get -y install \ ...@@ -20,7 +20,13 @@ apt-get -y install \
--output "${AUTOPKGTEST_TMP}/relocatable-install" \ --output "${AUTOPKGTEST_TMP}/relocatable-install" \
--archive "${AUTOPKGTEST_TMP}" --archive "${AUTOPKGTEST_TMP}"
./tests/relocatable-install.py "${AUTOPKGTEST_TMP}/relocatable-install" if command -v python3.5; then
PYTHON=python3.5
else
PYTHON=python3
fi
"$PYTHON" ./tests/relocatable-install.py "${AUTOPKGTEST_TMP}/relocatable-install"
for archive in "${AUTOPKGTEST_TMP}"/*.tar.*; do for archive in "${AUTOPKGTEST_TMP}"/*.tar.*; do
echo "==== $(basename "$archive") ====" echo "==== $(basename "$archive") ===="
......
...@@ -43,6 +43,8 @@ from gi.repository import Gtk ...@@ -43,6 +43,8 @@ from gi.repository import Gtk
logger = logging.getLogger('pressure-vessel-test-ui') logger = logging.getLogger('pressure-vessel-test-ui')
assert sys.version_info >= (3, 4), 'Python 3.4+ is required for this script'
def tristate_environment(name): def tristate_environment(name):
# type: (str) -> typing.Optional[bool] # type: (str) -> typing.Optional[bool]
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import os import os
import subprocess import subprocess
import sys
import tempfile import tempfile
import unittest import unittest
...@@ -121,6 +122,10 @@ class TestCheapCopy(unittest.TestCase): ...@@ -121,6 +122,10 @@ class TestCheapCopy(unittest.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
assert sys.version_info >= (3, 5), \
'Python 3.5+ is required (configure with -Dpython=python3.5 ' \
'if necessary)'
try: try:
from tap.runner import TAPTestRunner from tap.runner import TAPTestRunner
except ImportError: except ImportError:
......
...@@ -232,6 +232,10 @@ def main(): ...@@ -232,6 +232,10 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
assert sys.version_info >= (3, 5), \
'Python 3.5+ is required (configure with -Dpython=python3.5 ' \
'if necessary)'
main() main()
# vi: set sw=4 sts=4 et: # vi: set sw=4 sts=4 et:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment