container.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. set -eu
  3. python=
  4. for c in pypy3 pypy python3 python; do
  5. if [ -x "/usr/local/bin/$c" ]; then
  6. python="/usr/local/bin/$c"
  7. break
  8. fi
  9. done
  10. if [ -z "$python" ]; then
  11. echo >&2 'unable to run Hy test -- seems this image does not contain Python?'
  12. exit 1
  13. fi
  14. # Hy is complicated, and uses Python's internal AST representation directly, and thus Hy releases usually lag behind a little on major Python releases (and we don't want that to gum up our tests)
  15. # see https://github.com/hylang/hy/issues/1111 for example breakage
  16. # also, it doesn't always support older (still supported) Python versions; https://github.com/hylang/hy/pull/2176 (3.6 support removal)
  17. if ! "$python" -c 'import sys; exit((sys.version_info[0] == 3 and (sys.version_info[1] >= 11 or sys.version_info[1] <= 6)) or sys.version_info[0] > 3 or sys.version_info[0] == 2)'; then
  18. echo >&2 'skipping Hy test -- not allowed on Python 3.11+ (yet!), or on Python 3.6 or lower'
  19. # cheaters gunna cheat
  20. cat expected-std-out.txt
  21. exit
  22. fi
  23. # ensure pip does not complain about a new version being available
  24. export PIP_DISABLE_PIP_VERSION_CHECK=1
  25. # or that a new version will no longer work with this python version
  26. export PIP_NO_PYTHON_VERSION_WARNING=1
  27. # https://pypi.org/project/hy/#history
  28. # https://pypi.org/project/hyrule/#history
  29. pip install -q 'hy==0.24.0' 'hyrule==0.2'
  30. hy ./container.hy