nixpkgs-suyu/pkgs/tools/networking/mitmproxy/default.nix

81 lines
2.5 KiB
Nix
Raw Normal View History

{ stdenv, fetchFromGitHub, python3Packages, glibcLocales, fetchpatch }:
2017-12-31 13:50:17 +01:00
2018-02-25 02:38:59 +01:00
with python3Packages;
2017-12-31 13:50:17 +01:00
buildPythonPackage rec {
2018-02-25 02:38:59 +01:00
pname = "mitmproxy";
version = "4.0.4";
src = fetchFromGitHub {
2018-02-25 02:38:59 +01:00
owner = pname;
repo = pname;
rev = "v${version}";
sha256 = "14i9dkafvyl15rq2qa8xldscn5lmkk2g52kbi2hl63nzx9yibx6r";
};
patches = [
(fetchpatch {
# Tests failed due to expired test certificates,
# https://github.com/mitmproxy/mitmproxy/issues/3316
# TODO: remove on next update
name = "test-certificates.patch";
url = "https://github.com/mitmproxy/mitmproxy/commit/1b6a8d6acd3d70f9b9627ad4ae9def08103f8250.patch";
sha256 = "03y79c25yir7d8xj79czdc81y3irqq1i3ks9ca0mv1az8b7xsvfv";
})
(fetchpatch {
# 0.13 <= wsproto < 0.14 patch
# https://github.com/mitmproxy/mitmproxy/issues/3459
# TODO: remove on next update
name = "wsproto-0.13.patch";
url = https://github.com/mitmproxy/mitmproxy/commit/70777a1b6ed64af9cafcdef223a8a260ecc96864.patch;
sha256 = "1ddxdr7js510kzyq3gyks4k5k1n8zb1i9amxw7wzmi1dcg8kqw9a";
# We strip these bounds anyway
excludes = [ "setup.py" ];
})
(fetchpatch {
# Fix for newer pytest disallowing calling fixtures
# https://github.com/mitmproxy/mitmproxy/issues/3403
# TODO: remove on next update
name = "dont-call-fixtures.patch";
url = https://github.com/mitmproxy/mitmproxy/commit/ce28721458c8cc71de86513a5110676e9763041b.patch;
sha256 = "05pljr28lx7l1xgswqr9sz8dnhvc7npzh8xg2p9hignf159kd54d";
# Irrelevant in nixpkgs
excludes = [ "setup.py" "setup.cfg" "release/docker/*" ];
})
];
2018-02-25 02:38:59 +01:00
postPatch = ''
# remove dependency constraints
sed 's/>=\([0-9]\.\?\)\+\( \?, \?<\([0-9]\.\?\)\+\)\?//' -i setup.py
'';
doCheck = (!stdenv.isDarwin);
2017-08-28 08:27:59 +02:00
checkPhase = ''
export HOME=$(mktemp -d)
2018-02-25 02:38:59 +01:00
export LC_CTYPE=en_US.UTF-8
pytest -k 'not test_find_unclaimed_URLs'
2017-08-28 08:27:59 +02:00
'';
2017-12-31 13:50:17 +01:00
propagatedBuildInputs = [
2017-11-03 00:38:23 +01:00
blinker click certifi cryptography
2018-02-25 02:38:59 +01:00
h2 hyperframe kaitaistruct passlib
pyasn1 pyopenssl pyparsing pyperclip
2018-04-06 14:45:56 +02:00
ruamel_yaml tornado urwid brotlipy
sortedcontainers ldap3 wsproto
];
2018-04-06 14:45:56 +02:00
checkInputs = [
2018-02-25 02:38:59 +01:00
beautifulsoup4 flask pytest
2018-04-06 14:45:56 +02:00
requests glibcLocales
asynctest parver pytest-asyncio
2017-08-28 08:27:59 +02:00
];
meta = with stdenv.lib; {
description = "Man-in-the-middle proxy";
2018-02-25 02:38:59 +01:00
homepage = https://mitmproxy.org/;
license = licenses.mit;
maintainers = with maintainers; [ fpletz kamilchm ];
};
}