Represent a shared library with name, dependencies and other stats
Definition at line 52 of file dlldep.py.
◆ __init__()
def dlldep.SharedLib.__init__ |
( |
|
self, |
|
|
|
distance, |
|
|
|
lib |
|
) |
| |
Definition at line 55 of file dlldep.py.
57 lib = osp.expanduser(osp.expandvars(lib))
58 if not osp.exists(lib):
59 l = Dso.find_library(lib)
62 assert osp.exists(lib),
"no such path [%s]" % (lib,)
64 self.distance = distance
65 self.deplibs = self._getLibs(lib)
◆ _getLibs()
def dlldep.SharedLib._getLibs |
( |
|
self, |
|
|
|
lib |
|
) |
| |
|
private |
Get direct dependencies of shared library
Definition at line 67 of file dlldep.py.
67 def _getLibs(self, lib):
68 """Get direct dependencies of shared library"""
71 cachedlib = Cache.files.get(lib)
72 if cachedlib:
return cachedlib.deplibs
76 encargs = {
'encoding' :
'utf-8'}
77 p = sp.Popen([
"readelf",
"-d",lib], stdout=sp.PIPE, **encargs)
78 output = p.communicate()[0]
80 print (
"Cannot run 'readelf' on",lib)
84 for l
in output.split(
"\n"):
85 if l.find(
"NEEDED")==-1:
continue
86 libs += [l.split()[-1].strip(
"[]")]
89 p = sp.Popen([
"ldd",lib], stdout=sp.PIPE, **encargs)
90 output = p.communicate()[0]
92 print (
"Cannot run 'ldd' on",lib)
96 for l
in output.split(
"\n"):
97 fields = l.strip().
split()
98 if len(fields)!=4:
continue
100 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: