at 23.05-pre 1.6 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, buildPythonPackage 5, rustPlatform 6, pkg-config 7, openssl 8, publicsuffix-list 9, pythonOlder 10, libiconv 11, CoreFoundation 12, Security 13, pytestCheckHook 14, toml 15}: 16 17buildPythonPackage rec { 18 pname = "adblock"; 19 version = "0.6.0"; 20 format = "pyproject"; 21 22 disabled = pythonOlder "3.7"; 23 24 # Pypi only has binary releases 25 src = fetchFromGitHub { 26 owner = "ArniDagur"; 27 repo = "python-adblock"; 28 rev = "refs/tags/${version}"; 29 hash = "sha256-5g5xdUzH/RTVwu4Vfb5Cb1t0ruG0EXgiXjrogD/+JCU="; 30 }; 31 32 cargoDeps = rustPlatform.fetchCargoTarball { 33 inherit src; 34 name = "${pname}-${version}"; 35 hash = "sha256-1xmYmF5P7a5O9MilxDy+CVhmWMGRetdM2fGvTPy7JmM="; 36 }; 37 38 nativeBuildInputs = [ 39 pkg-config 40 ] ++ (with rustPlatform; [ 41 cargoSetupHook 42 maturinBuildHook 43 ]); 44 45 buildInputs = [ 46 openssl 47 ] ++ lib.optionals stdenv.isDarwin [ 48 libiconv 49 CoreFoundation 50 Security 51 ]; 52 53 PSL_PATH = "${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat"; 54 55 checkInputs = [ 56 pytestCheckHook 57 toml 58 ]; 59 60 preCheck = '' 61 # import from $out instead 62 rm -r adblock 63 ''; 64 65 disabledTestPaths = [ 66 # relies on directory removed above 67 "tests/test_typestubs.py" 68 ]; 69 70 pythonImportsCheck = [ 71 "adblock" 72 "adblock.adblock" 73 ]; 74 75 meta = with lib; { 76 description = "Python wrapper for Brave's adblocking library"; 77 homepage = "https://github.com/ArniDagur/python-adblock/"; 78 maintainers = with maintainers; [ dotlambda ]; 79 license = with licenses; [ asl20 /* or */ mit ]; 80 }; 81}