Эх сурвалжийг харах

Merge pull request #2569 from infosiftr/run-python-in-container

Adjust "python-hy" test's "container.sh" to use the same "find Python interpreter" logic as "run-python-in-container.sh" (so it works properly on pypy too)
yosifkit 8 жил өмнө
parent
commit
c31c198c6e

+ 14 - 1
test/tests/python-hy/container.sh

@@ -1,8 +1,21 @@
 #!/bin/sh
 set -e
 
+python=
+for c in pypy3 pypy python3 python; do
+	if command -v "$c" > /dev/null; then
+		python="$c"
+		break
+	fi
+done
+
+if [ -z "$python" ]; then
+	echo >&2 'unable to run Hy test -- seems this image does not contain Python?'
+	exit 1
+fi
+
 # Hy doesn't work on 3.6+ :(
-if ! python -c 'import sys; exit((sys.version_info[0] == 3 and sys.version_info[1] >= 6) or sys.version_info[0] > 3)'; then
+if ! "$python" -c 'import sys; exit((sys.version_info[0] == 3 and sys.version_info[1] >= 6) or sys.version_info[0] > 3)'; then
 	# TypeError: required field "is_async" missing from comprehension
 	echo >&2 'skipping Hy test -- no workie on Python 3.6+'
 	cat expected-std-out.txt # cheaters gunna cheat