python3Packages.mitmproxy: adjust requirement and update check part

This commit is contained in:
Fabian Affolter 2021-02-22 13:20:42 +01:00
parent b5217c5d2a
commit ff770828ba

View file

@ -1,21 +1,25 @@
{ lib, stdenv { lib
, stdenv
, fetchFromGitHub , fetchFromGitHub
, buildPythonPackage , buildPythonPackage
, isPy27 , pythonOlder
, fetchpatch # Mitmproxy requirements
# Mitmproxy requirements , asgiref
, blinker , blinker
, brotli , brotli
, certifi , certifi
, click , click
, cryptography , cryptography
, flask , flask
, h11
, h2 , h2
, hyperframe , hyperframe
, kaitaistruct , kaitaistruct
, ldap3 , ldap3
, msgpack
, passlib , passlib
, protobuf , protobuf
, publicsuffix2
, pyasn1 , pyasn1
, pyopenssl , pyopenssl
, pyparsing , pyparsing
@ -26,19 +30,17 @@
, tornado , tornado
, urwid , urwid
, wsproto , wsproto
, publicsuffix2
, zstandard , zstandard
# Additional check requirements # Additional check requirements
, beautifulsoup4 , beautifulsoup4
, glibcLocales , glibcLocales
, pytest , hypothesis
, requests
, asynctest
, parver , parver
, pytest-asyncio , pytest-asyncio
, hypothesis , pytest-timeout
, asgiref , pytest-xdist
, msgpack , pytestCheckHook
, requests
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -47,24 +49,12 @@ buildPythonPackage rec {
disabled = pythonOlder "3.8"; disabled = pythonOlder "3.8";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = pname; owner = pname;
repo = pname; repo = pname;
rev = "v${version}"; rev = "v${version}";
sha256 = "sha256-FyIZKFQtf6qvwo4+NzPa/KOmBCcdGJ3jCqxz26+S2e4="; sha256 = "sha256-FyIZKFQtf6qvwo4+NzPa/KOmBCcdGJ3jCqxz26+S2e4=";
}; };
postPatch = ''
# remove dependency constraints
sed 's/>=\([0-9]\.\?\)\+\( \?, \?<\([0-9]\.\?\)\+\)\?\( \?, \?!=\([0-9]\.\?\)\+\)\?//' -i setup.py
'';
doCheck = (!stdenv.isDarwin);
checkPhase = ''
export HOME=$(mktemp -d)
pytest -k 'not test_get_version' # expects a Git repository
'';
propagatedBuildInputs = [ propagatedBuildInputs = [
setuptools setuptools
# setup.py # setup.py
@ -75,6 +65,7 @@ buildPythonPackage rec {
click click
cryptography cryptography
flask flask
h11
h2 h2
hyperframe hyperframe
kaitaistruct kaitaistruct
@ -96,21 +87,39 @@ buildPythonPackage rec {
]; ];
checkInputs = [ checkInputs = [
asynctest
beautifulsoup4 beautifulsoup4
flask
glibcLocales glibcLocales
hypothesis hypothesis
parver parver
pytest
pytest-asyncio pytest-asyncio
pytest-timeout
pytest-xdist
pytestCheckHook
requests requests
]; ];
doCheck = !stdenv.isDarwin;
postPatch = ''
# remove dependency constraints
sed 's/>=\([0-9]\.\?\)\+\( \?, \?<\([0-9]\.\?\)\+\)\?\( \?, \?!=\([0-9]\.\?\)\+\)\?//' -i setup.py
'';
preCheck = ''
export HOME=$(mktemp -d)
'';
disabledTests = [
# Tests require a git repository
"test_get_version"
];
pythonImportsCheck = [ "mitmproxy" ];
meta = with lib; { meta = with lib; {
description = "Man-in-the-middle proxy"; description = "Man-in-the-middle proxy";
homepage = "https://mitmproxy.org/"; homepage = "https://mitmproxy.org/";
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ fpletz kamilchm ]; maintainers = with maintainers; [ fpletz kamilchm ];
}; };
} }