]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
- Issue #11715: Fix multiarch detection without having Debian development
authordoko@ubuntu.com <doko@ubuntu.com>
Fri, 21 Sep 2012 11:51:40 +0000 (13:51 +0200)
committerdoko@ubuntu.com <doko@ubuntu.com>
Fri, 21 Sep 2012 11:51:40 +0000 (13:51 +0200)
  tools (dpkg-dev) installed.

Misc/NEWS
setup.py

index a082a24382f0368529a6b7a73c080b94d15e4962..e73499810427f6c9d30af1bc68bb875823ae42e7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -400,6 +400,9 @@ Tests
 Build
 -----
 
+- Issue #11715: Fix multiarch detection without having Debian development
+  tools (dpkg-dev) installed.
+
 - Issue #15819: Make sure we can build Python out-of-tree from a readonly
   source directory.  (Somewhat related to Issue #9860.)
 
index 7b3a535778338323cae313f66d568b8dd97139b5..1791fbe2821a05d844a3e9792e6a5b005a5b29ee 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -351,6 +351,27 @@ class PyBuildExt(build_ext):
     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')