File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -405,7 +405,28 @@ def get_readelf_version():
405405 return int (match .group (1 )), int (match .group (2 ))
406406
407407 def get_readelf_output (self ):
408- command = ["readelf" , "-n" , sys .executable ]
408+ binary = sys .executable
409+ if sysconfig .get_config_var ("Py_ENABLE_SHARED" ):
410+ lib_dir = sysconfig .get_config_var ("LIBDIR" )
411+ if not lib_dir or sysconfig .is_python_build ():
412+ lib_dir = os .path .abspath (os .path .dirname (sys .executable ))
413+
414+ lib_names = []
415+ for name in (
416+ sysconfig .get_config_var ("INSTSONAME" ),
417+ sysconfig .get_config_var ("LDLIBRARY" ),
418+ ):
419+ if name and name not in lib_names :
420+ lib_names .append (name )
421+
422+ if lib_dir :
423+ for name in lib_names :
424+ libpython_path = os .path .join (lib_dir , name )
425+ if os .path .exists (libpython_path ):
426+ binary = libpython_path
427+ break
428+
429+ command = ["readelf" , "-n" , binary ]
409430 stdout , _ = subprocess .Popen (
410431 command ,
411432 stdout = subprocess .PIPE ,
You can’t perform that action at this time.
0 commit comments