##// END OF EJS Templates
py3: make check-py3-compat.py load modules in standard manner...
Yuya Nishihara -
r30094:f701fffd default
parent child Browse files
Show More
@@ -10,7 +10,7 b''
10 from __future__ import absolute_import, print_function
10 from __future__ import absolute_import, print_function
11
11
12 import ast
12 import ast
13 import imp
13 import importlib
14 import os
14 import os
15 import sys
15 import sys
16 import traceback
16 import traceback
@@ -56,9 +56,9 b' def check_compat_py3(f):'
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 if True:
60 try:
60 try:
61 imp.load_module(name, fh, f, ('py', 'r', imp.PY_SOURCE))
61 importlib.import_module(name)
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,
@@ -16,41 +16,27 b''
16 $ hg files 'set:(**.py) - grep(pygments)' | sed 's|\\|/|g' \
16 $ hg files 'set:(**.py) - grep(pygments)' | sed 's|\\|/|g' \
17 > | xargs $PYTHON3 contrib/check-py3-compat.py \
17 > | xargs $PYTHON3 contrib/check-py3-compat.py \
18 > | sed 's/[0-9][0-9]*)$/*)/'
18 > | sed 's/[0-9][0-9]*)$/*)/'
19 hgext/convert/bzr.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at bzr.py:*)
19 hgext/convert/bzr.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
20 hgext/convert/convcmd.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at convcmd.py:*)
20 hgext/convert/convcmd.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
21 hgext/convert/cvs.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at cvs.py:*)
21 hgext/convert/subversion.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
22 hgext/convert/darcs.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at darcs.py:*)
22 hgext/convert/transport.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
23 hgext/convert/filemap.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at filemap.py:*)
23 hgext/fsmonitor/pywatchman/capabilities.py: error importing: <ImportError> No module named 'pybser' (error at __init__.py:*)
24 hgext/convert/git.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at git.py:*)
24 hgext/fsmonitor/pywatchman/pybser.py: error importing: <ImportError> No module named 'pybser' (error at __init__.py:*)
25 hgext/convert/gnuarch.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at gnuarch.py:*)
25 hgext/fsmonitor/watchmanclient.py: error importing: <ImportError> No module named 'pybser' (error at __init__.py:*)
26 hgext/convert/hg.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at hg.py:*)
26 hgext/journal.py: error importing: <ValueError> Type names and field names must be valid identifiers: "b'journalentry'" (error at journal.py:*)
27 hgext/convert/monotone.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at monotone.py:*)
27 hgext/largefiles/basestore.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
28 hgext/convert/p4.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at p4.py:*)
28 hgext/largefiles/lfcommands.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
29 hgext/convert/subversion.py: error importing: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (error at subversion.py:*)
29 hgext/largefiles/lfutil.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
30 hgext/convert/transport.py: error importing: <ImportError> No module named 'svn.client' (error at transport.py:*)
30 hgext/largefiles/localstore.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
31 hgext/fsmonitor/watchmanclient.py: error importing: <SystemError> Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (error at watchmanclient.py:*)
31 hgext/largefiles/overrides.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
32 hgext/journal.py: error importing: <SystemError> Parent module 'hgext' not loaded, cannot perform relative import (error at journal.py:*)
32 hgext/largefiles/proto.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
33 hgext/largefiles/basestore.py: error importing: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at basestore.py:*)
33 hgext/largefiles/remotestore.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
34 hgext/largefiles/lfcommands.py: error importing: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at lfcommands.py:*)
34 hgext/largefiles/reposetup.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
35 hgext/largefiles/localstore.py: error importing: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at localstore.py:*)
35 hgext/largefiles/storefactory.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
36 hgext/largefiles/overrides.py: error importing: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at overrides.py:*)
36 hgext/largefiles/uisetup.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
37 hgext/largefiles/proto.py: error importing: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at proto.py:*)
37 hgext/largefiles/wirestore.py: error importing: <SyntaxError> cannot mix bytes and nonbytes literals (subversion.py, line 533) (error at convcmd.py:*)
38 hgext/largefiles/remotestore.py: error importing: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at remotestore.py:*)
38 hgext/mq.py: error importing: <TypeError> __import__() argument 1 must be str, not bytes (error at extensions.py:*)
39 hgext/largefiles/reposetup.py: error importing: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at reposetup.py:*)
40 hgext/largefiles/storefactory.py: error importing: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at storefactory.py:*)
41 hgext/largefiles/uisetup.py: error importing: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at uisetup.py:*)
42 hgext/largefiles/wirestore.py: error importing: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at wirestore.py:*)
43 hgext/mq.py: error importing: <TypeError> startswith first arg must be str or a tuple of str, not bytes (error at extensions.py:*)
44 hgext/rebase.py: error importing: <TypeError> Can't convert 'bytes' object to str implicitly (error at registrar.py:*)
45 hgext/record.py: error importing: <KeyError> '^commit|ci' (error at record.py:*)
46 hgext/shelve.py: error importing: <SystemError> Parent module 'hgext' not loaded, cannot perform relative import (error at shelve.py:*)
47 hgext/transplant.py: error importing: <TypeError> Can't convert 'bytes' object to str implicitly (error at registrar.py:*)
48 mercurial/encoding.py: error importing: <TypeError> bytes expected, not str (error at encoding.py:*)
49 mercurial/fileset.py: error importing: <TypeError> Can't convert 'bytes' object to str implicitly (error at registrar.py:*)
50 mercurial/i18n.py: error importing: <TypeError> bytes expected, not str (error at i18n.py:*)
51 mercurial/revset.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*)
52 mercurial/scmwindows.py: error importing: <ImportError> No module named 'winreg' (error at scmwindows.py:*)
39 mercurial/scmwindows.py: error importing: <ImportError> No module named 'winreg' (error at scmwindows.py:*)
53 mercurial/store.py: error importing: <TypeError> Can't convert 'bytes' object to str implicitly (error at store.py:*)
54 mercurial/win32.py: error importing: <ImportError> No module named 'msvcrt' (error at win32.py:*)
40 mercurial/win32.py: error importing: <ImportError> No module named 'msvcrt' (error at win32.py:*)
55 mercurial/windows.py: error importing: <ImportError> No module named 'msvcrt' (error at windows.py:*)
41 mercurial/windows.py: error importing: <ImportError> No module named 'msvcrt' (error at windows.py:*)
56
42
General Comments 0
You need to be logged in to leave comments. Login now