summary refs log tree commit diff
path: root/pkgs/development/python-modules/adblock/default.nix
blob: 8fc697828f0ad231181a1785d7fb83145a9e8149 (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
{ stdenv
, lib
, fetchFromGitHub
, buildPythonPackage
, rustPlatform
, pythonImportsCheckHook
, pkg-config
, openssl
, publicsuffix-list
, isPy27
, CoreFoundation
, Security
}:

buildPythonPackage rec {
  pname = "adblock";
  version = "0.4.0";
  disabled = isPy27;

  # Pypi only has binary releases
  src = fetchFromGitHub {
    owner = "ArniDagur";
    repo = "python-adblock";
    rev = version;
    sha256 = "10d6ks2fyzbizq3kb69q478idj0h86k6ygjb6wl3zq3mf65ma4zg";
  };

  cargoDeps = rustPlatform.fetchCargoTarball {
    inherit src;
    name = "${pname}-${version}";
    hash = "sha256-gEFmj3/KvhvvsOK2nX2L1RUD4Wfp3nYzEzVnQZIsIDY=";
  };

  format = "pyproject";

  nativeBuildInputs = [ pkg-config pythonImportsCheckHook ]
    ++ (with rustPlatform; [ cargoSetupHook maturinBuildHook ]);

  buildInputs = [ openssl ]
    ++ lib.optionals stdenv.isDarwin [ CoreFoundation Security ];

  PSL_PATH = "${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat";

  # There are no rust tests
  doCheck = false;

  pythonImportsCheck = [ "adblock" ];

  meta = with lib; {
    description = "Python wrapper for Brave's adblocking library, which is written in Rust";
    homepage = "https://github.com/ArniDagur/python-adblock/";
    maintainers = with maintainers; [ petabyteboy ];
    license = with licenses; [ asl20 mit ];
  };
}