Skip to content

Commit

Permalink
python3Packages.mitmproxy: adjust requirement and update check part
Browse files Browse the repository at this point in the history
  • Loading branch information
fabaff committed Feb 22, 2021
1 parent b5217c5 commit ff77082
Showing 1 changed file with 41 additions and 32 deletions.
73 changes: 41 additions & 32 deletions pkgs/development/python-modules/mitmproxy/default.nix
@@ -1,21 +1,25 @@
{ lib, stdenv
{ lib
, stdenv
, fetchFromGitHub
, buildPythonPackage
, isPy27
, fetchpatch
# Mitmproxy requirements
, pythonOlder
# Mitmproxy requirements
, asgiref
, blinker
, brotli
, certifi
, click
, cryptography
, flask
, h11
, h2
, hyperframe
, kaitaistruct
, ldap3
, msgpack
, passlib
, protobuf
, publicsuffix2
, pyasn1
, pyopenssl
, pyparsing
Expand All @@ -26,19 +30,17 @@
, tornado
, urwid
, wsproto
, publicsuffix2
, zstandard
# Additional check requirements
# Additional check requirements
, beautifulsoup4
, glibcLocales
, pytest
, requests
, asynctest
, hypothesis
, parver
, pytest-asyncio
, hypothesis
, asgiref
, msgpack
, pytest-timeout
, pytest-xdist
, pytestCheckHook
, requests
}:

buildPythonPackage rec {
Expand All @@ -47,24 +49,12 @@ buildPythonPackage rec {
disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "v${version}";
owner = pname;
repo = pname;
rev = "v${version}";
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 = [
setuptools
# setup.py
Expand All @@ -75,6 +65,7 @@ buildPythonPackage rec {
click
cryptography
flask
h11
h2
hyperframe
kaitaistruct
Expand All @@ -96,21 +87,39 @@ buildPythonPackage rec {
];

checkInputs = [
asynctest
beautifulsoup4
flask
glibcLocales
hypothesis
parver
pytest
pytest-asyncio
pytest-timeout
pytest-xdist
pytestCheckHook
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; {
description = "Man-in-the-middle proxy";
homepage = "https://mitmproxy.org/";
license = licenses.mit;
homepage = "https://mitmproxy.org/";
license = licenses.mit;
maintainers = with maintainers; [ fpletz kamilchm ];
};
}

0 comments on commit ff77082

Please sign in to comment.