Commits

markotibold committed fe7b9a2

Added multiarch support for building in virtualenv on Ubuntu 11.

(rip from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632962)

Comments (0)

Files changed (1)

 #
 
 import glob, os, re, struct, sys
+import subprocess
+from distutils.spawn import find_executable
 
 # make it possible to run the setup script from another directory
 try:
             add_directory(library_dirs, "/lib64")
             add_directory(library_dirs, "/usr/lib64")
 
+            if find_executable('dpkg-architecture'):
+                # Debian/Ubuntu multiarch support.
+                proc = subprocess.Popen(
+                    'dpkg-architecture -qDEB_HOST_MULTIARCH'.split(),
+                    stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+                stdout, stderr = proc.communicate()
+                multiarch_path = stdout.strip()
+                add_directory(include_dirs, '/usr/include/' + multiarch_path)
+                add_directory(library_dirs, '/usr/lib/' + multiarch_path)
+
         add_directory(library_dirs, "/usr/local/lib")
         # FIXME: check /opt/stuff directories here?
 
         if prefix:
             add_directory(library_dirs, os.path.join(prefix, "lib"))
             add_directory(include_dirs, os.path.join(prefix, "include"))
-
+        print library_dirs, include_dirs
         #
         # locate tkinter libraries