bluetooth: rework the info_valid logic to be more tolerant
[pulseaudio-mirror.git] / src / depmod.py
blob6cb3cb2169562b38bc5507715f7f8a7bc5849826
1 #!/usr/bin/python
3 # This file is part of PulseAudio.
5 # PulseAudio is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # PulseAudio is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with PulseAudio; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18 # USA.
20 import sys, os, string
22 exported_symbols = {}
23 imported_symbols = {}
25 for fn in sys.argv[1:]:
26 f = os.popen("nm '%s'" % fn, "r")
28 imported_symbols[fn] = []
30 for line in f:
31 sym_address = line[:7].strip()
32 sym_type = line[9].strip()
33 sym_name = line[11:].strip()
35 if sym_name in ('_fini', '_init'):
36 continue
38 if sym_type in ('T', 'B', 'R', 'D' 'G', 'S', 'D'):
39 if exported_symbols.has_key(sym_name):
40 sys.stderr.write("CONFLICT: %s defined in both '%s' and '%s'.\n" % (sym_name, fn, exported_symbols[sym_name]))
41 else:
42 exported_symbols[sym_name] = fn
43 elif sym_type in ('U',):
44 if sym_name[:3] == 'pa_':
45 imported_symbols[fn].append(sym_name)
47 f.close()
49 dependencies = {}
50 unresolved_symbols = {}
52 for fn in imported_symbols:
53 dependencies[fn] = []
55 for sym in imported_symbols[fn]:
56 if exported_symbols.has_key(sym):
57 if exported_symbols[sym] not in dependencies[fn]:
58 dependencies[fn].append(exported_symbols[sym])
59 else:
60 if unresolved_symbols.has_key(sym):
61 unresolved_symbols[sym].append(fn)
62 else:
63 unresolved_symbols[sym] = [fn]
65 for sym, files in unresolved_symbols.iteritems():
66 print "WARNING: Unresolved symbol '%s' in %s" % (sym, `files`)
68 k = dependencies.keys()
69 k.sort()
70 for fn in k:
71 dependencies[fn].sort()
72 print "%s: %s" % (fn, string.join(dependencies[fn], " "))