Improved listing of unused modules.

This commit is contained in:
Christoph Niethammer 2014-02-05 14:58:12 +00:00
parent 2759e769be
commit bf86f69321

View file

@ -6,6 +6,7 @@
import os import os
import datetime import datetime
from optparse import OptionParser from optparse import OptionParser
import re
import subprocess import subprocess
@ -78,10 +79,13 @@ if options.list_unused :
print "Unused modules:" print "Unused modules:"
print "-"*78 print "-"*78
avail_modules = [] avail_modules = []
p = subprocess.Popen("module -l av " + modulepattern, shell=True, stderr=subprocess.PIPE).stderr r = re.compile("\(.*\)")
p = subprocess.Popen("module av -t " + modulepattern, shell=True, stderr=subprocess.PIPE).stderr
for line in p : for line in p :
if line[0] == '/' :
continue
if modulepattern in line : if modulepattern in line :
avail_modules.append(line.split()[0]) avail_modules.append(r.sub('', line.strip()))
for module in avail_modules : for module in avail_modules :
if not module in modulestats : if not module in modulestats :
print module print module