Files
galaxy/scripts/check_python.py
T

30 lines
852 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():
if sys.version_info[:2] >= (3, 7):
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
Galaxy is currently supported on Python >=3.7 .
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
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)