Files
galaxy/scripts/check_python.py
T

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

33 lines
903 B
Python
Raw 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
2015-07-13 20:13:28 +01:00
import sys
2015-07-13 20:13:28 +01:00
def check_python():
2023-10-31 18:51:06 +01:00
if sys.version_info[:2] >= (3, 8): # noqa: UP036
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])
msg = (
"""\
ERROR: Your Python version is: %s
2023-10-31 18:51:06 +01:00
Galaxy is currently supported on Python >=3.8 .
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
on how to force Galaxy to use a different version."""
% version_string
2022-02-02 15:26:21 -05:00
)
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)