mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2024-11-21 17:56:30 +01:00
Remove support for Python 2.7
This commit is contained in:
parent
3723655fa3
commit
b79f8b30eb
@ -3,8 +3,6 @@ python: 3.8
|
|||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- python: 2.7
|
|
||||||
env: TOX_ENV=py27
|
|
||||||
- python: pypy
|
- python: pypy
|
||||||
env: TOX_ENV=pypy
|
env: TOX_ENV=pypy
|
||||||
- python: 3.5
|
- python: 3.5
|
||||||
|
@ -50,7 +50,6 @@ Supported Python versions
|
|||||||
-------------------------
|
-------------------------
|
||||||
pyCraft is compatible with (at least) the following Python implementations:
|
pyCraft is compatible with (at least) the following Python implementations:
|
||||||
|
|
||||||
* Python 2.7
|
|
||||||
* Python 3.5
|
* Python 3.5
|
||||||
* Python 3.6
|
* Python 3.6
|
||||||
* Python 3.7
|
* Python 3.7
|
||||||
@ -61,7 +60,6 @@ Requirements
|
|||||||
------------
|
------------
|
||||||
- `cryptography <https://github.com/pyca/cryptography#cryptography>`_
|
- `cryptography <https://github.com/pyca/cryptography#cryptography>`_
|
||||||
- `requests <http://docs.python-requests.org/en/latest/>`_
|
- `requests <http://docs.python-requests.org/en/latest/>`_
|
||||||
- `future <http://python-future.org/>`_
|
|
||||||
|
|
||||||
The requirements are also stored in ``requirements.txt``
|
The requirements are also stored in ``requirements.txt``
|
||||||
|
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
"""
|
|
||||||
This module stores code used for making pyCraft compatible with
|
|
||||||
both Python2 and Python3 while using the same codebase.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# Raw input -> input shenangians
|
|
||||||
# example
|
|
||||||
# > from minecraft.compat import input
|
|
||||||
# > input("asd")
|
|
||||||
|
|
||||||
# Hi, I'm pylint, and sometimes I act silly, at which point my programmer
|
|
||||||
# overlords need to correct me.
|
|
||||||
|
|
||||||
# pylint: disable=undefined-variable,redefined-builtin,invalid-name
|
|
||||||
try:
|
|
||||||
input = raw_input
|
|
||||||
except NameError:
|
|
||||||
input = input
|
|
||||||
|
|
||||||
try:
|
|
||||||
unicode = unicode
|
|
||||||
except NameError:
|
|
||||||
unicode = str
|
|
||||||
# pylint: enable=undefined-variable,redefined-builtin,invalid-name
|
|
@ -1,5 +1,3 @@
|
|||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
from collections import deque
|
from collections import deque
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
import zlib
|
import zlib
|
||||||
@ -11,8 +9,6 @@ import sys
|
|||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from future.utils import raise_
|
|
||||||
|
|
||||||
from .types import VarInt
|
from .types import VarInt
|
||||||
from .packets import clientbound, serverbound
|
from .packets import clientbound, serverbound
|
||||||
from . import packets
|
from . import packets
|
||||||
@ -491,7 +487,8 @@ class Connection(object):
|
|||||||
|
|
||||||
# If allowed by the final exception handler, re-raise the exception.
|
# If allowed by the final exception handler, re-raise the exception.
|
||||||
if self.handle_exception is None and not caught:
|
if self.handle_exception is None and not caught:
|
||||||
raise_(*exc_info)
|
exc_value, exc_tb = exc_info[1:]
|
||||||
|
raise exc_value.with_traceback(exc_tb)
|
||||||
|
|
||||||
def _version_mismatch(self, server_protocol=None, server_version=None):
|
def _version_mismatch(self, server_protocol=None, server_version=None):
|
||||||
if server_protocol is None:
|
if server_protocol is None:
|
||||||
@ -592,7 +589,8 @@ class NetworkingThread(threading.Thread):
|
|||||||
exc_info = None
|
exc_info = None
|
||||||
|
|
||||||
if exc_info is not None:
|
if exc_info is not None:
|
||||||
raise_(*exc_info)
|
exc_value, exc_tb = exc_info[1:]
|
||||||
|
raise exc_value.with_traceback(exc_tb)
|
||||||
|
|
||||||
|
|
||||||
class PacketReactor(object):
|
class PacketReactor(object):
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
Each type has a method which is used to read and write it.
|
Each type has a method which is used to read and write it.
|
||||||
These definitions and methods are used by the packet definitions
|
These definitions and methods are used by the packet definitions
|
||||||
"""
|
"""
|
||||||
from __future__ import division
|
|
||||||
import struct
|
import struct
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
"""Minecraft data types that are used by packets, but don't have a specific
|
"""Minecraft data types that are used by packets, but don't have a specific
|
||||||
network representation.
|
network representation.
|
||||||
"""
|
"""
|
||||||
from __future__ import division
|
|
||||||
|
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
|
@ -1,3 +1,2 @@
|
|||||||
cryptography>=1.5
|
cryptography>=1.5
|
||||||
requests
|
requests
|
||||||
future
|
|
||||||
|
3
start.py
3
start.py
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
import getpass
|
import getpass
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
@ -11,7 +9,6 @@ from minecraft import authentication
|
|||||||
from minecraft.exceptions import YggdrasilError
|
from minecraft.exceptions import YggdrasilError
|
||||||
from minecraft.networking.connection import Connection
|
from minecraft.networking.connection import Connection
|
||||||
from minecraft.networking.packets import Packet, clientbound, serverbound
|
from minecraft.networking.packets import Packet, clientbound, serverbound
|
||||||
from minecraft.compat import input
|
|
||||||
|
|
||||||
|
|
||||||
def get_options():
|
def get_options():
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
import platform
|
|
||||||
from distutils.version import StrictVersion
|
|
||||||
|
|
||||||
if StrictVersion(platform.python_version()) < StrictVersion("3.3.0"):
|
|
||||||
import mock # noqa
|
|
||||||
else:
|
|
||||||
from unittest import mock # noqa
|
|
@ -1,5 +1,3 @@
|
|||||||
from __future__ import print_function
|
|
||||||
|
|
||||||
from minecraft import SUPPORTED_MINECRAFT_VERSIONS
|
from minecraft import SUPPORTED_MINECRAFT_VERSIONS
|
||||||
from minecraft.networking import connection
|
from minecraft.networking import connection
|
||||||
from minecraft.networking import types
|
from minecraft.networking import types
|
||||||
@ -11,7 +9,6 @@ from minecraft.networking.encryption import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from cryptography.hazmat.primitives.asymmetric.padding import PKCS1v15
|
from cryptography.hazmat.primitives.asymmetric.padding import PKCS1v15
|
||||||
from future.utils import raise_
|
|
||||||
|
|
||||||
from numbers import Integral
|
from numbers import Integral
|
||||||
import unittest
|
import unittest
|
||||||
@ -576,7 +573,8 @@ class _FakeServerTest(unittest.TestCase):
|
|||||||
logging.error(**error)
|
logging.error(**error)
|
||||||
self.fail('Multiple errors: see logging output.')
|
self.fail('Multiple errors: see logging output.')
|
||||||
elif errors and 'exc_info' in errors[0]:
|
elif errors and 'exc_info' in errors[0]:
|
||||||
raise_(*errors[0]['exc_info'])
|
exc_value, exc_tb = errors[0]['exc_info'][1:]
|
||||||
|
raise exc_value.with_traceback(exc_tb)
|
||||||
elif errors:
|
elif errors:
|
||||||
self.fail(errors[0]['msg'])
|
self.fail(errors[0]['msg'])
|
||||||
|
|
||||||
|
@ -4,11 +4,11 @@ from minecraft.authentication import _make_request
|
|||||||
from minecraft.authentication import _raise_from_response
|
from minecraft.authentication import _raise_from_response
|
||||||
from minecraft.exceptions import YggdrasilError
|
from minecraft.exceptions import YggdrasilError
|
||||||
|
|
||||||
|
from unittest import mock
|
||||||
|
import unittest
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import unittest
|
|
||||||
import os
|
import os
|
||||||
from .compat import mock
|
|
||||||
|
|
||||||
FAKE_DATA = {
|
FAKE_DATA = {
|
||||||
"id_": "85e2c12b9eab4a7dabf61babc11354c2",
|
"id_": "85e2c12b9eab4a7dabf61babc11354c2",
|
||||||
|
@ -5,7 +5,6 @@ from minecraft.networking.connection import Connection
|
|||||||
from minecraft.exceptions import (
|
from minecraft.exceptions import (
|
||||||
VersionMismatch, LoginDisconnect, InvalidState, IgnorePacket
|
VersionMismatch, LoginDisconnect, InvalidState, IgnorePacket
|
||||||
)
|
)
|
||||||
from minecraft.compat import unicode
|
|
||||||
|
|
||||||
from . import fake_server
|
from . import fake_server
|
||||||
|
|
||||||
@ -92,7 +91,7 @@ class DefaultStatusTest(ConnectTest):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
class FakeStdOut(io.BytesIO):
|
class FakeStdOut(io.BytesIO):
|
||||||
def write(self, data):
|
def write(self, data):
|
||||||
if isinstance(data, unicode):
|
if isinstance(data, str):
|
||||||
data = data.encode('utf8')
|
data = data.encode('utf8')
|
||||||
super(FakeStdOut, self).write(data)
|
super(FakeStdOut, self).write(data)
|
||||||
sys.stdout, self.old_stdout = FakeStdOut(), sys.stdout
|
sys.stdout, self.old_stdout = FakeStdOut(), sys.stdout
|
||||||
|
7
tox.ini
7
tox.ini
@ -4,7 +4,7 @@
|
|||||||
# and then run "tox" from this directory.
|
# and then run "tox" from this directory.
|
||||||
|
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py27, py35, py36, py37, py38, pypy, flake8, pylint-errors, pylint-full, verify-manifest
|
envlist = py35, py36, py37, py38, pypy, flake8, pylint-errors, pylint-full, verify-manifest
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands = nosetests --with-timer
|
commands = nosetests --with-timer
|
||||||
@ -27,11 +27,6 @@ commands =
|
|||||||
deps =
|
deps =
|
||||||
coveralls
|
coveralls
|
||||||
|
|
||||||
[testenv:py27]
|
|
||||||
deps =
|
|
||||||
{[testenv]deps}
|
|
||||||
mock
|
|
||||||
|
|
||||||
[testenv:py38]
|
[testenv:py38]
|
||||||
setenv =
|
setenv =
|
||||||
PYCRAFT_RUN_INTERNET_TESTS=1
|
PYCRAFT_RUN_INTERNET_TESTS=1
|
||||||
|
Loading…
Reference in New Issue
Block a user