changeset 32183:41d79475d440

check-code: exclude demandimport.py and policy.py from Python 3 checks These modules can't depend on pycompat.py, which means we have to write Py3 hacks in them.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 26 Apr 2017 21:51:19 +0900
parents ac641a41f98d
children cf424dae5dc7
files contrib/check-code.py tests/test-check-code.t
diffstat 2 files changed, 2 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Mon May 01 17:10:22 2017 +0900
+++ b/contrib/check-code.py	Wed Apr 26 21:51:19 2017 +0900
@@ -492,8 +492,8 @@
 checks = [
     ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
     ('python', r'.*hgext.*\.py$', '', [], pyextnfpats),
-    ('python 3', r'.*(hgext|mercurial)/(?!pycompat).*\.py', '',
-            pyfilters, py3pats),
+    ('python 3', r'.*(hgext|mercurial)/(?!demandimport|policy|pycompat).*\.py',
+     '', pyfilters, py3pats),
     ('test script', r'(.*/)?test-[^.~]*$', '', testfilters, testpats),
     ('c', r'.*\.[ch]$', '', cfilters, cpats),
     ('unified test', r'.*\.t$', '', utestfilters, utestpats),
--- a/tests/test-check-code.t	Mon May 01 17:10:22 2017 +0900
+++ b/tests/test-check-code.t	Wed Apr 26 21:51:19 2017 +0900
@@ -13,9 +13,6 @@
    >             r.revision(r.node(x))
    don't convert rev to node before passing to revision(nodeorrev)
   Skipping i18n/polib.py it has no-che?k-code (glob)
-  mercurial/demandimport.py:314:
-   >     if os.environ.get('HGDEMANDIMPORT') != 'disable':
-   use encoding.environ instead (py3)
   mercurial/encoding.py:54:
    >     environ = os.environ
    use encoding.environ instead (py3)
@@ -30,15 +27,6 @@
    use encoding.environ instead (py3)
   Skipping mercurial/httpclient/__init__.py it has no-che?k-code (glob)
   Skipping mercurial/httpclient/_readers.py it has no-che?k-code (glob)
-  mercurial/policy.py:46:
-   >     if 'HGMODULEPOLICY' in os.environ:
-   use encoding.environ instead (py3)
-  mercurial/policy.py:47:
-   >         policy = os.environ['HGMODULEPOLICY'].encode('utf-8')
-   use encoding.environ instead (py3)
-  mercurial/policy.py:49:
-   >     policy = os.environ.get('HGMODULEPOLICY', policy)
-   use encoding.environ instead (py3)
   Skipping mercurial/statprof.py it has no-che?k-code (glob)
   Skipping tests/badserverext.py it has no-che?k-code (glob)
   [1]