diff --git a/0001-fix-run-in-python-3.7-environment.patch b/0001-fix-run-in-python-3.7-environment.patch new file mode 100644 index 0000000000000000000000000000000000000000..de2f542625202ad26844762ff98ac4198fd2669f --- /dev/null +++ b/0001-fix-run-in-python-3.7-environment.patch @@ -0,0 +1,80 @@ +From af22a19f18f7997a7c7a3ee4ad60f03ab89b0459 Mon Sep 17 00:00:00 2001 +From: root +Date: Thu, 30 Sep 2021 17:03:09 +0800 +Subject: [PATCH] fix run in python 3.7 environment + +--- + mitmproxy/addons/tlsconfig.py | 3 ++- + mitmproxy/net/server_spec.py | 5 +++-- + mitmproxy/proxy/commands.py | 3 ++- + mitmproxy/proxy/layers/tls.py | 3 ++- + 4 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/mitmproxy/addons/tlsconfig.py b/mitmproxy/addons/tlsconfig.py +index 260be64..ee5efde 100644 +--- a/mitmproxy/addons/tlsconfig.py ++++ b/mitmproxy/addons/tlsconfig.py +@@ -1,7 +1,8 @@ + import ipaddress + import os + from pathlib import Path +-from typing import List, Optional, TypedDict, Any ++from typing import List, Optional, Any ++from typing_extensions import TypedDict + + from OpenSSL import SSL + from mitmproxy import certs, ctx, exceptions, connection +diff --git a/mitmproxy/net/server_spec.py b/mitmproxy/net/server_spec.py +index f117774..99c5996 100644 +--- a/mitmproxy/net/server_spec.py ++++ b/mitmproxy/net/server_spec.py +@@ -3,7 +3,8 @@ Server specs are used to describe an upstream proxy or server. + """ + import functools + import re +-from typing import Tuple, Literal, NamedTuple ++from typing import Tuple, NamedTuple ++from typing_extensions import Literal + + from mitmproxy.net import check + +@@ -26,7 +27,7 @@ server_spec_re = re.compile( + ) + + +-@functools.lru_cache ++@functools.lru_cache() + def parse(server_spec: str) -> ServerSpec: + """ + Parses a server mode specification, e.g.: +diff --git a/mitmproxy/proxy/commands.py b/mitmproxy/proxy/commands.py +index 8f07990..5cada3c 100644 +--- a/mitmproxy/proxy/commands.py ++++ b/mitmproxy/proxy/commands.py +@@ -6,7 +6,8 @@ possibly to the master and addons. + + The counterpart to commands are events. + """ +-from typing import Literal, Union, TYPE_CHECKING ++from typing import Union, TYPE_CHECKING ++from typing_extensions import Literal + + import mitmproxy.hooks + from mitmproxy.connection import Connection, Server +diff --git a/mitmproxy/proxy/layers/tls.py b/mitmproxy/proxy/layers/tls.py +index c9a2ff2..e2bbb7a 100644 +--- a/mitmproxy/proxy/layers/tls.py ++++ b/mitmproxy/proxy/layers/tls.py +@@ -1,7 +1,8 @@ + import struct + import time + from dataclasses import dataclass +-from typing import Iterator, Literal, Optional, Tuple ++from typing import Iterator, Optional, Tuple ++from typing_extensions import Literal + + from OpenSSL import SSL + from mitmproxy import certs, connection +-- +2.27.0 + diff --git a/python-mitmproxy.spec b/python-mitmproxy.spec index 0f461a6fcee181c41efe52058d7c8e96b4059806..67a8a69e3865b3a39d8b254125fad318a3ac9541 100644 --- a/python-mitmproxy.spec +++ b/python-mitmproxy.spec @@ -1,12 +1,13 @@ %global _empty_manifest_terminate_build 0 Name: python-mitmproxy Version: 7.0.0 -Release: 2 +Release: 3 Summary: An interactive, SSL/TLS-capable intercepting proxy for HTTP/1, HTTP/2, and WebSockets. License: MIT URL: https://github.com/mitmproxy/mitmproxy/ Source0: https://github.com/mitmproxy/mitmproxy/archive/refs/tags/v%{version}.tar.gz Patch0: fix-build-fail-with-python3.7.patch +Patch0001: 0001-fix-run-in-python-3.7-environment.patch BuildArch: noarch Requires: python3-asgiref python3-blinker python3-Brotli python3-certifi python3-click Requires: python3-cryptography python3-flask python3-h11 python3-h2 python3-hyperframe @@ -17,6 +18,7 @@ Requires: python3-publicsuffix2 python3-zstandard python3-pydivert py Requires: python3-parver python3-pdoc python3-pyinstaller python3-pytest-asyncio Requires: python3-pytest-cov python3-pytest-timeout python3-pytest-xdist python3-pytest Requires: python3-requests python3-tox python3-wheel + %description mitmproxy is an interactive, SSL/TLS-capable intercepting proxy with a console interface for HTTP/1, HTTP/2, and WebSockets. @@ -74,6 +76,9 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Thu Sep 30 2021 chemingdao - 7.0.0-3 +- fix run in python 3.7 environment + * Sat Aug 21 2021 liyanan - 7.0.0-2 - fix build fail with python3.7