Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3277b35

Browse files
committed
- Issue #11715: Fix multiarch detection without having Debian development
tools (dpkg-dev) installed.
1 parent 20416a2 commit 3277b35

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ Tests
312312
Build
313313
-----
314314

315+
- Issue #11715: Fix multiarch detection without having Debian development
316+
tools (dpkg-dev) installed.
317+
315318
- Issue #15037: Build OS X installers with local copy of ncurses 5.9 libraries
316319
to avoid curses.unget_wch bug present in older versions of ncurses such as
317320
those shipped with OS X.

setup.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,27 @@ def build_extension(self, ext):
379379
def add_multiarch_paths(self):
380380
# Debian/Ubuntu multiarch support.
381381
# https://wiki.ubuntu.com/MultiarchSpec
382+
cc = sysconfig.get_config_var('CC')
383+
tmpfile = os.path.join(self.build_temp, 'multiarch')
384+
if not os.path.exists(self.build_temp):
385+
os.makedirs(self.build_temp)
386+
ret = os.system(
387+
'%s -print-multiarch > %s 2> /dev/null' % (cc, tmpfile))
388+
multiarch_path_component = ''
389+
try:
390+
if ret >> 8 == 0:
391+
with open(tmpfile) as fp:
392+
multiarch_path_component = fp.readline().strip()
393+
finally:
394+
os.unlink(tmpfile)
395+
396+
if multiarch_path_component != '':
397+
add_dir_to_list(self.compiler.library_dirs,
398+
'/usr/lib/' + multiarch_path_component)
399+
add_dir_to_list(self.compiler.include_dirs,
400+
'/usr/include/' + multiarch_path_component)
401+
return
402+
382403
if not find_executable('dpkg-architecture'):
383404
return
384405
opt = ''

0 commit comments

Comments
 (0)