File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -370,12 +370,33 @@ def get_platform(self):
370370 return platform
371371 return sys .platform
372372
373+ def add_multiarch_paths (self ):
374+ # Debian/Ubuntu multiarch support.
375+ # https://wiki.ubuntu.com/MultiarchSpec
376+ tmpfile = os .path .join (self .build_temp , 'multiarch' )
377+ if not os .path .exists (self .build_temp ):
378+ os .makedirs (self .build_temp )
379+ ret = os .system (
380+ 'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
381+ tmpfile )
382+ try :
383+ if ret >> 8 == 0 :
384+ with open (tmpfile ) as fp :
385+ multiarch_path_component = fp .readline ().strip ()
386+ add_dir_to_list (self .compiler .library_dirs ,
387+ '/usr/lib/' + multiarch_path_component )
388+ add_dir_to_list (self .compiler .include_dirs ,
389+ '/usr/include/' + multiarch_path_component )
390+ finally :
391+ os .unlink (tmpfile )
392+
373393 def detect_modules (self ):
374394 # Ensure that /usr/local is always used, but the local build
375395 # directories (i.e. '.' and 'Include') must be first. See issue
376396 # 10520.
377397 add_dir_to_list (self .compiler .library_dirs , '/usr/local/lib' )
378398 add_dir_to_list (self .compiler .include_dirs , '/usr/local/include' )
399+ self .add_multiarch_paths ()
379400
380401 # Add paths specified in the environment variables LDFLAGS and
381402 # CPPFLAGS for header and library files.
You can’t perform that action at this time.
0 commit comments