~ubuntu-branches/ubuntu/maverick/python3.1/maverick

« back to all changes in this revision

Viewing changes to debian/mincheck.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-03-23 00:01:27 UTC
  • Revision ID: james.westby@ubuntu.com-20090323000127-mr2oo53y4j8vpldi
Tags: 3.1~a1+20090322-1
* Python 3.1 alpha1 release.
* Update to the trunk, 20090322.
* Update installation schemes: LP: #338395.
  - When the --prefix option is used for setup.py install, Use the
    `unix_prefix' scheme.
  - Use the `deb_system' scheme if --install-layout=deb is specified.
  - Use the the `unix_local' scheme if neither --install-layout=deb
    nor --prefix is specified.
* Use the information in /etc/lsb-release for platform.dist(). LP: #196526.
* pydoc: Fix detection of local documentation files.
* Build a shared library configured --with-pydebug. LP: #322580.
* Fix some lintian warnings.

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