diff --git a/src/bin/get_pkgs_inst.py b/src/bin/get_pkgs_inst.py index c0eb214..95e2949 100755 --- a/src/bin/get_pkgs_inst.py +++ b/src/bin/get_pkgs_inst.py @@ -1,17 +1,25 @@ #!/usr/bin/env python # # get_pkgs_inst.py - get tuple (package,installation) from popcon results file +# +# results_file: org/popcon.debian.org/popcon-mail/results +import sys from operator import itemgetter + if __name__ == '__main__': + if len(sys.argv)<2: + print "Usage: get_pkgs_inst popcon_results_path" + exit(1) + + results_path = sys.argv[1] pkgs_inst = {} - with open("/root/org/popcon.debian.org/popcon-mail/results") as results: + with open(results_path) as results: for line in results: if line.startswith("Package"): fields = line.split() inst = int(fields[2])+int(fields[3])+int(fields[4]) - if inst > 20: - pkgs_inst[fields[1]] = inst + pkgs_inst[fields[1]] = inst sorted_by_inst = sorted(pkgs_inst.items(), key=itemgetter(1)) for pkg, inst in sorted_by_inst: print pkg, inst -- libgit2 0.21.2