2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2021-01-05 17:05:55 +00:00
|
|
|
, fetchFromGitHub
|
2021-03-09 03:18:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, rustPlatform
|
2021-01-05 17:05:55 +00:00
|
|
|
, pkg-config
|
|
|
|
, openssl
|
|
|
|
, publicsuffix-list
|
2021-12-06 16:07:01 +00:00
|
|
|
, pythonOlder
|
2021-06-04 09:07:49 +00:00
|
|
|
, libiconv
|
2021-01-05 17:05:55 +00:00
|
|
|
, CoreFoundation
|
|
|
|
, Security
|
2021-06-28 23:13:55 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, toml
|
2021-01-05 17:05:55 +00:00
|
|
|
}:
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
buildPythonPackage rec {
|
2021-01-05 17:05:55 +00:00
|
|
|
pname = "adblock";
|
2022-08-21 13:32:41 +00:00
|
|
|
version = "0.6.0";
|
2021-12-06 16:07:01 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
# Pypi only has binary releases
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ArniDagur";
|
|
|
|
repo = "python-adblock";
|
2022-04-15 01:41:22 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2022-08-21 13:32:41 +00:00
|
|
|
hash = "sha256-5g5xdUzH/RTVwu4Vfb5Cb1t0ruG0EXgiXjrogD/+JCU=";
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
2022-08-21 13:32:41 +00:00
|
|
|
hash = "sha256-1xmYmF5P7a5O9MilxDy+CVhmWMGRetdM2fGvTPy7JmM=";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
] ++ (with rustPlatform; [
|
|
|
|
cargoSetupHook
|
|
|
|
maturinBuildHook
|
|
|
|
]);
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
buildInputs = [
|
|
|
|
openssl
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
libiconv
|
|
|
|
CoreFoundation
|
|
|
|
Security
|
|
|
|
];
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
PSL_PATH = "${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat";
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
toml
|
|
|
|
];
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
preCheck = ''
|
|
|
|
# import from $out instead
|
|
|
|
rm -r adblock
|
|
|
|
'';
|
|
|
|
|
|
|
|
disabledTestPaths = [
|
|
|
|
# relies on directory removed above
|
|
|
|
"tests/test_typestubs.py"
|
|
|
|
];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"adblock"
|
|
|
|
"adblock.adblock"
|
|
|
|
];
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
meta = with lib; {
|
2021-12-06 16:07:01 +00:00
|
|
|
description = "Python wrapper for Brave's adblocking library";
|
2021-01-05 17:05:55 +00:00
|
|
|
homepage = "https://github.com/ArniDagur/python-adblock/";
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
2021-12-06 16:07:01 +00:00
|
|
|
license = with licenses; [ asl20 /* or */ mit ];
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
}
|