summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2011-04-07 15:28:11 (GMT)
committerBarry Warsaw <barry@python.org>2011-04-07 15:28:11 (GMT)
commitffc9caf9fefe511b1469d1f6de64ddc420a2b949 (patch)
tree9141cfc75e3f2033b96a912525011afc773b0e19 /setup.py
parentc2b0d76bf3387cd4841acde40f232051d4ddf23f (diff)
downloadcpython-ffc9caf9fefe511b1469d1f6de64ddc420a2b949.zip
cpython-ffc9caf9fefe511b1469d1f6de64ddc420a2b949.tar.gz
cpython-ffc9caf9fefe511b1469d1f6de64ddc420a2b949.tar.bz2
Backport for Python 2.7 of issue 11715 support for building Python on
multiarch Debian/Ubuntu.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index 38f21d8..6b47451 100644
--- a/setup.py
+++ b/setup.py
@@ -345,10 +345,33 @@ class PyBuildExt(build_ext):
return platform
return sys.platform
+ def add_multiarch_paths(self):
+ # Debian/Ubuntu multiarch support.
+ # https://wiki.ubuntu.com/MultiarchSpec
+ if not find_executable('dpkg-architecture'):
+ return
+ 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
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.