2021-01-05 17:05:55 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
2021-03-09 03:18:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, rustPlatform
|
2021-01-05 17:05:55 +00:00
|
|
|
, pkg-config
|
|
|
|
, openssl
|
|
|
|
, publicsuffix-list
|
|
|
|
, isPy27
|
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";
|
2021-06-28 23:13:55 +00:00
|
|
|
version = "0.5.0";
|
2021-01-05 17:05:55 +00:00
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
# Pypi only has binary releases
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ArniDagur";
|
|
|
|
repo = "python-adblock";
|
|
|
|
rev = version;
|
2021-06-28 23:13:55 +00:00
|
|
|
sha256 = "sha256-JjmMfL24778T6LCuElXsD7cJxQ+RkqbNEnEqwoN24WE=";
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
2021-06-28 23:13:55 +00:00
|
|
|
hash = "sha256-w+/W4T3ukRHNpCPjhlHZLPn6sgCpz4QHVD8VW+Rw5BI=";
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ]
|
2021-03-09 03:18:52 +00:00
|
|
|
++ (with rustPlatform; [ cargoSetupHook maturinBuildHook ]);
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
buildInputs = [ openssl ]
|
2021-06-04 09:07:49 +00:00
|
|
|
++ 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-06-28 23:13:55 +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"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "adblock" "adblock.adblock" ];
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
meta = with lib; {
|
2021-01-05 17:05:55 +00:00
|
|
|
description = "Python wrapper for Brave's adblocking library, which is written in Rust";
|
|
|
|
homepage = "https://github.com/ArniDagur/python-adblock/";
|
2021-06-04 09:07:49 +00:00
|
|
|
maintainers = with maintainers; [ petabyteboy dotlambda ];
|
2021-01-05 17:05:55 +00:00
|
|
|
license = with licenses; [ asl20 mit ];
|
|
|
|
};
|
|
|
|
}
|