~ubuntu-branches/ubuntu/raring/python3.3/raring-proposed

« back to all changes in this revision

Viewing changes to debian/mincheck.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-03-22 06:14:01 UTC
  • Revision ID: package-import@ubuntu.com-20120322061401-vvrgvw3nvi68rtqq
Tags: 3.3.0~a1-1
* Python 3.3.0 alpha1 release.
* Update to 20120321 from the trunk.
* Update debian/copyright.
* Build-depend on expat (>= 2.1~).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
import sys
 
3
 
 
4
def get_listed(fn):
 
5
    modules = set()
 
6
    for line in open(fn).readlines():
 
7
        modules.add(line.split()[1])
 
8
    return modules
 
9
 
 
10
def get_dependencies(fn):
 
11
    t = eval(open(fn).read())
 
12
    modules = set()
 
13
    depgraph = t['depgraph']
 
14
    for mod, deps in depgraph.items():
 
15
        if mod != '__main__':
 
16
            modules.add(mod)
 
17
        modules.update(deps.keys())
 
18
    return depgraph, modules
 
19
 
 
20
def main():
 
21
    mods = get_listed(sys.argv[1])
 
22
    depgraph, deps = get_dependencies(sys.argv[2])
 
23
    print("Listed modules:", sorted(mods))
 
24
    print("")
 
25
    print("Dependent modules:", sorted(deps))
 
26
    print("")
 
27
 
 
28
    missing = deps.difference(mods)
 
29
    if missing:
 
30
        print("Missing modules in python-minimal:")
 
31
        print(missing)
 
32
    for m in missing:
 
33
        users = []
 
34
        for caller, callees in depgraph.items():
 
35
            if m in callees:
 
36
                users.append(caller)
 
37
        print(m, "used in: ", users)
 
38
    sys.exit(len(missing))
 
39
 
 
40
main()
 
41