Files
nixpkgs/pkgs/development/python-modules/adblock/default.nix
Ihar Hrachyshka dd0f03a56c treewide: remove usage of deprecated apple_sdk framework stubs
They are not doing anything right now. This is in preparation for their
complete removal from the tree.

Note: several changes that affect the derivation inputs (e.g. removal of
references to stub paths in build instructions) were left out. They will
be cleaned up the next iteration and will require special care.

Note: this PR is a result of a mix of ugly regex (not AST) based
automation and some manual labor. For reference, the regex automation
part was hacked in: https://github.com/booxter/nix-clean-apple_sdk

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-04-19 20:28:20 -04:00

98 lines
2.0 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
buildPythonPackage,
rustPlatform,
pkg-config,
openssl,
publicsuffix-list,
pythonOlder,
libiconv,
pytestCheckHook,
toml,
}:
buildPythonPackage rec {
pname = "adblock";
version = "0.6.0";
format = "pyproject";
disabled = pythonOlder "3.7";
# Pypi only has binary releases
src = fetchFromGitHub {
owner = "ArniDagur";
repo = "python-adblock";
tag = version;
hash = "sha256-5g5xdUzH/RTVwu4Vfb5Cb1t0ruG0EXgiXjrogD/+JCU=";
};
patches = [
# https://github.com/ArniDagur/python-adblock/pull/91
(fetchpatch {
name = "pep-621-compat.patch";
url = "https://github.com/ArniDagur/python-adblock/commit/2a8716e0723b60390f0aefd0e05f40ba598ac73f.patch";
hash = "sha256-n9+LDs0no66OdNZxw3aU57ngWrAbmm6hx4qIuxXoatM=";
})
];
postPatch = ''
substituteInPlace pyproject.toml \
--replace "0.0.0" "${version}"
'';
cargoDeps = rustPlatform.fetchCargoVendor {
inherit src;
name = "${pname}-${version}";
hash = "sha256-fetJX6HQxRZ/Az7rJeU9S+s8ttgNPnJEvTLfzGt4xjk=";
};
nativeBuildInputs =
[ pkg-config ]
++ (with rustPlatform; [
cargoSetupHook
maturinBuildHook
]);
buildInputs =
[ openssl ]
++ lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
];
PSL_PATH = "${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat";
nativeCheckInputs = [
pytestCheckHook
toml
];
preCheck = ''
# import from $out instead
rm -r adblock
'';
disabledTestPaths = [
# relies on directory removed above
"tests/test_typestubs.py"
];
pythonImportsCheck = [
"adblock"
"adblock.adblock"
];
meta = with lib; {
description = "Python wrapper for Brave's adblocking library";
homepage = "https://github.com/ArniDagur/python-adblock/";
changelog = "https://github.com/ArniDagur/python-adblock/blob/${version}/CHANGELOG.md";
maintainers = with maintainers; [ dotlambda ];
license = with licenses; [
asl20 # or
mit
];
};
}