Merge pull request #276123 from alaviss/nftables-py
nftables: split python package from main
This commit is contained in:
commit
77d99f85c3
@ -5,7 +5,6 @@
|
||||
, autoreconfHook
|
||||
, withDebugSymbols ? false
|
||||
, withCli ? true, libedit
|
||||
, withPython ? false, python3
|
||||
, withXtables ? true, iptables
|
||||
, nixosTests
|
||||
}:
|
||||
@ -29,25 +28,12 @@ stdenv.mkDerivation rec {
|
||||
libmnl libnftnl libpcap
|
||||
gmp jansson
|
||||
] ++ lib.optional withCli libedit
|
||||
++ lib.optional withXtables iptables
|
||||
++ lib.optionals withPython [
|
||||
python3
|
||||
python3.pkgs.setuptools
|
||||
];
|
||||
|
||||
patches = [ ./fix-py-libnftables.patch ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace "py/src/nftables.py" \
|
||||
--subst-var-by "out" "$out"
|
||||
'';
|
||||
++ lib.optional withXtables iptables;
|
||||
|
||||
configureFlags = [
|
||||
"--with-json"
|
||||
(lib.withFeatureAs withCli "cli" "editline")
|
||||
] ++ lib.optional (!withDebugSymbols) "--disable-debug"
|
||||
++ lib.optional (!withPython) "--disable-python"
|
||||
++ lib.optional withPython "--enable-python"
|
||||
++ lib.optional withXtables "--with-xtables";
|
||||
|
||||
passthru.tests = {
|
||||
|
@ -1,13 +0,0 @@
|
||||
diff --git a/py/src/nftables.py b/py/src/nftables.py
|
||||
index f1e43ade..9adcd1be 100644
|
||||
--- a/py/src/nftables.py
|
||||
+++ b/py/src/nftables.py
|
||||
@@ -69,7 +69,7 @@ class Nftables:
|
||||
|
||||
validator = None
|
||||
|
||||
- def __init__(self, sofile="libnftables.so.1"):
|
||||
+ def __init__(self, sofile="@out@/lib/libnftables.so.1"):
|
||||
"""Instantiate a new Nftables class object.
|
||||
|
||||
Accepts a shared object file to open, by default standard search path
|
26
pkgs/os-specific/linux/nftables/python.nix
Normal file
26
pkgs/os-specific/linux/nftables/python.nix
Normal file
@ -0,0 +1,26 @@
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, setuptools
|
||||
, nftables
|
||||
}:
|
||||
|
||||
buildPythonPackage {
|
||||
pname = "nftables";
|
||||
inherit (nftables) version src;
|
||||
pyproject = true;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace "py/src/nftables.py" \
|
||||
--replace-fail "libnftables.so.1" "${nftables}/lib/libnftables.so.1"
|
||||
'';
|
||||
|
||||
setSourceRoot = "sourceRoot=$(echo */py)";
|
||||
|
||||
build-system = [ setuptools ];
|
||||
|
||||
pythonImportsCheck = [ "nftables" ];
|
||||
|
||||
meta = {
|
||||
inherit (nftables.meta) description homepage license platforms maintainers;
|
||||
};
|
||||
}
|
@ -8684,10 +8684,9 @@ self: super: with self; {
|
||||
|
||||
nfcpy = callPackage ../development/python-modules/nfcpy { };
|
||||
|
||||
nftables = toPythonModule (pkgs.nftables.override {
|
||||
python3 = python;
|
||||
withPython = true;
|
||||
});
|
||||
nftables = callPackage ../os-specific/linux/nftables/python.nix {
|
||||
inherit (pkgs) nftables;
|
||||
};
|
||||
|
||||
nh3 = callPackage ../development/python-modules/nh3 { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user