Source

pypy / pypy / bin / checkmodule.py

#! /usr/bin/env python
"""
Usage:  checkmodule.py <module-name>

Check annotation and rtyping of the PyPy extension module from
pypy/module/<module-name>/.  Useful for testing whether a
modules compiles without doing a full translation.
"""
import autopath
import sys, os

from pypy.objspace.fake.checkmodule import checkmodule

def main(argv):
    if len(argv) != 2:
        print >> sys.stderr, __doc__
        sys.exit(2)
    modname = argv[1]
    if modname in ('-h', '--help'):
        print >> sys.stderr, __doc__
        sys.exit(0)
    if modname.startswith('-'):
        print >> sys.stderr, "Bad command line"
        print >> sys.stderr, __doc__
        sys.exit(1)
    if os.path.sep in modname:
        if os.path.basename(modname) == '':
            modname = os.path.dirname(modname)
        if os.path.basename(os.path.dirname(modname)) != 'module':
            print >> sys.stderr, "Must give '../module/xxx', or just 'xxx'."
            sys.exit(1)
        modname = os.path.basename(modname)
    try:
        checkmodule(modname)
    except Exception, e:
        import traceback, pdb
        traceback.print_exc()
        pdb.post_mortem(sys.exc_info()[2])
        return 1
    else:
        print 'Passed.'
        return 0

if __name__ == '__main__':
    sys.exit(main(sys.argv))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.