File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -339,10 +339,31 @@ def get_platform(self):
339339 return platform
340340 return sys .platform
341341
342+ def add_multiarch_paths (self ):
343+ # Debian/Ubuntu multiarch support.
344+ # https://wiki.ubuntu.com/MultiarchSpec
345+ tmpfile = os .path .join (self .build_temp , 'multiarch' )
346+ if not os .path .exists (self .build_temp ):
347+ os .makedirs (self .build_temp )
348+ ret = os .system (
349+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
350+ tmpfile )
351+ try :
352+ if ret >> 8 == 0 :
353+ with open (tmpfile ) as fp :
354+ multiarch_path_component = fp .readline ().strip ()
355+ add_dir_to_list (self .compiler .library_dirs ,
356+ '/usr/lib/' + multiarch_path_component )
357+ add_dir_to_list (self .compiler .include_dirs ,
358+ '/usr/include/' + multiarch_path_component )
359+ finally :
360+ os .unlink (tmpfile )
361+
342362 def detect_modules (self ):
343363 # Ensure that /usr/local is always used
344364 add_dir_to_list (self .compiler .library_dirs , '/usr/local/lib' )
345365 add_dir_to_list (self .compiler .include_dirs , '/usr/local/include' )
366+ self .add_multiarch_paths ()
346367
347368 # Add paths specified in the environment variables LDFLAGS and
348369 # CPPFLAGS for header and library files.
You can’t perform that action at this time.
0 commit comments