7 """Get all NIC modules which discover is able to find"""
8 f = open('/lib/discover/pci.lst', 'r')
10 ethlinefilter = re.compile('ethernet')
11 modlist = filter(ethlinefilter.search, f)
14 tmplist = i.split('\t', 4)
20 if type == 'ethernet' and mod != 'unknown':
26 """Quite faster implementation of os.path.basename, submitted and accepted"""
31 """Generate an in-memory represenation of all module dependencies"""
33 moddepfile = open(sys.argv[1], 'r')
36 mainmod = tmplist.pop(0)
37 mainmod = mainmod.rstrip(':')
38 rawmod = mainmod.rstrip('.ko')
39 rawmod = basename(rawmod)
41 newlist.append((rawmod, mainmod))
45 newlist.append((a, i))
46 moddep[rawmod] = newlist
50 def generateOutput(modlist, moddep):
51 """Function to filter all keys from moddep not in modlist"""
55 for (j, k) in moddep[i]:
61 def calculateModuleDep():
62 modlist = getNicModules()
63 moddep = generateModDep()
64 output = generateOutput(modlist, moddep)
65 return output.values()
67 #############################################################################
69 if __name__ == '__main__':
70 if len(sys.argv) != 2:
71 print 'Error: you should give me the path to your modules.dep'
74 for i in calculateModuleDep():