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.
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`
4. `virtualenv evenv`
3. `git clone https://github.com/evennia/evennia.git` (a new folder `evennia` is created)
4. `python -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`
@ -48,7 +48,7 @@ everything in the following sections.
- Windows (Vista, Win7, Win8, Win10)
- 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
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
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
installation independent from the system libraries. It's _not_ recommended
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).
If you are having trouble, want to install in some other way (like with Docker) or want to contribute to
Evennia itself, check out the [Extended Installation instructions](./Extended-Installation).
It also has a [troubleshooting section](./Extended-Installation#Troubleshooting) for different operating
If you are having trouble, want to install in some other way (like with Docker)
or want to contribute to Evennia itself, check out the [Extended Installation
instructions](./Extended-Installation). It also has a [troubleshooting
section](./Extended-Installation#Troubleshooting) for different operating
systems.

View file

@ -932,7 +932,8 @@ class CmdAbout(COMMAND_DEFAULT_CLASS):
|wLicence|n https://opensource.org/licenses/BSD-3-Clause
|wWeb|n http://www.evennia.com
|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 (2006-10) Greg Taylor

View file

@ -8,8 +8,13 @@ from django.utils.timezone import is_aware, utc
import datetime, gzip, pickle, threading
_SKIP = False
try:
from botocore.exceptions import ClientError
from evennia.contrib.awsstorage import aws_s3_cdn as s3boto3
except ImportError:
_SKIP = True
try:
from django.utils.six.moves.urllib import parse as urlparse
@ -23,12 +28,14 @@ except ImportError: # Python 3.2 and below
import mock
@skipIf(_SKIP, "botocore not installed")
class S3Boto3TestCase(TestCase):
def setUp(self):
self.storage = s3boto3.S3Boto3Storage(access_key="foo", secret_key="bar")
self.storage._connections.connection = mock.MagicMock()
@skipIf(_SKIP, "botocore not installed")
class S3Boto3StorageTests(S3Boto3TestCase):
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.
"""
import zlib
from twisted.python.compat import _bytesChr as chr
# negotiations for v1 and v2 of the protocol
MCCP = chr(86) # b"\x56"
MCCP = bytes([86]) # b"\x56"
FLUSH = zlib.Z_SYNC_FLUSH
@ -38,7 +37,7 @@ def mccp_compress(protocol, data):
return data
class Mccp(object):
class Mccp:
"""
Implements the MCCP protocol. Add this to a
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 evennia.utils import utils
from twisted.python.compat import _bytesChr as bchr
MSSP = bchr(70) # b"\x46"
MSSP_VAR = bchr(1) # b"\x01"
MSSP_VAL = bchr(2) # b"\x02"
MSSP = bytes([70]) # b"\x46"
MSSP_VAR = bytes([1]) # b"\x01"
MSSP_VAL = bytes([2]) # b"\x02"
# try to get the customized mssp info, if it exists.
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
protocol to set it up.

View file

@ -14,12 +14,11 @@ http://www.gammon.com.au/mushclient/addingservermxp.htm
"""
import re
from twisted.python.compat import _bytesChr as bchr
LINKS_SUB = re.compile(r"\|lc(.*?)\|lt(.*?)\|le", re.DOTALL)
# MXP Telnet option
MXP = bchr(91) # b"\x5b"
MXP = bytes([91]) # b"\x5b"
MXP_TEMPSECURE = "\x1B[4z"
MXP_SEND = MXP_TEMPSECURE + '<SEND HREF="\\1">' + "\\2" + MXP_TEMPSECURE + "</SEND>"
@ -42,7 +41,7 @@ def mxp_parse(text):
return text
class Mxp(object):
class Mxp:
"""
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 django.conf import settings
from twisted.python.compat import _bytesChr as bchr
NAWS = bchr(31) # b"\x1f"
IS = bchr(0) # b"\x00"
NAWS = bytes([31]) # b"\x1f"
IS = bytes([0]) # b"\x00"
# default taken from telnet specification
DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
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.
class Naws(object):
class Naws:
"""
Implements the NAWS protocol. Add this to a variable on the telnet
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
"""
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
# 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
protocol to set it up.

View file

@ -26,23 +26,22 @@ This implements the following telnet OOB communication protocols:
import re
import json
from evennia.utils.utils import is_iter
from twisted.python.compat import _bytesChr as bchr
# General Telnet
from twisted.conch.telnet import IAC, SB, SE
# MSDP-relevant telnet cmd/opt-codes
MSDP = bchr(69)
MSDP_VAR = bchr(1)
MSDP_VAL = bchr(2)
MSDP_TABLE_OPEN = bchr(3)
MSDP_TABLE_CLOSE = bchr(4)
MSDP = bytes([69])
MSDP_VAR = bytes([1])
MSDP_VAL = bytes([2])
MSDP_TABLE_OPEN = bytes([3])
MSDP_TABLE_CLOSE = bytes([4])
MSDP_ARRAY_OPEN = bchr(5)
MSDP_ARRAY_CLOSE = bchr(6)
MSDP_ARRAY_OPEN = bytes([5])
MSDP_ARRAY_CLOSE = bytes([6])
# GMCP
GMCP = bchr(201)
GMCP = bytes([201])
# pre-compiled regexes
@ -69,7 +68,7 @@ EVENNIA_TO_GMCP = {
# MSDP/GMCP communication handler
class TelnetOOB(object):
class TelnetOOB:
"""
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,
under the 'TTYPE' key.
"""
from twisted.python.compat import _bytesChr as bchr
# telnet option codes
TTYPE = bchr(24) # b"\x18"
IS = bchr(0) # b"\x00"
SEND = bchr(1) # b"\x01"
TTYPE = bytes([24]) # b"\x18"
IS = bytes([0]) # b"\x00"
SEND = bytes([1]) # b"\x01"
# terminal capabilities and their codes
MTTS = [
@ -30,7 +30,7 @@ MTTS = [
]
class Ttype(object):
class Ttype:
"""
Handles ttype negotiations. Called and initiated by the
telnet protocol.

View file

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