2021-01-04 13:45:30 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
2021-02-11 18:35:54 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, rustPlatform
|
2021-01-04 13:45:30 +00:00
|
|
|
, pythonImportsCheckHook
|
|
|
|
, pkg-config
|
|
|
|
, openssl
|
|
|
|
, publicsuffix-list
|
|
|
|
, isPy27
|
|
|
|
, CoreFoundation
|
|
|
|
, Security
|
|
|
|
}:
|
|
|
|
|
2021-02-11 18:35:54 +00:00
|
|
|
buildPythonPackage rec {
|
2021-01-04 13:45:30 +00:00
|
|
|
pname = "adblock";
|
|
|
|
version = "0.4.0";
|
|
|
|
disabled = isPy27;
|
|
|
|
|
|
|
|
# Pypi only has binary releases
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ArniDagur";
|
|
|
|
repo = "python-adblock";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "10d6ks2fyzbizq3kb69q478idj0h86k6ygjb6wl3zq3mf65ma4zg";
|
|
|
|
};
|
|
|
|
|
2021-02-11 18:35:54 +00:00
|
|
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
|
|
|
inherit src;
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
hash = "sha256-gEFmj3/KvhvvsOK2nX2L1RUD4Wfp3nYzEzVnQZIsIDY=";
|
|
|
|
};
|
2021-01-04 13:45:30 +00:00
|
|
|
|
2021-02-11 18:35:54 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkg-config pythonImportsCheckHook ]
|
|
|
|
++ (with rustPlatform; [ cargoSetupHook maturinBuildHook ]);
|
2021-01-04 13:45:30 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2021-02-11 18:35:54 +00:00
|
|
|
pythonImportsCheck = [ "adblock" ];
|
2021-01-04 13:45:30 +00:00
|
|
|
|
2021-02-26 08:51:58 +00:00
|
|
|
meta = with lib; {
|
2021-01-04 13:45:30 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|