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() |