summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authordoko <doko@ubuntu.com>2012-08-08 12:15:55 +0200
committerdoko <doko@ubuntu.com>2012-08-08 12:15:55 +0200
commit5c8a9e142fcd3ec23b7c8ae5d8b84b6c0dd311fa (patch)
treea1ed0722a98f50b73d32d17ad859b75f0d33dc5d /setup.py
parent34dbd9bd05fba142fec28e355b086b6c4994055c (diff)
downloadcpython-5c8a9e142fcd3ec23b7c8ae5d8b84b6c0dd311fa.tar.gz
- Issue #11715: Fix multiarch detection without having Debian development
tools (dpkg-dev) installed.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index bc1e1bbd87..7f863a4789 100644
--- a/setup.py
+++ b/setup.py
@@ -379,6 +379,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
opt = ''