Add support for Python3.11

This commit is contained in:
Griatch 2022-11-15 23:50:08 +01:00
parent c62bda9d77
commit 544638bf42
9 changed files with 30 additions and 28 deletions

View file

@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10']
python-version: ['3.9', '3.10', '3.11']
TESTING_DB: ['sqlite3', 'postgresql', 'mysql']
steps:

View file

@ -19,11 +19,11 @@ the 0.9.5 version. To install 1.0-dev, you need to add a step `git checkout deve
3 and 4 below.
```
1. Install Python, GIT and python-virtualenv. Start a Console/Terminal.
1. Install Python and GIT. Start a Console/Terminal.
2. `cd` to some place you want to do your development (like a folder
`/home/anna/muddev/` on Linux or a folder in your personal user directory on Windows).
3. `git clone https://github.com/evennia/evennia.git` (a new folder `evennia` is created)
4. `python3.10 -m venv evenv` (a new folder `evenv` is created)
4. `python3.11 -m venv evenv` (a new folder `evenv` is created)
5. `source evenv/bin/activate` (Linux, Mac), `evenv\Scripts\activate` (Windows)
6. `pip install -e evennia`
7. `evennia --init mygame`
@ -42,7 +42,7 @@ install the requirements:
```
sudo apt-get update
sudo apt-get install python3.10 python3.10-venv python3.10-dev gcc
sudo apt-get install python3.11 python3.11-venv python3.11-dev gcc
```
You should make sure to *not* be `root` after this step, running as `root` is a
security risk. Now create a folder where you want to do all your Evennia

View file

@ -4,7 +4,7 @@
# `value = number` and only specific names supported by the handler.
PYTHON_MIN = 3.9
PYTHON_MAX_TESTED = 3.11
PYTHON_MAX_TESTED = 3.11.0.0
TWISTED_MIN = 20.3.0
DJANGO_MIN = 4.0.2
DJANGO_LT = 4.1
DJANGO_MAX_TESTED = 4.1

View file

@ -3460,7 +3460,7 @@ class CmdScripts(COMMAND_DEFAULT_CLASS):
if not scripts:
scripts = ScriptDB.objects.filter(db_obj=obj).exclude(
db_typeclass_paths__in=self.hide_script_paths
db_typeclass_path__in=self.hide_script_paths
)
if scripts.count() > 1:

View file

@ -122,7 +122,7 @@ heavily-documented code below.
"""
from inspect import getargspec
from inspect import getfullargspec
from textwrap import dedent
from django.conf import settings
@ -209,9 +209,9 @@ def _call_or_get(value, menu=None, choice=None, string=None, obj=None, caller=No
if callable(value):
# Check the function arguments
kwargs = {}
spec = getargspec(value)
spec = getfullargspec(value)
args = spec.args
if spec.keywords:
if spec.varkw:
kwargs.update(dict(menu=menu, choice=choice, string=string, obj=obj, caller=caller))
else:
if "menu" in args:
@ -292,8 +292,9 @@ def menu_quit(caller, menu):
"""
if caller is None or menu is None:
log_err(
"The function `menu_quit` was called with missing "
"arguments: caller={}, menu={}".format(caller, menu)
"The function `menu_quit` was called with missing arguments: caller={}, menu={}".format(
caller, menu
)
)
if caller.cmdset.has(BuildingMenuCmdSet):
@ -835,8 +836,9 @@ class BuildingMenu:
if key and key in self.cmds:
raise ValueError(
"A conflict exists between {} and {}, both use "
"key or alias {}".format(self.cmds[key], title, repr(key))
"A conflict exists between {} and {}, both use key or alias {}".format(
self.cmds[key], title, repr(key)
)
)
if attr:

View file

@ -188,7 +188,7 @@ class RandomStringGenerator:
"""
self.total = 1
self.elements = []
tree = re.sre_parse.parse(regex).data
tree = re._parser.parse(regex).data # note - sre_parse removed in py3.11
# `tree` contains a list of elements in the regular expression
for element in tree:
# `element` is also a list, the first element is a string

View file

@ -95,7 +95,7 @@ PYTHON_MIN = None
PYTHON_MAX_TESTED = None
TWISTED_MIN = None
DJANGO_MIN = None
DJANGO_LT = None
DJANGO_MAX_TESTED = None
with open(os.path.join(EVENNIA_LIB, "VERSION_REQS.txt")) as fil:
for line in fil.readlines():
@ -110,8 +110,8 @@ with open(os.path.join(EVENNIA_LIB, "VERSION_REQS.txt")) as fil:
TWISTED_MIN = value[0] if value else "0"
elif key == "DJANGO_MIN":
DJANGO_MIN = value[0] if value else "0"
elif key == "DJANGO_LT":
DJANGO_LT = value[0] if value else "100"
elif key == "DJANGO_MAX_TESTED":
DJANGO_MAX_TESTED = value[0] if value else "100"
try:
sys.path[1] = EVENNIA_ROOT
@ -1307,12 +1307,12 @@ def check_main_evennia_dependencies():
if LooseVersion(dversion) < LooseVersion(DJANGO_MIN):
print(
ERROR_DJANGO_MIN.format(
dversion=dversion_main, django_min=DJANGO_MIN, django_lt=DJANGO_LT
dversion=dversion_main, django_min=DJANGO_MIN, django_lt=DJANGO_MAX_TESTED
)
)
error = True
elif LooseVersion(DJANGO_LT) <= LooseVersion(dversion_main):
print(NOTE_DJANGO_NEW.format(dversion=dversion_main, django_rec=DJANGO_LT))
elif LooseVersion(DJANGO_MAX_TESTED) <= LooseVersion(dversion_main):
print(NOTE_DJANGO_NEW.format(dversion=dversion_main, django_rec=DJANGO_MAX_TESTED))
except ImportError:
print(ERROR_NODJANGO)
error = True

View file

@ -266,7 +266,7 @@ import inspect
import re
from ast import literal_eval
from fnmatch import fnmatch
from inspect import getargspec, isfunction
from inspect import getfullargspec, isfunction
from math import ceil
from django.conf import settings
@ -741,10 +741,10 @@ class EvMenu:
"""
try:
try:
nargs = len(getargspec(callback).args)
nargs = len(getfullargspec(callback).args)
except TypeError:
raise EvMenuError("Callable {} doesn't accept any arguments!".format(callback))
supports_kwargs = bool(getargspec(callback).keywords)
supports_kwargs = bool(getfullargspec(callback).varkw)
if nargs <= 0:
raise EvMenuError("Callable {} doesn't accept any arguments!".format(callback))
@ -1285,7 +1285,7 @@ def list_node(option_generator, select=None, pagesize=10):
else:
if callable(select):
try:
if bool(getargspec(select).keywords):
if bool(getfullargspec(select).varkw):
return select(
caller, selection, available_choices=available_choices, **kwargs
)
@ -1368,7 +1368,7 @@ def list_node(option_generator, select=None, pagesize=10):
# add data from the decorated node
decorated_options = []
supports_kwargs = bool(getargspec(func).keywords)
supports_kwargs = bool(getfullargspec(func).varkw)
try:
if supports_kwargs:
text, decorated_options = func(caller, raw_string, **kwargs)

View file

@ -21,7 +21,7 @@ ipython >= 7.19.0
django-extensions >= 3.1.0
# xyzroom contrib
scipy<1.9
scipy == 1.9.3
# Git contrib
gitpython >= 3.1.27
gitpython >= 3.1.27