[Python-checkins] cpython (merge 3.2 -> default): Issue 11715: Merge multiarch fix from 3.1 branch.

barry.warsaw python-checkins at python.org
Wed Apr 6 22:35:39 CEST 2011


http://hg.python.org/cpython/rev/3f00611c3daf
changeset:   69176:3f00611c3daf
parent:      69173:184ddd9acd5a
parent:      69175:867937dd2279
user:        Barry Warsaw <barry at python.org>
date:        Wed Apr 06 15:19:25 2011 -0400
summary:
  Issue 11715: Merge multiarch fix from 3.1 branch.

files:
  setup.py |  21 +++++++++++++++++++++
  1 files changed, 21 insertions(+), 0 deletions(-)


diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -370,12 +370,33 @@
                 return platform
         return sys.platform
 
+    def add_multiarch_paths(self):
+        # Debian/Ubuntu multiarch support.
+        # https://wiki.ubuntu.com/MultiarchSpec
+        tmpfile = os.path.join(self.build_temp, 'multiarch')
+        if not os.path.exists(self.build_temp):
+            os.makedirs(self.build_temp)
+        ret = os.system(
+            'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
+            tmpfile)
+        try:
+            if ret >> 8 == 0:
+                with open(tmpfile) as fp:
+                    multiarch_path_component = fp.readline().strip()
+                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)
+        finally:
+            os.unlink(tmpfile)
+
     def detect_modules(self):
         # Ensure that /usr/local is always used, but the local build
         # directories (i.e. '.' and 'Include') must be first.  See issue
         # 10520.
         add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
         add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+        self.add_multiarch_paths()
 
         # Add paths specified in the environment variables LDFLAGS and
         # CPPFLAGS for header and library files.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list