summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pproxy/default.nix
blob: 8e33dff6f88ef4cd7831bd51aba9e2a19b1697b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pycryptodome,
  uvloop,
  asyncssh,
  aioquic,
  python-daemon,
  setuptools,
}:

buildPythonPackage rec {
  pname = "pproxy";
  version = "2.7.9";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "qwj";
    repo = "python-proxy";
    rev = "7fccf8dd62204f34b0aa3a70fc568fd6ddff7728";
    sha256 = "sha256-bOqDdNiaZ5MRi/UeF0hJwMs+rfQBKRsTmXrZ6ieIguo=";
  };

  nativeBuildInputs = [ setuptools ];

  optional-dependencies = {
    accelerated = [
      pycryptodome
      uvloop
    ];
    sshtunnel = [ asyncssh ];
    quic = [ aioquic ];
    daemon = [ python-daemon ];
  };

  nativeCheckInputs = lib.concatAttrValues optional-dependencies;

  pythonImportsCheck = [ "pproxy" ];

  disabledTests = [
    # Tests try to connect to outside Internet, so disabled
    "api_server"
    "api_client"
  ];

  # test suite doesn't use test runner. so need to run ``python ./tests/*``
  checkPhase = ''
    shopt -s extglob
    for f in ./tests/!(${builtins.concatStringsSep "|" disabledTests}).py ; do
      echo "***Testing $f***"
      eval "python $f"
    done
  '';

  meta = {
    description = "Proxy server that can tunnel among remote servers by regex rules";
    mainProgram = "pproxy";
    homepage = "https://github.com/qwj/python-proxy";
    license = lib.licenses.mit;
    maintainers = [ ];
  };
}