Skip to content

Commit baf3509

Browse files
authored
Merge pull request #226 from benjaminp/xtables-version-by-env
allow explicitly picking the xtables version
2 parents a2abf9d + d4537ea commit baf3509

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

iptc/xtables.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,10 +798,14 @@ class XTablesError(Exception):
798798
_optind = ct.c_long.in_dll(_libc, "optind")
799799
_optarg = ct.c_char_p.in_dll(_libc, "optarg")
800800

801-
_lib_xtables, xtables_version = find_library("xtables")
801+
xtables_version = os.getenv("PYTHON_IPTABLES_XTABLES_VERSION")
802+
if xtables_version:
803+
_searchlib = "libxtables.so.%s" % (xtables_version,)
804+
else:
805+
_searchlib = "xtables"
806+
_lib_xtables, xtables_version = find_library(_searchlib)
802807
_xtables_libdir = os.getenv("XTABLES_LIBDIR")
803808
if _xtables_libdir is None:
804-
import os.path
805809
for xtdir in ["/lib/xtables", "/lib64/xtables", "/usr/lib/xtables",
806810
"/usr/lib/iptables", "/usr/lib64/xtables",
807811
"/usr/lib64/iptables", "/usr/local/lib/xtables",

0 commit comments

Comments
 (0)