anchor.diff:    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
  
positive.code: { lib, stdenv
  , fetchFromGitHub
  , buildPythonPackage
  , isPy27
  , fetchpatch
  # Mitmproxy requirements
  , blinker
  , brotli
  , certifi
  , click
  , cryptography
  , flask
  , h2
  , hyperframe
  , kaitaistruct
  , ldap3
  , passlib
  , protobuf
  , pyasn1
  , pyopenssl
  , pyparsing
  
negative.code:   ];
  
    checkInputs = [
      beautifulsoup4
      glibcLocales
      hypothesis
      parver
      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;
      maintainers = with maintainers; [ fpletz kamilchm ];
    };
  }
  