about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/proton-vpn-api-core/default.nix
blob: ba8869e42daa4ead79238411abc1de97cc3cd0d7 (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, proton-core
, proton-vpn-connection
, proton-vpn-logger
, proton-vpn-killswitch
, proton-vpn-session
, distro
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "proton-vpn-api-core";
  version = "0.20.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ProtonVPN";
    repo = "python-proton-vpn-api-core";
    rev = "refs/tags/v${version}";
    hash = "sha256-acck0Nc/15soTJBC/4y83ID9fjF/q4vrYr6SsLAAVRY=";
  };

  nativeBuildInputs = [
    setuptools
  ];

  propagatedBuildInputs = [
    distro
    proton-core
    proton-vpn-connection
    proton-vpn-logger
    proton-vpn-killswitch
    proton-vpn-session
  ];

  postPatch = ''
    substituteInPlace setup.cfg \
      --replace-fail "--cov=proton/vpn/core/ --cov-report html --cov-report term" ""
  '';

  pythonImportsCheck = [ "proton.vpn.core" ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  preCheck = ''
    # Needed for Permission denied: '/homeless-shelter'
    export HOME=$(mktemp -d)
  '';

  meta = with lib; {
    description = "Acts as a facade to the other Proton VPN components, exposing a uniform API to the available Proton VPN services";
    homepage = "https://github.com/ProtonVPN/python-proton-vpn-api-core";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ wolfangaukang ];
  };
}