summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authordoko@ubuntu.com <doko@ubuntu.com>2012-09-21 11:52:29 (GMT)
committerdoko@ubuntu.com <doko@ubuntu.com>2012-09-21 11:52:29 (GMT)
commit98b1c446d533f432352fa1970a14f5bf5dab68cb (patch)
treea740bdd9bb689d0991520cca804eca6069b92d2b /setup.py
parentf8a9a837c405ab5e8c8ad892188850480da9d0b1 (diff)
downloadcpython-98b1c446d533f432352fa1970a14f5bf5dab68cb.zip
cpython-98b1c446d533f432352fa1970a14f5bf5dab68cb.tar.gz
cpython-98b1c446d533f432352fa1970a14f5bf5dab68cb.tar.bz2
- 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 10ce79e..0dea9248 100644
--- a/setup.py
+++ b/setup.py
@@ -376,6 +376,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')