diff options
author | Milan <me@pbb.lc> | 2021-01-04 14:45:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-04 14:45:30 +0100 |
commit | e326297f6c8d01d996219c796245b061d61b1eb0 (patch) | |
tree | 07739388c5528e883ff5748f729f2b176154399f /pkgs | |
parent | 1bf12e37b31f9480d47ee693cee2a74831f7d2f0 (diff) |
python3Packages.adblock: init at 0.4.0 (#108271)
This packages python bindings to Brave's Rust adblock library. These will be used in the upcoming qutebrowser version 2.0.0 for more granular adblocking.
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/development/python-modules/adblock/default.nix | 63 | ||||
-rw-r--r-- | pkgs/top-level/python-packages.nix | 4 |
2 files changed, 67 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/adblock/default.nix b/pkgs/development/python-modules/adblock/default.nix new file mode 100644 index 0000000000000..de6d72a61ecfa --- /dev/null +++ b/pkgs/development/python-modules/adblock/default.nix @@ -0,0 +1,63 @@ +{ stdenv +, lib +, rustPlatform +, fetchFromGitHub +, pipInstallHook +, pythonImportsCheckHook +, maturin +, pkg-config +, openssl +, publicsuffix-list +, isPy27 +, CoreFoundation +, Security +}: + +rustPlatform.buildRustPackage 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"; + }; + format = "pyproject"; + + cargoSha256 = "0di05j942rrm2crpdpp9czhh65fmidyrvdp2n3pipgnagy7nchc0"; + + nativeBuildInputs = [ pipInstallHook maturin pkg-config pythonImportsCheckHook ]; + + buildInputs = [ openssl ] + ++ lib.optionals stdenv.isDarwin [ CoreFoundation Security ]; + + PSL_PATH = "${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat"; + + buildPhase = '' + runHook preBuild + maturin build --release --manylinux off --strip + runHook postBuild + ''; + + # There are no rust tests + doCheck = false; + pythonImportsCheck = [ "adblock" ]; + + installPhase = '' + runHook preInstall + install -Dm644 -t dist target/wheels/*.whl + pipInstallPhase + runHook postInstall + ''; + + passthru.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 ]; + platforms = with platforms; [ all ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index f600b22ff0a41..51e66edc5b47d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -167,6 +167,10 @@ in { adb-shell = callPackage ../development/python-modules/adb-shell { }; + adblock = callPackage ../development/python-modules/adblock { + inherit (pkgs.darwin.apple_sdk.frameworks) CoreFoundation Security; + }; + addic7ed-cli = callPackage ../development/python-modules/addic7ed-cli { }; adguardhome= callPackage ../development/python-modules/adguardhome { }; |