2020-07-23 12:28:26 +01:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildPythonPackage
|
|
|
|
, isPy27
|
2020-07-29 23:30:36 +01:00
|
|
|
, fetchpatch
|
2020-07-23 12:28:26 +01:00
|
|
|
# Mitmproxy requirements
|
|
|
|
, blinker
|
|
|
|
, brotli
|
|
|
|
, certifi
|
|
|
|
, click
|
|
|
|
, cryptography
|
|
|
|
, flask
|
|
|
|
, h2
|
|
|
|
, hyperframe
|
|
|
|
, kaitaistruct
|
|
|
|
, ldap3
|
|
|
|
, passlib
|
|
|
|
, protobuf
|
|
|
|
, pyasn1
|
|
|
|
, pyopenssl
|
|
|
|
, pyparsing
|
|
|
|
, pyperclip
|
|
|
|
, ruamel_yaml
|
|
|
|
, setuptools
|
|
|
|
, sortedcontainers
|
|
|
|
, tornado
|
|
|
|
, urwid
|
|
|
|
, wsproto
|
|
|
|
, publicsuffix2
|
|
|
|
, zstandard
|
|
|
|
# Additional check requirements
|
|
|
|
, beautifulsoup4
|
|
|
|
, glibcLocales
|
|
|
|
, pytest
|
|
|
|
, requests
|
|
|
|
, asynctest
|
|
|
|
, parver
|
|
|
|
, pytest-asyncio
|
|
|
|
, hypothesis
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "mitmproxy";
|
2020-07-29 23:30:36 +01:00
|
|
|
version = "5.2";
|
2020-07-23 12:28:26 +01:00
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2020-07-29 23:30:36 +01:00
|
|
|
sha256 = "0ja0aqnfmkvns5qmd51hmrvbw8dnccaks30gxgzgcjgy30rj4brq";
|
2020-07-23 12:28:26 +01:00
|
|
|
};
|
|
|
|
|
2020-07-29 23:30:36 +01:00
|
|
|
patches = [
|
|
|
|
# Apply patch from upstream to make mitmproxy v5.2 compatible with urwid >v2.1.0
|
|
|
|
(fetchpatch {
|
|
|
|
name = "urwid-lt-2.1.0.patch";
|
|
|
|
url = "https://github.com/mitmproxy/mitmproxy/commit/ea9177217208fdf642ffc54f6b1f6507a199350c.patch";
|
|
|
|
sha256 = "1z5r8izg5nvay01ywl3xc6in1vjfi9f144j057p3k5rzfliv49gg";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-07-23 12:28:26 +01:00
|
|
|
postPatch = ''
|
|
|
|
# remove dependency constraints
|
|
|
|
sed 's/>=\([0-9]\.\?\)\+\( \?, \?<\([0-9]\.\?\)\+\)\?//' -i setup.py
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = (!stdenv.isDarwin);
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
export HOME=$(mktemp -d)
|
2020-07-29 23:30:36 +01:00
|
|
|
pytest -k 'not test_get_version' # expects a Git repository
|
2020-07-23 12:28:26 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
# setup.py
|
|
|
|
blinker
|
|
|
|
brotli
|
|
|
|
certifi
|
|
|
|
click
|
|
|
|
cryptography
|
|
|
|
flask
|
|
|
|
h2
|
|
|
|
hyperframe
|
|
|
|
kaitaistruct
|
|
|
|
ldap3
|
|
|
|
passlib
|
|
|
|
protobuf
|
|
|
|
publicsuffix2
|
|
|
|
pyasn1
|
|
|
|
pyopenssl
|
|
|
|
pyparsing
|
|
|
|
pyperclip
|
|
|
|
ruamel_yaml
|
|
|
|
sortedcontainers
|
|
|
|
tornado
|
|
|
|
urwid
|
|
|
|
wsproto
|
|
|
|
zstandard
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
asynctest
|
|
|
|
beautifulsoup4
|
|
|
|
flask
|
|
|
|
glibcLocales
|
|
|
|
hypothesis
|
|
|
|
parver
|
|
|
|
pytest
|
|
|
|
pytest-asyncio
|
|
|
|
requests
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Man-in-the-middle proxy";
|
|
|
|
homepage = "https://mitmproxy.org/";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ fpletz kamilchm ];
|
|
|
|
};
|
|
|
|
}
|