From bf86f693213275843916fb5d24888b911592401e Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Wed, 5 Feb 2014 14:58:12 +0000 Subject: [PATCH] Improved listing of unused modules. --- module_stats.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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