Submitter | Yuya Nishihara |
---|---|
Date | Oct. 9, 2016, 3:23 p.m. |
Message ID | <7da151679301cf2a8331.1476026623@mimosa> |
Download | mbox | patch |
Permalink | /patch/17015/ |
State | Accepted |
Headers | show |
Comments
On Sun, Oct 09, 2016 at 05:23:43PM +0200, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1476025354 -7200 > # Sun Oct 09 17:02:34 2016 +0200 > # Node ID 7da151679301cf2a8331e411597f648bf3dce6b2 > # Parent 8e42dfde93d10e099040e9b57c70b7774235d883 > py3: make check-py3-compat.py import importlib only if necessary Queued, many thanks. > > importlib isn't available on Python 2.6, and it isn't necessary for Py2 > checks. > > 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 > @@ -10,7 +10,6 @@ > from __future__ import absolute_import, print_function > > import ast > -import importlib > import os > import sys > import traceback > @@ -41,6 +40,7 @@ def check_compat_py2(f): > > def check_compat_py3(f): > """Check Python 3 compatibility of a file with Python 3.""" > + import importlib # not available on Python 2.6 > with open(f, 'rb') as fh: > content = fh.read() > > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
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 @@ -10,7 +10,6 @@ from __future__ import absolute_import, print_function import ast -import importlib import os import sys import traceback @@ -41,6 +40,7 @@ def check_compat_py2(f): def check_compat_py3(f): """Check Python 3 compatibility of a file with Python 3.""" + import importlib # not available on Python 2.6 with open(f, 'rb') as fh: content = fh.read()