mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-19 10:51:34 +08:00
- Allow specifying Python to use to create virtualenv using GALAXY_PYTHON environment variable. - Integrate Python support docs from https://galaxyproject.org/admin/python/ - Update virtualenv installation to use v16.7.9
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
"""
|
|
If the current installed Python version is not supported, prints an error
|
|
message to stderr and returns 1
|
|
"""
|
|
from __future__ import print_function
|
|
|
|
import sys
|
|
|
|
|
|
def check_python():
|
|
if sys.version_info[:2] >= (3, 5):
|
|
# supported
|
|
return
|
|
elif sys.version_info[:2] == (2, 7):
|
|
msg = """\
|
|
Galaxy support for Python 2.7 is deprecated, please consider moving to
|
|
Python >= 3.5 .
|
|
https://docs.galaxyproject.org/en/latest/admin/python.html contains instructions
|
|
on how to force Galaxy to use a different version."""
|
|
print(msg, file=sys.stderr)
|
|
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 2.7 (although deprecated) and >=3.5 .
|
|
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)
|