aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Kriechbaumer <thomas@kriechbaumer.name>2018-03-31 17:25:21 +0200
committerThomas Kriechbaumer <thomas@kriechbaumer.name>2018-03-31 18:46:32 +0200
commit46f8901b8cf46769f62b7268117d2e60fc785c00 (patch)
tree154a2669f1dd13c2632f6387fee1d8931fe4c735
parent3c52ed6ee1948a1c4b0fa064fe7313bdfadb8950 (diff)
downloadmitmproxy-46f8901b8cf46769f62b7268117d2e60fc785c00.tar.gz
mitmproxy-46f8901b8cf46769f62b7268117d2e60fc785c00.tar.bz2
mitmproxy-46f8901b8cf46769f62b7268117d2e60fc785c00.zip
Python 3.5 is dead -- long live Python 3.6!
fixes #2266
-rw-r--r--.travis.yml9
-rw-r--r--docs/src/content/overview-installation.md8
-rw-r--r--mitmproxy/net/tcp.py2
-rw-r--r--mitmproxy/tools/main.py4
-rw-r--r--mitmproxy/utils/typecheck.py15
-rw-r--r--release/README.md2
-rw-r--r--setup.py1
-rwxr-xr-x[-rw-r--r--]test/filename_matching.py2
-rwxr-xr-x[-rw-r--r--]test/individual_coverage.py2
-rw-r--r--test/mitmproxy/utils/test_typecheck.py19
-rw-r--r--tox.ini6
11 files changed, 21 insertions, 49 deletions
diff --git a/.travis.yml b/.travis.yml
index efdf6172..3e8b4882 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,9 +22,6 @@ matrix:
osx_image: xcode7.3
language: generic
env: TOXENV=py36 BDIST=1
- - python: 3.5
- env: TOXENV=py35
- dist: precise
- python: 3.6
env: TOXENV=py36 BDIST=1 WHEEL=1
- python: 3.6
@@ -61,9 +58,9 @@ install:
brew update || brew update
brew outdated pyenv || brew upgrade pyenv
eval "$(pyenv init -)"
- env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install --skip-existing 3.6.4
- pyenv global 3.6.4
- pyenv shell 3.6.4
+ env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install --skip-existing 3.6.5
+ pyenv global 3.6.5
+ pyenv shell 3.6.5
fi
- pip install tox virtualenv setuptools
diff --git a/docs/src/content/overview-installation.md b/docs/src/content/overview-installation.md
index 00941cb8..d69805db 100644
--- a/docs/src/content/overview-installation.md
+++ b/docs/src/content/overview-installation.md
@@ -73,14 +73,14 @@ security considerations apply as for our binary packages.
## Installation on Linux via pip3
-Please make sure to install Python 3.5 (or higher) and pip3 for your
+Please make sure to install Python 3.6 (or higher) and pip3 for your
distribution. If your distribution does not provide a suitable Python
version, you can use [pyenv](https://github.com/yyuu/pyenv) to get a
recent Python environment.
{{< highlight bash >}}
-sudo apt install python3-pip # Debian 8 or higher, Ubuntu 16.04 or higher
-sudo dnf install python3-pip # Fedora 24 or higher
+sudo apt install python3-pip # Debian 10 or higher, Ubuntu 17.10 or higher
+sudo dnf install python3-pip # Fedora 26 or higher
sudo pacman -S python-pip # Arch Linux
{{< / highlight >}}
@@ -98,7 +98,7 @@ sudo pip3 install mitmproxy
## Installation on Windows via pip3
-First, install the latest version of Python 3.5 or higher from the
+First, install the latest version of Python 3.6 or higher from the
[Python website](https://www.python.org/downloads/windows/). During
installation, make sure to select Add Python to PATH. There are no other
dependencies on Windows.
diff --git a/mitmproxy/net/tcp.py b/mitmproxy/net/tcp.py
index 85217794..62783023 100644
--- a/mitmproxy/net/tcp.py
+++ b/mitmproxy/net/tcp.py
@@ -19,7 +19,7 @@ from mitmproxy.coretypes import basethread
socket_fileobject = socket.SocketIO
# workaround for https://bugs.python.org/issue29515
-# Python 3.5 and 3.6 for Windows is missing a constant
+# Python 3.6 for Windows is missing a constant
IPPROTO_IPV6 = getattr(socket, "IPPROTO_IPV6", 41)
EINTR = 4
diff --git a/mitmproxy/tools/main.py b/mitmproxy/tools/main.py
index 330060f7..91488a1f 100644
--- a/mitmproxy/tools/main.py
+++ b/mitmproxy/tools/main.py
@@ -2,11 +2,11 @@ from __future__ import print_function # this is here for the version check to w
import sys
-if sys.version_info < (3, 5):
+if sys.version_info < (3, 6):
# This must be before any mitmproxy imports, as they already break!
# Keep all other imports below with the 'noqa' magic comment.
print("#" * 49, file=sys.stderr)
- print("# mitmproxy only supports Python 3.5 and above! #", file=sys.stderr)
+ print("# mitmproxy requires Python 3.6 or higher! #", file=sys.stderr)
print("#" * 49, file=sys.stderr)
import argparse # noqa
diff --git a/mitmproxy/utils/typecheck.py b/mitmproxy/utils/typecheck.py
index 22db68f5..8ec68fa0 100644
--- a/mitmproxy/utils/typecheck.py
+++ b/mitmproxy/utils/typecheck.py
@@ -7,26 +7,17 @@ Type = typing.Union[
def sequence_type(typeinfo: typing.Type[typing.List]) -> Type:
"""Return the type of a sequence, e.g. typing.List"""
- try:
- return typeinfo.__args__[0] # type: ignore
- except AttributeError: # Python 3.5.0
- return typeinfo.__parameters__[0] # type: ignore
+ return typeinfo.__args__[0] # type: ignore
def tuple_types(typeinfo: typing.Type[typing.Tuple]) -> typing.Sequence[Type]:
"""Return the types of a typing.Tuple"""
- try:
- return typeinfo.__args__ # type: ignore
- except AttributeError: # Python 3.5.x
- return typeinfo.__tuple_params__ # type: ignore
+ return typeinfo.__args__ # type: ignore
def union_types(typeinfo: typing.Type[typing.Tuple]) -> typing.Sequence[Type]:
"""return the types of a typing.Union"""
- try:
- return typeinfo.__args__ # type: ignore
- except AttributeError: # Python 3.5.x
- return typeinfo.__union_params__ # type: ignore
+ return typeinfo.__args__ # type: ignore
def mapping_types(typeinfo: typing.Type[typing.Mapping]) -> typing.Tuple[Type, Type]:
diff --git a/release/README.md b/release/README.md
index b2f97aab..0e9c373b 100644
--- a/release/README.md
+++ b/release/README.md
@@ -27,7 +27,7 @@ Make sure run all these steps on the correct branch you want to create a new rel
- Create a new branch based of master for major versions.
- Update the dependencies in [alpine/requirements.txt](https://github.com/mitmproxy/docker-releases/commit/3d6a9989fde068ad0aea257823ac3d7986ff1613#diff-9b7e0eea8ae74688b1ac13ea080549ba)
* Creating a fresh venv, pip-installing the new wheel in there, and then export all packages:
- * `virtualenv -ppython3.5 venv && source venv/bin/activate && pip install mitmproxy && pip freeze`
+ * `virtualenv -ppython3.6 venv && source venv/bin/activate && pip install mitmproxy && pip freeze`
- Tag the commit with the correct version
* `2.0.0` for new major versions
* `2.0.2` for new patch versions
diff --git a/setup.py b/setup.py
index d973249f..1b9e9648 100644
--- a/setup.py
+++ b/setup.py
@@ -35,7 +35,6 @@ setup(
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
- "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Security",
diff --git a/test/filename_matching.py b/test/filename_matching.py
index e74848d4..5f49725e 100644..100755
--- a/test/filename_matching.py
+++ b/test/filename_matching.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
import os
import re
import glob
diff --git a/test/individual_coverage.py b/test/individual_coverage.py
index c975b4c8..097b290f 100644..100755
--- a/test/individual_coverage.py
+++ b/test/individual_coverage.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
import io
import contextlib
import os
diff --git a/test/mitmproxy/utils/test_typecheck.py b/test/mitmproxy/utils/test_typecheck.py
index 9cb4334e..85713e14 100644
--- a/test/mitmproxy/utils/test_typecheck.py
+++ b/test/mitmproxy/utils/test_typecheck.py
@@ -1,6 +1,5 @@
import io
import typing
-from unittest import mock
import pytest
from mitmproxy.utils import typecheck
@@ -32,12 +31,6 @@ def test_check_union():
with pytest.raises(TypeError):
typecheck.check_option_type("foo", [], typing.Union[int, str])
- # Python 3.5 only defines __union_params__
- m = mock.Mock()
- m.__str__ = lambda self: "typing.Union"
- m.__union_params__ = (int,)
- typecheck.check_option_type("foo", 42, m)
-
def test_check_tuple():
typecheck.check_option_type("foo", (42, "42"), typing.Tuple[int, str])
@@ -50,12 +43,6 @@ def test_check_tuple():
with pytest.raises(TypeError):
typecheck.check_option_type("foo", ("42", 42), typing.Tuple[int, str])
- # Python 3.5 only defines __tuple_params__
- m = mock.Mock()
- m.__str__ = lambda self: "typing.Tuple"
- m.__tuple_params__ = (int, str)
- typecheck.check_option_type("foo", (42, "42"), m)
-
def test_check_sequence():
typecheck.check_option_type("foo", [10], typing.Sequence[int])
@@ -68,12 +55,6 @@ def test_check_sequence():
with pytest.raises(TypeError):
typecheck.check_option_type("foo", "foo", typing.Sequence[str])
- # Python 3.5 only defines __parameters__
- m = mock.Mock()
- m.__str__ = lambda self: "typing.Sequence"
- m.__parameters__ = (int,)
- typecheck.check_option_type("foo", [10], m)
-
def test_check_io():
typecheck.check_option_type("foo", io.StringIO(), typing.IO[str])
diff --git a/tox.ini b/tox.ini
index c88d64a8..475f1951 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py35, py36, lint
+envlist = py36, lint
skipsdist = True
toxworkdir={env:TOX_WORK_DIR:.tox}
@@ -21,7 +21,7 @@ commands =
commands =
mitmdump --version
flake8 --jobs 8 mitmproxy pathod examples test release
- python test/filename_matching.py
+ python ./test/filename_matching.py
rstcheck README.rst
mypy --ignore-missing-imports ./mitmproxy ./pathod
mypy --ignore-missing-imports --follow-imports=skip ./examples/simple/ ./examples/pathod/ ./examples/complex/
@@ -30,7 +30,7 @@ commands =
deps =
-rrequirements.txt
commands =
- python test/individual_coverage.py
+ python ./test/individual_coverage.py
[testenv:cibuild]
passenv = TRAVIS_* AWS_* APPVEYOR_* RTOOL_KEY WHEEL