churchyard / rpms / python2

Forked from rpms/python2 6 years ago
Clone
2027616
diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py
2027616
index ab10ec5..923d1b7 100644
2027616
--- a/Lib/ctypes/util.py
2027616
+++ b/Lib/ctypes/util.py
2027616
@@ -140,11 +140,15 @@ elif os.name == "posix":
2027616
             # assuming GNU binutils / ELF
2027616
             if not f:
2027616
                 return None
2027616
-            cmd = 'if ! type objdump >/dev/null 2>&1; then exit; fi;' \
2027616
+            cmd = 'if ! type objdump >/dev/null 2>&1; then exit 10; fi;' \
2027616
                   'objdump -p -j .dynamic 2>/dev/null "$1"'
2027616
             proc = subprocess.Popen((cmd, '_get_soname', f), shell=True,
2027616
                                     stdout=subprocess.PIPE)
2027616
             [dump, _] = proc.communicate()
2027616
+            if proc.returncode == 10:
2027616
+                return os.path.basename(f) #  This is good for GLibc, I think,
2027616
+                                           # and a dep on binutils is big (for
2027616
+                                           # live CDs).
2027616
             res = re.search(br'\sSONAME\s+([^\s]+)', dump)
2027616
             if not res:
2027616
                 return None