python3Packages.adblock: switch to buildPythonPackage + cargo hooks
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
{ stdenv
|
{ stdenv
|
||||||
, lib
|
, lib
|
||||||
, rustPlatform
|
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, pipInstallHook
|
, buildPythonPackage
|
||||||
|
, rustPlatform
|
||||||
, pythonImportsCheckHook
|
, pythonImportsCheckHook
|
||||||
, maturin
|
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, openssl
|
, openssl
|
||||||
, publicsuffix-list
|
, publicsuffix-list
|
||||||
@@ -13,7 +12,7 @@
|
|||||||
, Security
|
, Security
|
||||||
}:
|
}:
|
||||||
|
|
||||||
rustPlatform.buildRustPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "adblock";
|
pname = "adblock";
|
||||||
version = "0.4.0";
|
version = "0.4.0";
|
||||||
disabled = isPy27;
|
disabled = isPy27;
|
||||||
@@ -25,33 +24,27 @@ rustPlatform.buildRustPackage rec {
|
|||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "10d6ks2fyzbizq3kb69q478idj0h86k6ygjb6wl3zq3mf65ma4zg";
|
sha256 = "10d6ks2fyzbizq3kb69q478idj0h86k6ygjb6wl3zq3mf65ma4zg";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cargoDeps = rustPlatform.fetchCargoTarball {
|
||||||
|
inherit src;
|
||||||
|
name = "${pname}-${version}";
|
||||||
|
hash = "sha256-gEFmj3/KvhvvsOK2nX2L1RUD4Wfp3nYzEzVnQZIsIDY=";
|
||||||
|
};
|
||||||
|
|
||||||
format = "pyproject";
|
format = "pyproject";
|
||||||
|
|
||||||
cargoSha256 = "0di05j942rrm2crpdpp9czhh65fmidyrvdp2n3pipgnagy7nchc0";
|
nativeBuildInputs = [ pkg-config pythonImportsCheckHook ]
|
||||||
|
++ (with rustPlatform; [ cargoSetupHook maturinBuildHook ]);
|
||||||
nativeBuildInputs = [ pipInstallHook maturin pkg-config pythonImportsCheckHook ];
|
|
||||||
|
|
||||||
buildInputs = [ openssl ]
|
buildInputs = [ openssl ]
|
||||||
++ lib.optionals stdenv.isDarwin [ CoreFoundation Security ];
|
++ lib.optionals stdenv.isDarwin [ CoreFoundation Security ];
|
||||||
|
|
||||||
PSL_PATH = "${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat";
|
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
|
# There are no rust tests
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
pythonImportsCheck = [ "adblock" ];
|
|
||||||
|
|
||||||
installPhase = ''
|
pythonImportsCheck = [ "adblock" ];
|
||||||
runHook preInstall
|
|
||||||
install -Dm644 -t dist target/wheels/*.whl
|
|
||||||
pipInstallPhase
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru.meta = with lib; {
|
passthru.meta = with lib; {
|
||||||
description = "Python wrapper for Brave's adblocking library, which is written in Rust";
|
description = "Python wrapper for Brave's adblocking library, which is written in Rust";
|
||||||
|
|||||||
Reference in New Issue
Block a user