diff setup.py @ 79081:78aba41a8105 3.2

- Issue #11715: Fix multiarch detection without having Debian development tools (dpkg-dev) installed.
author doko@ubuntu.com
date Fri, 21 Sep 2012 13:52:29 +0200
parents 048e13546a7c
children 58646b0c5226 637634679bcd
line wrap: on
line diff
--- a/setup.py	Thu Sep 20 23:48:23 2012 -0400
+++ b/setup.py	Fri Sep 21 13:52:29 2012 +0200
@@ -376,6 +376,27 @@
     def add_multiarch_paths(self):
         # Debian/Ubuntu multiarch support.
         # https://wiki.ubuntu.com/MultiarchSpec
+        cc = sysconfig.get_config_var('CC')
+        tmpfile = os.path.join(self.build_temp, 'multiarch')
+        if not os.path.exists(self.build_temp):
+            os.makedirs(self.build_temp)
+        ret = os.system(
+            '%s -print-multiarch > %s 2> /dev/null' % (cc, tmpfile))
+        multiarch_path_component = ''
+        try:
+            if ret >> 8 == 0:
+                with open(tmpfile) as fp:
+                    multiarch_path_component = fp.readline().strip()
+        finally:
+            os.unlink(tmpfile)
+
+        if multiarch_path_component != '':
+            add_dir_to_list(self.compiler.library_dirs,
+                            '/usr/lib/' + multiarch_path_component)
+            add_dir_to_list(self.compiler.include_dirs,
+                            '/usr/include/' + multiarch_path_component)
+            return
+
         if not find_executable('dpkg-architecture'):
             return
         tmpfile = os.path.join(self.build_temp, 'multiarch')