Warn if running too-new, untested Python version. Break out version reqs into separate file for more visibility.
This commit is contained in:
parent
2b328defcc
commit
8ac0ce1905
2 changed files with 45 additions and 5 deletions
10
evennia/VERSION_REQS.txt
Normal file
10
evennia/VERSION_REQS.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# These are read by the evennia/server/evennia_launcher.py to give more explicit
|
||||||
|
# errors/warnings when trying to run Evennia with wrong/unexpected versions (this happens
|
||||||
|
# when people upgrade outside regular channels). This file only supports lines of
|
||||||
|
# `value = number` and only specific names supported by the handler.
|
||||||
|
|
||||||
|
PYTHON_MIN = 3.9
|
||||||
|
PYTHON_MAX_TESTED = 3.11
|
||||||
|
TWISTED_MIN = 20.3.0
|
||||||
|
DJANGO_MIN = 4.0.2
|
||||||
|
DJANGO_LT = 4.1
|
||||||
|
|
@ -90,11 +90,28 @@ SSHUTD = chr(17) # server-only shutdown
|
||||||
PSTATUS = chr(18) # ping server or portal status
|
PSTATUS = chr(18) # ping server or portal status
|
||||||
SRESET = chr(19) # shutdown server in reset mode
|
SRESET = chr(19) # shutdown server in reset mode
|
||||||
|
|
||||||
# requirements
|
# live version requirement checks (from VERSION_REQS.txt file)
|
||||||
PYTHON_MIN = "3.9"
|
PYTHON_MIN = None
|
||||||
TWISTED_MIN = "20.3.0"
|
PYTHON_MAX_TESTED = None
|
||||||
DJANGO_MIN = "4.0.2"
|
TWISTED_MIN = None
|
||||||
DJANGO_LT = "4.1"
|
DJANGO_MIN = None
|
||||||
|
DJANGO_LT = None
|
||||||
|
|
||||||
|
with open(os.path.join(EVENNIA_LIB, "VERSION_REQS.txt")) as fil:
|
||||||
|
for line in fil.readlines():
|
||||||
|
if line.startswith("#") or not "=" in line:
|
||||||
|
continue
|
||||||
|
match tuple(part.strip() for part in line.split("=", 1)):
|
||||||
|
case ("PYTHON_MIN", *value):
|
||||||
|
PYTHON_MIN = value[0] if value else "0"
|
||||||
|
case ("PYTHON_MAX_TESTED", *value):
|
||||||
|
PYTHON_MAX_TESTED = value[0] if value else "100"
|
||||||
|
case ("TWISTED_MIN", *value):
|
||||||
|
TWISTED_MIN = value[0] if value else "0"
|
||||||
|
case ("DJANGO_MIN", *value):
|
||||||
|
DJANGO_MIN = value[0] if value else "0"
|
||||||
|
case ("DJANGO_LT", *value):
|
||||||
|
DJANGO_LT = value[0] if value else "100"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sys.path[1] = EVENNIA_ROOT
|
sys.path[1] = EVENNIA_ROOT
|
||||||
|
|
@ -364,6 +381,12 @@ ERROR_PYTHON_VERSION = """
|
||||||
{python_min} or higher.
|
{python_min} or higher.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
WARNING_PYTHON_MAX_TESTED_VERSION = """
|
||||||
|
WARNING: Python {pversion} used. Evennia is only tested with Python
|
||||||
|
versions {python_min} to {python_max_tested}. If you see unexpected errors, try
|
||||||
|
reinstalling with a tested Python version instead.
|
||||||
|
"""
|
||||||
|
|
||||||
ERROR_TWISTED_VERSION = """
|
ERROR_TWISTED_VERSION = """
|
||||||
ERROR: Twisted {tversion} found. Evennia requires
|
ERROR: Twisted {tversion} found. Evennia requires
|
||||||
version {twisted_min} or higher.
|
version {twisted_min} or higher.
|
||||||
|
|
@ -1262,6 +1285,13 @@ def check_main_evennia_dependencies():
|
||||||
if LooseVersion(pversion) < LooseVersion(PYTHON_MIN):
|
if LooseVersion(pversion) < LooseVersion(PYTHON_MIN):
|
||||||
print(ERROR_PYTHON_VERSION.format(pversion=pversion, python_min=PYTHON_MIN))
|
print(ERROR_PYTHON_VERSION.format(pversion=pversion, python_min=PYTHON_MIN))
|
||||||
error = True
|
error = True
|
||||||
|
if LooseVersion(pversion) > LooseVersion(PYTHON_MAX_TESTED):
|
||||||
|
print(
|
||||||
|
WARNING_PYTHON_MAX_TESTED_VERSION.format(
|
||||||
|
pversion=pversion, python_min=PYTHON_MIN, python_max_tested=PYTHON_MAX_TESTED
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# Twisted
|
# Twisted
|
||||||
try:
|
try:
|
||||||
import twisted
|
import twisted
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue