# HG changeset patch # User Yuya Nishihara # Date 1475940160 -7200 # Node ID e8aeeb28e35ece3a38ea479549810a949c23056c # Parent f701fffd21d89c542d5795a98990eb6b5aa9171a py3: remove superfluous indent from check-py3-compat.py diff -r f701fffd21d8 -r e8aeeb28e35e contrib/check-py3-compat.py --- a/contrib/check-py3-compat.py Sat Oct 08 17:22:07 2016 +0200 +++ b/contrib/check-py3-compat.py Sat Oct 08 17:22:40 2016 +0200 @@ -56,33 +56,32 @@ if f.startswith(('hgext/', 'mercurial/')) and not f.endswith('__init__.py'): assert f.endswith('.py') name = f.replace('/', '.')[:-3].replace('.pure.', '.') - if True: - try: - importlib.import_module(name) - except Exception as e: - exc_type, exc_value, tb = sys.exc_info() - # We walk the stack and ignore frames from our custom importer, - # import mechanisms, and stdlib modules. This kinda/sorta - # emulates CPython behavior in import.c while also attempting - # to pin blame on a Mercurial file. - for frame in reversed(traceback.extract_tb(tb)): - if frame.name == '_call_with_frames_removed': - continue - if 'importlib' in frame.filename: - continue - if 'mercurial/__init__.py' in frame.filename: - continue - if frame.filename.startswith(sys.prefix): - continue - break + try: + importlib.import_module(name) + except Exception as e: + exc_type, exc_value, tb = sys.exc_info() + # We walk the stack and ignore frames from our custom importer, + # import mechanisms, and stdlib modules. This kinda/sorta + # emulates CPython behavior in import.c while also attempting + # to pin blame on a Mercurial file. + for frame in reversed(traceback.extract_tb(tb)): + if frame.name == '_call_with_frames_removed': + continue + if 'importlib' in frame.filename: + continue + if 'mercurial/__init__.py' in frame.filename: + continue + if frame.filename.startswith(sys.prefix): + continue + break - if frame.filename: - filename = os.path.basename(frame.filename) - print('%s: error importing: <%s> %s (error at %s:%d)' % ( - f, type(e).__name__, e, filename, frame.lineno)) - else: - print('%s: error importing module: <%s> %s (line %d)' % ( - f, type(e).__name__, e, frame.lineno)) + if frame.filename: + filename = os.path.basename(frame.filename) + print('%s: error importing: <%s> %s (error at %s:%d)' % ( + f, type(e).__name__, e, filename, frame.lineno)) + else: + print('%s: error importing module: <%s> %s (line %d)' % ( + f, type(e).__name__, e, frame.lineno)) if __name__ == '__main__': if sys.version_info[0] == 2: