diff --git a/module_stats.py b/module_stats.py index f3ec11b..f21e1a7 100755 --- a/module_stats.py +++ b/module_stats.py @@ -6,6 +6,7 @@ import os import datetime from optparse import OptionParser +import re import subprocess @@ -78,10 +79,13 @@ if options.list_unused : print "Unused modules:" print "-"*78 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 : + if line[0] == '/' : + continue if modulepattern in line : - avail_modules.append(line.split()[0]) + avail_modules.append(r.sub('', line.strip())) for module in avail_modules : if not module in modulestats : print module