contrib/check-py3-compat.py
changeset 29751 8faac092bb0c
parent 29550 1c22400db72d
child 30093 68010ed1636d
equal deleted inserted replaced
29750:297a0dc50320 29751:8faac092bb0c
    53     # Try to import the module.
    53     # Try to import the module.
    54     # For now we only support mercurial.* and hgext.* modules because figuring
    54     # For now we only support mercurial.* and hgext.* modules because figuring
    55     # out module paths for things not in a package can be confusing.
    55     # out module paths for things not in a package can be confusing.
    56     if f.startswith(('hgext/', 'mercurial/')) and not f.endswith('__init__.py'):
    56     if f.startswith(('hgext/', 'mercurial/')) and not f.endswith('__init__.py'):
    57         assert f.endswith('.py')
    57         assert f.endswith('.py')
    58         name = f.replace('/', '.')[:-3]
    58         name = f.replace('/', '.')[:-3].replace('.pure.', '.')
    59         with open(f, 'r') as fh:
    59         with open(f, 'r') as fh:
    60             try:
    60             try:
    61                 imp.load_module(name, fh, '', ('py', 'r', imp.PY_SOURCE))
    61                 imp.load_module(name, fh, '', ('py', 'r', imp.PY_SOURCE))
    62             except Exception as e:
    62             except Exception as e:
    63                 exc_type, exc_value, tb = sys.exc_info()
    63                 exc_type, exc_value, tb = sys.exc_info()