1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 proton-core,
7 proton-vpn-connection,
8 proton-vpn-logger,
9 proton-vpn-killswitch,
10 proton-vpn-session,
11 sentry-sdk,
12 distro,
13 pytestCheckHook,
14}:
15
16buildPythonPackage rec {
17 pname = "proton-vpn-api-core";
18 version = "0.22.3";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "ProtonVPN";
23 repo = "python-proton-vpn-api-core";
24 rev = "refs/tags/v${version}";
25 hash = "sha256-BGei6tw6VTKkHmaIWa2VJfKOL5cRUbauOQ7zp1RY9Bo=";
26 };
27
28 nativeBuildInputs = [ setuptools ];
29
30 propagatedBuildInputs = [
31 distro
32 proton-core
33 proton-vpn-connection
34 proton-vpn-logger
35 proton-vpn-killswitch
36 proton-vpn-session
37 sentry-sdk
38 ];
39
40 postPatch = ''
41 substituteInPlace setup.cfg \
42 --replace-fail "--cov=proton/vpn/core/ --cov-report html --cov-report term" ""
43 '';
44
45 pythonImportsCheck = [ "proton.vpn.core" ];
46
47 nativeCheckInputs = [ pytestCheckHook ];
48
49 preCheck = ''
50 # Needed for Permission denied: '/homeless-shelter'
51 export HOME=$(mktemp -d)
52 '';
53
54 meta = with lib; {
55 description = "Acts as a facade to the other Proton VPN components, exposing a uniform API to the available Proton VPN services";
56 homepage = "https://github.com/ProtonVPN/python-proton-vpn-api-core";
57 license = licenses.gpl3Only;
58 maintainers = with maintainers; [ wolfangaukang ];
59 };
60}