Add support for latest Twisted and Python 3.9

This commit is contained in:
Griatch 2021-05-15 23:46:34 +02:00
parent 63009a2a65
commit a4f5ae2c96
12 changed files with 85 additions and 82 deletions

View file

@ -25,8 +25,8 @@ more detailed instructions for your platform.
1. Install Python, GIT and python-virtualenv. Start a Console/Terminal. 1. Install Python, GIT and python-virtualenv. Start a Console/Terminal.
2. `cd` to some place you want to do your development (like a folder 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). `/home/anna/muddev/` on Linux or a folder in your personal user directory on Windows).
3. `git clone https://github.com/evennia/evennia.git` 3. `git clone https://github.com/evennia/evennia.git` (a new folder `evennia` is created)
4. `virtualenv evenv` 4. `python -m venv evenv` (a new folder `evenv` is created)
5. `source evenv/bin/activate` (Linux, Mac), `evenv\Scripts\activate` (Windows) 5. `source evenv/bin/activate` (Linux, Mac), `evenv\Scripts\activate` (Windows)
6. `pip install -e evennia` 6. `pip install -e evennia`
7. `evennia --init mygame` 7. `evennia --init mygame`
@ -48,7 +48,7 @@ everything in the following sections.
- Windows (Vista, Win7, Win8, Win10) - Windows (Vista, Win7, Win8, Win10)
- Mac OSX (>=10.5 recommended) - Mac OSX (>=10.5 recommended)
- [Python](http://www.python.org) (v3.7, 3.8 are tested) - [Python](http://www.python.org) (v3.7, 3.8 and 3.9 are tested)
- [virtualenv](http://pypi.python.org/pypi/virtualenv) for making isolated - [virtualenv](http://pypi.python.org/pypi/virtualenv) for making isolated
Python environments. Installed with `pip install virtualenv`. Python environments. Installed with `pip install virtualenv`.

View file

@ -6,7 +6,7 @@ in complete isolation if you want, without needing any access to the internet.
## Installation ## Installation
Evennia requires Python3.7+. As with most Python packages, using a Evennia supports Python 3.7 to 3.9. As with most Python packages, using a
[virtualenv](../Glossary#virtualenv) is recommended in order to keep your [virtualenv](../Glossary#virtualenv) is recommended in order to keep your
installation independent from the system libraries. It's _not_ recommended installation independent from the system libraries. It's _not_ recommended
to install Evennia as superuser. to install Evennia as superuser.
@ -20,9 +20,10 @@ to install Evennia as superuser.
Make sure the `evennia` command works. Use `evennia -h` for usage help (or read on). Make sure the `evennia` command works. Use `evennia -h` for usage help (or read on).
If you are having trouble, want to install in some other way (like with Docker) or want to contribute to If you are having trouble, want to install in some other way (like with Docker)
Evennia itself, check out the [Extended Installation instructions](./Extended-Installation). or want to contribute to Evennia itself, check out the [Extended Installation
It also has a [troubleshooting section](./Extended-Installation#Troubleshooting) for different operating instructions](./Extended-Installation). It also has a [troubleshooting
section](./Extended-Installation#Troubleshooting) for different operating
systems. systems.

View file

@ -932,7 +932,8 @@ class CmdAbout(COMMAND_DEFAULT_CLASS):
|wLicence|n https://opensource.org/licenses/BSD-3-Clause |wLicence|n https://opensource.org/licenses/BSD-3-Clause
|wWeb|n http://www.evennia.com |wWeb|n http://www.evennia.com
|wIrc|n #evennia on irc.freenode.net:6667 |wIrc|n #evennia on irc.freenode.net:6667
|wForum|n http://www.evennia.com/discussions |wDiscord|n https://discord.gg/SVCkd4cY3q
|wForum|n https://github.com/evennia/evennia/discussions
|wMaintainer|n (2010-) Griatch (griatch AT gmail DOT com) |wMaintainer|n (2010-) Griatch (griatch AT gmail DOT com)
|wMaintainer|n (2006-10) Greg Taylor |wMaintainer|n (2006-10) Greg Taylor

View file

@ -8,8 +8,13 @@ from django.utils.timezone import is_aware, utc
import datetime, gzip, pickle, threading import datetime, gzip, pickle, threading
from botocore.exceptions import ClientError _SKIP = False
from evennia.contrib.awsstorage import aws_s3_cdn as s3boto3 try:
from botocore.exceptions import ClientError
from evennia.contrib.awsstorage import aws_s3_cdn as s3boto3
except ImportError:
_SKIP = True
try: try:
from django.utils.six.moves.urllib import parse as urlparse from django.utils.six.moves.urllib import parse as urlparse
@ -23,12 +28,14 @@ except ImportError: # Python 3.2 and below
import mock import mock
@skipIf(_SKIP, "botocore not installed")
class S3Boto3TestCase(TestCase): class S3Boto3TestCase(TestCase):
def setUp(self): def setUp(self):
self.storage = s3boto3.S3Boto3Storage(access_key="foo", secret_key="bar") self.storage = s3boto3.S3Boto3Storage(access_key="foo", secret_key="bar")
self.storage._connections.connection = mock.MagicMock() self.storage._connections.connection = mock.MagicMock()
@skipIf(_SKIP, "botocore not installed")
class S3Boto3StorageTests(S3Boto3TestCase): class S3Boto3StorageTests(S3Boto3TestCase):
def test_clean_name(self): def test_clean_name(self):
""" """

View file

@ -15,10 +15,9 @@ This protocol is implemented by the telnet protocol importing
mccp_compress and calling it from its write methods. mccp_compress and calling it from its write methods.
""" """
import zlib import zlib
from twisted.python.compat import _bytesChr as chr
# negotiations for v1 and v2 of the protocol # negotiations for v1 and v2 of the protocol
MCCP = chr(86) # b"\x56" MCCP = bytes([86]) # b"\x56"
FLUSH = zlib.Z_SYNC_FLUSH FLUSH = zlib.Z_SYNC_FLUSH
@ -38,7 +37,7 @@ def mccp_compress(protocol, data):
return data return data
class Mccp(object): class Mccp:
""" """
Implements the MCCP protocol. Add this to a Implements the MCCP protocol. Add this to a
variable on the telnet protocol to set it up. variable on the telnet protocol to set it up.

View file

@ -12,17 +12,16 @@ active players and so on.
""" """
from django.conf import settings from django.conf import settings
from evennia.utils import utils from evennia.utils import utils
from twisted.python.compat import _bytesChr as bchr
MSSP = bchr(70) # b"\x46" MSSP = bytes([70]) # b"\x46"
MSSP_VAR = bchr(1) # b"\x01" MSSP_VAR = bytes([1]) # b"\x01"
MSSP_VAL = bchr(2) # b"\x02" MSSP_VAL = bytes([2]) # b"\x02"
# try to get the customized mssp info, if it exists. # try to get the customized mssp info, if it exists.
MSSPTable_CUSTOM = utils.variable_from_module(settings.MSSP_META_MODULE, "MSSPTable", default={}) MSSPTable_CUSTOM = utils.variable_from_module(settings.MSSP_META_MODULE, "MSSPTable", default={})
class Mssp(object): class Mssp:
""" """
Implements the MSSP protocol. Add this to a variable on the telnet Implements the MSSP protocol. Add this to a variable on the telnet
protocol to set it up. protocol to set it up.

View file

@ -14,12 +14,11 @@ http://www.gammon.com.au/mushclient/addingservermxp.htm
""" """
import re import re
from twisted.python.compat import _bytesChr as bchr
LINKS_SUB = re.compile(r"\|lc(.*?)\|lt(.*?)\|le", re.DOTALL) LINKS_SUB = re.compile(r"\|lc(.*?)\|lt(.*?)\|le", re.DOTALL)
# MXP Telnet option # MXP Telnet option
MXP = bchr(91) # b"\x5b" MXP = bytes([91]) # b"\x5b"
MXP_TEMPSECURE = "\x1B[4z" MXP_TEMPSECURE = "\x1B[4z"
MXP_SEND = MXP_TEMPSECURE + '<SEND HREF="\\1">' + "\\2" + MXP_TEMPSECURE + "</SEND>" MXP_SEND = MXP_TEMPSECURE + '<SEND HREF="\\1">' + "\\2" + MXP_TEMPSECURE + "</SEND>"
@ -42,7 +41,7 @@ def mxp_parse(text):
return text return text
class Mxp(object): class Mxp:
""" """
Implements the MXP protocol. Implements the MXP protocol.

View file

@ -11,10 +11,10 @@ client and update it when the size changes
""" """
from codecs import encode as codecs_encode from codecs import encode as codecs_encode
from django.conf import settings from django.conf import settings
from twisted.python.compat import _bytesChr as bchr
NAWS = bchr(31) # b"\x1f" NAWS = bytes([31]) # b"\x1f"
IS = bchr(0) # b"\x00" IS = bytes([0]) # b"\x00"
# default taken from telnet specification # default taken from telnet specification
DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
DEFAULT_HEIGHT = settings.CLIENT_DEFAULT_HEIGHT DEFAULT_HEIGHT = settings.CLIENT_DEFAULT_HEIGHT
@ -22,7 +22,7 @@ DEFAULT_HEIGHT = settings.CLIENT_DEFAULT_HEIGHT
# try to get the customized mssp info, if it exists. # try to get the customized mssp info, if it exists.
class Naws(object): class Naws:
""" """
Implements the NAWS protocol. Add this to a variable on the telnet Implements the NAWS protocol. Add this to a variable on the telnet
protocol to set it up. protocol to set it up.

View file

@ -13,16 +13,15 @@ It is set as the NOGOAHEAD protocol_flag option.
http://www.faqs.org/rfcs/rfc858.html http://www.faqs.org/rfcs/rfc858.html
""" """
from twisted.python.compat import _bytesChr as bchr
SUPPRESS_GA = bchr(3) # b"\x03" SUPPRESS_GA = bytes([3]) # b"\x03"
# default taken from telnet specification # default taken from telnet specification
# try to get the customized mssp info, if it exists. # try to get the customized mssp info, if it exists.
class SuppressGA(object): class SuppressGA:
""" """
Implements the SUPRESS-GO-AHEAD protocol. Add this to a variable on the telnet Implements the SUPRESS-GO-AHEAD protocol. Add this to a variable on the telnet
protocol to set it up. protocol to set it up.

View file

@ -26,23 +26,22 @@ This implements the following telnet OOB communication protocols:
import re import re
import json import json
from evennia.utils.utils import is_iter from evennia.utils.utils import is_iter
from twisted.python.compat import _bytesChr as bchr
# General Telnet # General Telnet
from twisted.conch.telnet import IAC, SB, SE from twisted.conch.telnet import IAC, SB, SE
# MSDP-relevant telnet cmd/opt-codes # MSDP-relevant telnet cmd/opt-codes
MSDP = bchr(69) MSDP = bytes([69])
MSDP_VAR = bchr(1) MSDP_VAR = bytes([1])
MSDP_VAL = bchr(2) MSDP_VAL = bytes([2])
MSDP_TABLE_OPEN = bchr(3) MSDP_TABLE_OPEN = bytes([3])
MSDP_TABLE_CLOSE = bchr(4) MSDP_TABLE_CLOSE = bytes([4])
MSDP_ARRAY_OPEN = bchr(5) MSDP_ARRAY_OPEN = bytes([5])
MSDP_ARRAY_CLOSE = bchr(6) MSDP_ARRAY_CLOSE = bytes([6])
# GMCP # GMCP
GMCP = bchr(201) GMCP = bytes([201])
# pre-compiled regexes # pre-compiled regexes
@ -69,7 +68,7 @@ EVENNIA_TO_GMCP = {
# MSDP/GMCP communication handler # MSDP/GMCP communication handler
class TelnetOOB(object): class TelnetOOB:
""" """
Implements the MSDP and GMCP protocols. Implements the MSDP and GMCP protocols.
""" """

View file

@ -9,13 +9,13 @@ etc. If the client does not support TTYPE, this will be ignored.
All data will be stored on the protocol's protocol_flags dictionary, All data will be stored on the protocol's protocol_flags dictionary,
under the 'TTYPE' key. under the 'TTYPE' key.
""" """
from twisted.python.compat import _bytesChr as bchr
# telnet option codes # telnet option codes
TTYPE = bchr(24) # b"\x18" TTYPE = bytes([24]) # b"\x18"
IS = bchr(0) # b"\x00" IS = bytes([0]) # b"\x00"
SEND = bchr(1) # b"\x01" SEND = bytes([1]) # b"\x01"
# terminal capabilities and their codes # terminal capabilities and their codes
MTTS = [ MTTS = [
@ -30,7 +30,7 @@ MTTS = [
] ]
class Ttype(object): class Ttype:
""" """
Handles ttype negotiations. Called and initiated by the Handles ttype negotiations. Called and initiated by the
telnet protocol. telnet protocol.

View file

@ -3,10 +3,9 @@
# general # general
attrs >= 19.2.0 attrs >= 19.2.0
django >= 3.2, < 3.3 django >= 3.2, < 3.3
twisted >= 20.3.0, < 21.0.0 twisted >= 20.3.0, < 22.0.0
pytz pytz
djangorestframework >= 3.10.3, < 3.12 djangorestframework >= 3.10.3, < 3.12
# django-filter >= 2.2.0, < 2.3
django-filter == 2.4 django-filter == 2.4
django-sekizai == 2.0 django-sekizai == 2.0
inflect >= 5.2.0 inflect >= 5.2.0