Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1.1 KiB
Python
Raw Permalink Normal View History

2012-08-03 13:31:48 -04:00
"""
2018-01-24 12:31:44 +01:00
If the current installed Python version is not supported, prints an error
2012-08-03 13:31:48 -04:00
message to stderr and returns 1
"""
2016-11-23 18:04:33 +00:00
2026-11-15 20:26:49 +00:00
from __future__ import print_function # noqa: UP010
2015-07-13 20:13:28 +01:00
import sys
2026-11-15 20:26:49 +00:00
MIN_VERSION_TUPLE = (3, 11)
2025-02-05 09:17:29 +00:00
2015-07-13 20:13:28 +01:00
def check_python():
2025-02-05 09:17:29 +00:00
if sys.version_info[:2] >= MIN_VERSION_TUPLE:
2018-01-24 12:31:44 +01:00
# supported
return
else:
2020-02-07 20:01:42 +00:00
version_string = ".".join(str(_) for _ in sys.version_info[:3])
2025-02-05 09:17:29 +00:00
min_version_string = ".".join(str(_) for _ in MIN_VERSION_TUPLE)
2026-11-15 20:26:49 +00:00
msg = """ERROR: Your Python version is: {}
Galaxy is currently supported on Python >={} .
2020-02-07 20:01:42 +00:00
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
2026-11-15 20:26:49 +00:00
on how to force Galaxy to use a different version.""".format( # noqa: UP032
version_string,
min_version_string,
)
print(msg, file=sys.stderr)
2018-01-24 12:31:44 +01:00
raise Exception(msg)
2016-11-14 21:12:14 +00:00
if __name__ == "__main__":
try:
check_python()
2018-10-24 23:21:58 +01:00
except Exception:
2018-01-24 12:31:44 +01:00
sys.exit(1)