[PATCH 3 of 3] py3: remove superfluous indent from check-py3-compat.py
Augie Fackler
raf at durin42.com
Sun Oct 9 04:47:42 EDT 2016
On Sun, Oct 09, 2016 at 09:17:57AM +0200, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1475940160 -7200
> # Sat Oct 08 17:22:40 2016 +0200
> # Node ID e6f44ecf2b4afc13f583b0431a25d8e44dd6b09f
> # Parent fbd4b7cbb2930550f164f1fef3c3a8a64011a4c8
> py3: remove superfluous indent from check-py3-compat.py
Queued these. Many thanks!
>
> diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py
> --- a/contrib/check-py3-compat.py
> +++ b/contrib/check-py3-compat.py
> @@ -56,33 +56,32 @@ def check_compat_py3(f):
> 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:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list