File: 0002-Take-Multiarch-into-account-when-looking-for-xtables.patch

package info (click to toggle)
python-iptables 0.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 584 kB
  • sloc: python: 2,758; makefile: 93; ansic: 77
file content (47 lines) | stat: -rw-r--r-- 2,022 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From: =?utf-8?q?=22IOhannes_m_zm=C3=B6lnig_=28Debian/GNU=29=22?=
 <umlaeute@debian.org>
Date: Mon, 5 Sep 2016 20:57:45 +0200
Subject: Take Multiarch into account when looking for xtables

fixed typo in patch...
---
 iptc/xtables.py | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/iptc/xtables.py b/iptc/xtables.py
index 179649d..be5b2d4 100644
--- a/iptc/xtables.py
+++ b/iptc/xtables.py
@@ -804,23 +804,15 @@ else:
 _lib_xtables, xtables_version = find_library(_searchlib)
 _xtables_libdir = os.getenv("XTABLES_LIBDIR")
 if _xtables_libdir is None:
-    import re
-    ldconfig_path_regex = re.compile('^(/.*):$')
-    import subprocess
-    ldconfig = subprocess.Popen(
-        ('ldconfig', '-N', '-v'),
-        stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True
-    )
-    ldconfig_out, ldconfig_err = ldconfig.communicate()
-    if ldconfig.returncode != 0:
-        raise XTablesError("ldconfig failed, please set XTABLES_LIBDIR")
-    for ldconfig_out_line in ldconfig_out.splitlines():
-        ldconfig_path_regex_match = ldconfig_path_regex.match(ldconfig_out_line)
-        if ldconfig_path_regex_match is not None:
-            ldconfig_path = os.path.join(ldconfig_path_regex_match.group(1), 'xtables')
-            if os.path.isdir(ldconfig_path):
-                _xtables_libdir = ldconfig_path
-                break
+    import os.path
+    import sysconfig
+    archtriplet = sysconfig.get_config_var('MULTIARCH')
+    for xtdir in ["/lib/xtables", "/lib/%s/xtables" % (archtriplet,), "/usr/lib/xtables",
+                  "/usr/lib/iptables", "/usr/lib/%s/xtables" % (archtriplet,),
+                  "/usr/lib/%s/iptables" % (archtriplet,), "/usr/local/lib/xtables"]:
+        if os.path.isdir(xtdir):
+            _xtables_libdir = xtdir
+            break
 if _xtables_libdir is None:
     raise XTablesError("can't find directory with extensions; "
                        "please set XTABLES_LIBDIR")