Represent a shared library with name, dependencies and other stats
Definition at line 54 of file dlldep.py.
◆ __init__()
def dlldep.SharedLib.__init__ |
( |
|
self, |
|
|
|
distance, |
|
|
|
lib |
|
) |
| |
Definition at line 57 of file dlldep.py.
59 lib = osp.expanduser(osp.expandvars(lib))
60 if not osp.exists(lib):
61 l = Dso.find_library(lib)
64 assert osp.exists(lib),
"no such path [%s]" % (lib,)
66 self.distance = distance
67 self.deplibs = self._getLibs(lib)
◆ _getLibs()
def dlldep.SharedLib._getLibs |
( |
|
self, |
|
|
|
lib |
|
) |
| |
|
private |
Get direct dependencies of shared library
Definition at line 69 of file dlldep.py.
69 def _getLibs(self, lib):
70 """Get direct dependencies of shared library"""
73 cachedlib = Cache.files.get(lib)
74 if cachedlib:
return cachedlib.deplibs
78 encargs = {
'encoding' :
'utf-8'}
79 p = sp.Popen([
"readelf",
"-d",lib], stdout=sp.PIPE, **encargs)
80 output = p.communicate()[0]
82 print (
"Cannot run 'readelf' on",lib)
86 for l
in output.split(
"\n"):
87 if l.find(
"NEEDED")==-1:
continue
88 libs += [l.split()[-1].strip(
"[]")]
91 p = sp.Popen([
"ldd",lib], stdout=sp.PIPE, **encargs)
92 output = p.communicate()[0]
94 print (
"Cannot run 'ldd' on",lib)
98 for l
in output.split(
"\n"):
99 fields = l.strip().
split()
100 if len(fields)!=4:
continue
102 if (fields[0]
in libs)
and len(path)>0:
◆ deplibs
◆ distance
dlldep.SharedLib.distance |
◆ lib
The documentation for this class was generated from the following file: