diff options
author | doko@ubuntu.com <doko@ubuntu.com> | 2012-08-08 10:15:55 (GMT) |
---|---|---|
committer | doko@ubuntu.com <doko@ubuntu.com> | 2012-08-08 10:15:55 (GMT) |
commit | 3277b35183ba48f7469484c9e6e09cc1bd46aa7d (patch) | |
tree | 978b4525bf19fe5eb5f1ac62201a3d0ab1631a21 /setup.py | |
parent | 20416a20b75913ba932a801b81bf643bed800520 (diff) | |
download | cpython-3277b35183ba48f7469484c9e6e09cc1bd46aa7d.zip cpython-3277b35183ba48f7469484c9e6e09cc1bd46aa7d.tar.gz cpython-3277b35183ba48f7469484c9e6e09cc1bd46aa7d.tar.bz2 |
- Issue #11715: Fix multiarch detection without having Debian development
tools (dpkg-dev) installed.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -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 = '' |