Commit cb481d003d022ac107af31c7e3f5746befd1cac8
1 parent
03f75bb1
Exists in
master
and in
1 other branch
Removed hardcoded path
Showing
1 changed file
with
11 additions
and
3 deletions
Show diff stats
src/bin/get_pkgs_inst.py
1 | 1 | #!/usr/bin/env python |
2 | 2 | # |
3 | 3 | # get_pkgs_inst.py - get tuple (package,installation) from popcon results file |
4 | +# | |
5 | +# results_file: org/popcon.debian.org/popcon-mail/results | |
4 | 6 | |
7 | +import sys | |
5 | 8 | from operator import itemgetter |
9 | + | |
6 | 10 | if __name__ == '__main__': |
11 | + if len(sys.argv)<2: | |
12 | + print "Usage: get_pkgs_inst popcon_results_path" | |
13 | + exit(1) | |
14 | + | |
15 | + results_path = sys.argv[1] | |
7 | 16 | pkgs_inst = {} |
8 | - with open("/root/org/popcon.debian.org/popcon-mail/results") as results: | |
17 | + with open(results_path) as results: | |
9 | 18 | for line in results: |
10 | 19 | if line.startswith("Package"): |
11 | 20 | fields = line.split() |
12 | 21 | inst = int(fields[2])+int(fields[3])+int(fields[4]) |
13 | - if inst > 20: | |
14 | - pkgs_inst[fields[1]] = inst | |
22 | + pkgs_inst[fields[1]] = inst | |
15 | 23 | sorted_by_inst = sorted(pkgs_inst.items(), key=itemgetter(1)) |
16 | 24 | for pkg, inst in sorted_by_inst: |
17 | 25 | print pkg, inst | ... | ... |