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].replace('.pure.', '.') |
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, f, ('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() |
64 # We walk the stack and ignore frames from our custom importer, |
64 # We walk the stack and ignore frames from our custom importer, |
65 # import mechanisms, and stdlib modules. This kinda/sorta |
65 # import mechanisms, and stdlib modules. This kinda/sorta |
66 # emulates CPython behavior in import.c while also attempting |
66 # emulates CPython behavior in import.c while also attempting |