From 3277b35183ba48f7469484c9e6e09cc1bd46aa7d Mon Sep 17 00:00:00 2001 From: "doko@ubuntu.com" Date: Wed, 8 Aug 2012 12:15:55 +0200 Subject: - Issue #11715: Fix multiarch detection without having Debian development tools (dpkg-dev) installed. --- Misc/NEWS | 3 +++ setup.py | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index 9b53ce9..53975f0 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -312,6 +312,9 @@ Tests Build ----- +- Issue #11715: Fix multiarch detection without having Debian development + tools (dpkg-dev) installed. + - Issue #15037: Build OS X installers with local copy of ncurses 5.9 libraries to avoid curses.unget_wch bug present in older versions of ncurses such as those shipped with OS X. diff --git a/setup.py b/setup.py index bc1e1bb..7f863a4 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 = '' -- cgit v0.12