Files
galaxy/scripts/check_python.py
T
Michael R. Crusoe c00967cca4 Python 3.8 as new minimum version
Fixes: https://github.com/galaxyproject/galaxy/issues/16394

Also upgrade code to Python 3.8 syntax with:

```
ack --type=python -f | grep -v '^lib/galaxy/schema/bco/\|^lib/galaxy/schema/drs/\|lib/tool_shed_client/schema/trs.*.py\|^tools/\|^.venv/\|^.tox/' | grep -v '^lib/galaxy/files/sources/\|^lib/galaxy/job_metrics/\|^lib/galaxy/objectstore/\|^lib/galaxy/tool_util/\|^lib/galaxy/util/' | xargs pyupgrade --py38-plus
```
2023-11-26 18:34:09 +00:00

34 lines
903 B
Python

"""
If the current installed Python version is not supported, prints an error
message to stderr and returns 1
"""
import sys
def check_python():
if sys.version_info[:2] >= (3, 8): # noqa: UP036
# supported
return
else:
version_string = ".".join(str(_) for _ in sys.version_info[:3])
msg = (
"""\
ERROR: Your Python version is: %s
Galaxy is currently supported on Python >=3.8 .
To run Galaxy, please install a supported Python version.
If a supported version is already installed but is not your default,
https://docs.galaxyproject.org/en/latest/admin/python.html contains instructions
on how to force Galaxy to use a different version."""
% version_string
)
print(msg, file=sys.stderr)
raise Exception(msg)
if __name__ == "__main__":
try:
check_python()
except Exception:
sys.exit(1)