Show More
@@ -1,83 +1,96 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | # |
|
2 | # | |
3 | # check-py3-compat - check Python 3 compatibility of Mercurial files |
|
3 | # check-py3-compat - check Python 3 compatibility of Mercurial files | |
4 | # |
|
4 | # | |
5 | # Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com> |
|
5 | # Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com> | |
6 | # |
|
6 | # | |
7 | # This software may be used and distributed according to the terms of the |
|
7 | # This software may be used and distributed according to the terms of the | |
8 | # GNU General Public License version 2 or any later version. |
|
8 | # GNU General Public License version 2 or any later version. | |
9 |
|
9 | |||
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 imp | |
14 | import os |
|
14 | import os | |
15 | import sys |
|
15 | import sys | |
16 | import traceback |
|
16 | import traceback | |
17 |
|
17 | |||
18 | def check_compat_py2(f): |
|
18 | def check_compat_py2(f): | |
19 | """Check Python 3 compatibility for a file with Python 2""" |
|
19 | """Check Python 3 compatibility for a file with Python 2""" | |
20 | with open(f, 'rb') as fh: |
|
20 | with open(f, 'rb') as fh: | |
21 | content = fh.read() |
|
21 | content = fh.read() | |
22 | root = ast.parse(content) |
|
22 | root = ast.parse(content) | |
23 |
|
23 | |||
24 | # Ignore empty files. |
|
24 | # Ignore empty files. | |
25 | if not root.body: |
|
25 | if not root.body: | |
26 | return |
|
26 | return | |
27 |
|
27 | |||
28 | futures = set() |
|
28 | futures = set() | |
29 | haveprint = False |
|
29 | haveprint = False | |
30 | for node in ast.walk(root): |
|
30 | for node in ast.walk(root): | |
31 | if isinstance(node, ast.ImportFrom): |
|
31 | if isinstance(node, ast.ImportFrom): | |
32 | if node.module == '__future__': |
|
32 | if node.module == '__future__': | |
33 | futures |= set(n.name for n in node.names) |
|
33 | futures |= set(n.name for n in node.names) | |
34 | elif isinstance(node, ast.Print): |
|
34 | elif isinstance(node, ast.Print): | |
35 | haveprint = True |
|
35 | haveprint = True | |
36 |
|
36 | |||
37 | if 'absolute_import' not in futures: |
|
37 | if 'absolute_import' not in futures: | |
38 | print('%s not using absolute_import' % f) |
|
38 | print('%s not using absolute_import' % f) | |
39 | if haveprint and 'print_function' not in futures: |
|
39 | if haveprint and 'print_function' not in futures: | |
40 | print('%s requires print_function' % f) |
|
40 | print('%s requires print_function' % f) | |
41 |
|
41 | |||
42 | def check_compat_py3(f): |
|
42 | def check_compat_py3(f): | |
43 | """Check Python 3 compatibility of a file with Python 3.""" |
|
43 | """Check Python 3 compatibility of a file with Python 3.""" | |
44 | with open(f, 'rb') as fh: |
|
44 | with open(f, 'rb') as fh: | |
45 | content = fh.read() |
|
45 | content = fh.read() | |
46 |
|
46 | |||
47 | try: |
|
47 | try: | |
48 | ast.parse(content) |
|
48 | ast.parse(content) | |
49 | except SyntaxError as e: |
|
49 | except SyntaxError as e: | |
50 | print('%s: invalid syntax: %s' % (f, e)) |
|
50 | print('%s: invalid syntax: %s' % (f, e)) | |
51 | return |
|
51 | return | |
52 |
|
52 | |||
53 | # Try to import the module. |
|
53 | # Try to import the module. | |
54 | # For now we only support mercurial.* and hgext.* modules because figuring |
|
54 | # For now we only support mercurial.* and hgext.* modules because figuring | |
55 | # out module paths for things not in a package can be confusing. |
|
55 | # out module paths for things not in a package can be confusing. | |
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] |
|
58 | name = f.replace('/', '.')[:-3] | |
59 | with open(f, 'r') as fh: |
|
59 | with open(f, 'r') as fh: | |
60 | try: |
|
60 | try: | |
61 | imp.load_module(name, fh, '', ('py', 'r', imp.PY_SOURCE)) |
|
61 | imp.load_module(name, fh, '', ('py', 'r', imp.PY_SOURCE)) | |
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 | frame = traceback.extract_tb(tb)[-1] |
|
64 | # We walk the stack and ignore frames from our custom importer, | |
|
65 | # import mechanisms, and stdlib modules. This kinda/sorta | |||
|
66 | # emulates CPython behavior in import.c while also attempting | |||
|
67 | # to pin blame on a Mercurial file. | |||
|
68 | for frame in reversed(traceback.extract_tb(tb)): | |||
|
69 | if frame.name == '_call_with_frames_removed': | |||
|
70 | continue | |||
|
71 | if 'importlib' in frame.filename: | |||
|
72 | continue | |||
|
73 | if 'mercurial/__init__.py' in frame.filename: | |||
|
74 | continue | |||
|
75 | if frame.filename.startswith(sys.prefix): | |||
|
76 | continue | |||
|
77 | break | |||
65 |
|
78 | |||
66 | if frame.filename: |
|
79 | if frame.filename: | |
67 | filename = os.path.basename(frame.filename) |
|
80 | filename = os.path.basename(frame.filename) | |
68 | print('%s: error importing: <%s> %s (error at %s:%d)' % ( |
|
81 | print('%s: error importing: <%s> %s (error at %s:%d)' % ( | |
69 | f, type(e).__name__, e, filename, frame.lineno)) |
|
82 | f, type(e).__name__, e, filename, frame.lineno)) | |
70 | else: |
|
83 | else: | |
71 | print('%s: error importing module: <%s> %s (line %d)' % ( |
|
84 | print('%s: error importing module: <%s> %s (line %d)' % ( | |
72 | f, type(e).__name__, e, frame.lineno)) |
|
85 | f, type(e).__name__, e, frame.lineno)) | |
73 |
|
86 | |||
74 | if __name__ == '__main__': |
|
87 | if __name__ == '__main__': | |
75 | if sys.version_info[0] == 2: |
|
88 | if sys.version_info[0] == 2: | |
76 | fn = check_compat_py2 |
|
89 | fn = check_compat_py2 | |
77 | else: |
|
90 | else: | |
78 | fn = check_compat_py3 |
|
91 | fn = check_compat_py3 | |
79 |
|
92 | |||
80 | for f in sys.argv[1:]: |
|
93 | for f in sys.argv[1:]: | |
81 | fn(f) |
|
94 | fn(f) | |
82 |
|
95 | |||
83 | sys.exit(0) |
|
96 | sys.exit(0) |
@@ -1,129 +1,358 b'' | |||||
1 | # __init__.py - Startup and module loading logic for Mercurial. |
|
1 | # __init__.py - Startup and module loading logic for Mercurial. | |
2 | # |
|
2 | # | |
3 | # Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com> |
|
3 | # Copyright 2015 Gregory Szorc <gregory.szorc@gmail.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import imp |
|
10 | import imp | |
11 | import os |
|
11 | import os | |
12 | import sys |
|
12 | import sys | |
13 | import zipimport |
|
13 | import zipimport | |
14 |
|
14 | |||
15 | from . import ( |
|
15 | from . import ( | |
16 | policy |
|
16 | policy | |
17 | ) |
|
17 | ) | |
18 |
|
18 | |||
19 | __all__ = [] |
|
19 | __all__ = [] | |
20 |
|
20 | |||
21 | modulepolicy = policy.policy |
|
21 | modulepolicy = policy.policy | |
22 |
|
22 | |||
23 | # Modules that have both Python and C implementations. See also the |
|
23 | # Modules that have both Python and C implementations. See also the | |
24 | # set of .py files under mercurial/pure/. |
|
24 | # set of .py files under mercurial/pure/. | |
25 | _dualmodules = set([ |
|
25 | _dualmodules = set([ | |
26 | 'mercurial.base85', |
|
26 | 'mercurial.base85', | |
27 | 'mercurial.bdiff', |
|
27 | 'mercurial.bdiff', | |
28 | 'mercurial.diffhelpers', |
|
28 | 'mercurial.diffhelpers', | |
29 | 'mercurial.mpatch', |
|
29 | 'mercurial.mpatch', | |
30 | 'mercurial.osutil', |
|
30 | 'mercurial.osutil', | |
31 | 'mercurial.parsers', |
|
31 | 'mercurial.parsers', | |
32 | ]) |
|
32 | ]) | |
33 |
|
33 | |||
34 | class hgimporter(object): |
|
34 | class hgimporter(object): | |
35 | """Object that conforms to import hook interface defined in PEP-302.""" |
|
35 | """Object that conforms to import hook interface defined in PEP-302.""" | |
36 | def find_module(self, name, path=None): |
|
36 | def find_module(self, name, path=None): | |
37 | # We only care about modules that have both C and pure implementations. |
|
37 | # We only care about modules that have both C and pure implementations. | |
38 | if name in _dualmodules: |
|
38 | if name in _dualmodules: | |
39 | return self |
|
39 | return self | |
40 | return None |
|
40 | return None | |
41 |
|
41 | |||
42 | def load_module(self, name): |
|
42 | def load_module(self, name): | |
43 | mod = sys.modules.get(name, None) |
|
43 | mod = sys.modules.get(name, None) | |
44 | if mod: |
|
44 | if mod: | |
45 | return mod |
|
45 | return mod | |
46 |
|
46 | |||
47 | mercurial = sys.modules['mercurial'] |
|
47 | mercurial = sys.modules['mercurial'] | |
48 |
|
48 | |||
49 | # The zip importer behaves sufficiently differently from the default |
|
49 | # The zip importer behaves sufficiently differently from the default | |
50 | # importer to warrant its own code path. |
|
50 | # importer to warrant its own code path. | |
51 | loader = getattr(mercurial, '__loader__', None) |
|
51 | loader = getattr(mercurial, '__loader__', None) | |
52 | if isinstance(loader, zipimport.zipimporter): |
|
52 | if isinstance(loader, zipimport.zipimporter): | |
53 | def ziploader(*paths): |
|
53 | def ziploader(*paths): | |
54 | """Obtain a zipimporter for a directory under the main zip.""" |
|
54 | """Obtain a zipimporter for a directory under the main zip.""" | |
55 | path = os.path.join(loader.archive, *paths) |
|
55 | path = os.path.join(loader.archive, *paths) | |
56 | zl = sys.path_importer_cache.get(path) |
|
56 | zl = sys.path_importer_cache.get(path) | |
57 | if not zl: |
|
57 | if not zl: | |
58 | zl = zipimport.zipimporter(path) |
|
58 | zl = zipimport.zipimporter(path) | |
59 | return zl |
|
59 | return zl | |
60 |
|
60 | |||
61 | try: |
|
61 | try: | |
62 | if modulepolicy in policy.policynoc: |
|
62 | if modulepolicy in policy.policynoc: | |
63 | raise ImportError() |
|
63 | raise ImportError() | |
64 |
|
64 | |||
65 | zl = ziploader('mercurial') |
|
65 | zl = ziploader('mercurial') | |
66 | mod = zl.load_module(name) |
|
66 | mod = zl.load_module(name) | |
67 | # Unlike imp, ziploader doesn't expose module metadata that |
|
67 | # Unlike imp, ziploader doesn't expose module metadata that | |
68 | # indicates the type of module. So just assume what we found |
|
68 | # indicates the type of module. So just assume what we found | |
69 | # is OK (even though it could be a pure Python module). |
|
69 | # is OK (even though it could be a pure Python module). | |
70 | except ImportError: |
|
70 | except ImportError: | |
71 | if modulepolicy == 'c': |
|
71 | if modulepolicy == 'c': | |
72 | raise |
|
72 | raise | |
73 | zl = ziploader('mercurial', 'pure') |
|
73 | zl = ziploader('mercurial', 'pure') | |
74 | mod = zl.load_module(name) |
|
74 | mod = zl.load_module(name) | |
75 |
|
75 | |||
76 | sys.modules[name] = mod |
|
76 | sys.modules[name] = mod | |
77 | return mod |
|
77 | return mod | |
78 |
|
78 | |||
79 | # Unlike the default importer which searches special locations and |
|
79 | # Unlike the default importer which searches special locations and | |
80 | # sys.path, we only look in the directory where "mercurial" was |
|
80 | # sys.path, we only look in the directory where "mercurial" was | |
81 | # imported from. |
|
81 | # imported from. | |
82 |
|
82 | |||
83 | # imp.find_module doesn't support submodules (modules with "."). |
|
83 | # imp.find_module doesn't support submodules (modules with "."). | |
84 | # Instead you have to pass the parent package's __path__ attribute |
|
84 | # Instead you have to pass the parent package's __path__ attribute | |
85 | # as the path argument. |
|
85 | # as the path argument. | |
86 | stem = name.split('.')[-1] |
|
86 | stem = name.split('.')[-1] | |
87 |
|
87 | |||
88 | try: |
|
88 | try: | |
89 | if modulepolicy in policy.policynoc: |
|
89 | if modulepolicy in policy.policynoc: | |
90 | raise ImportError() |
|
90 | raise ImportError() | |
91 |
|
91 | |||
92 | modinfo = imp.find_module(stem, mercurial.__path__) |
|
92 | modinfo = imp.find_module(stem, mercurial.__path__) | |
93 |
|
93 | |||
94 | # The Mercurial installer used to copy files from |
|
94 | # The Mercurial installer used to copy files from | |
95 | # mercurial/pure/*.py to mercurial/*.py. Therefore, it's possible |
|
95 | # mercurial/pure/*.py to mercurial/*.py. Therefore, it's possible | |
96 | # for some installations to have .py files under mercurial/*. |
|
96 | # for some installations to have .py files under mercurial/*. | |
97 | # Loading Python modules when we expected C versions could result |
|
97 | # Loading Python modules when we expected C versions could result | |
98 | # in a) poor performance b) loading a version from a previous |
|
98 | # in a) poor performance b) loading a version from a previous | |
99 | # Mercurial version, potentially leading to incompatibility. Either |
|
99 | # Mercurial version, potentially leading to incompatibility. Either | |
100 | # scenario is bad. So we verify that modules loaded from |
|
100 | # scenario is bad. So we verify that modules loaded from | |
101 | # mercurial/* are C extensions. If the current policy allows the |
|
101 | # mercurial/* are C extensions. If the current policy allows the | |
102 | # loading of .py modules, the module will be re-imported from |
|
102 | # loading of .py modules, the module will be re-imported from | |
103 | # mercurial/pure/* below. |
|
103 | # mercurial/pure/* below. | |
104 | if modinfo[2][2] != imp.C_EXTENSION: |
|
104 | if modinfo[2][2] != imp.C_EXTENSION: | |
105 | raise ImportError('.py version of %s found where C ' |
|
105 | raise ImportError('.py version of %s found where C ' | |
106 | 'version should exist' % name) |
|
106 | 'version should exist' % name) | |
107 |
|
107 | |||
108 | except ImportError: |
|
108 | except ImportError: | |
109 | if modulepolicy == 'c': |
|
109 | if modulepolicy == 'c': | |
110 | raise |
|
110 | raise | |
111 |
|
111 | |||
112 | # Could not load the C extension and pure Python is allowed. So |
|
112 | # Could not load the C extension and pure Python is allowed. So | |
113 | # try to load them. |
|
113 | # try to load them. | |
114 | from . import pure |
|
114 | from . import pure | |
115 | modinfo = imp.find_module(stem, pure.__path__) |
|
115 | modinfo = imp.find_module(stem, pure.__path__) | |
116 | if not modinfo: |
|
116 | if not modinfo: | |
117 | raise ImportError('could not find mercurial module %s' % |
|
117 | raise ImportError('could not find mercurial module %s' % | |
118 | name) |
|
118 | name) | |
119 |
|
119 | |||
120 | mod = imp.load_module(name, *modinfo) |
|
120 | mod = imp.load_module(name, *modinfo) | |
121 | sys.modules[name] = mod |
|
121 | sys.modules[name] = mod | |
122 | return mod |
|
122 | return mod | |
123 |
|
123 | |||
|
124 | # Python 3 uses a custom module loader that transforms source code between | |||
|
125 | # source file reading and compilation. This is done by registering a custom | |||
|
126 | # finder that changes the spec for Mercurial modules to use a custom loader. | |||
|
127 | if sys.version_info[0] >= 3: | |||
|
128 | from . import pure | |||
|
129 | import importlib | |||
|
130 | import io | |||
|
131 | import token | |||
|
132 | import tokenize | |||
|
133 | ||||
|
134 | class hgpathentryfinder(importlib.abc.MetaPathFinder): | |||
|
135 | """A sys.meta_path finder that uses a custom module loader.""" | |||
|
136 | def find_spec(self, fullname, path, target=None): | |||
|
137 | # Only handle Mercurial-related modules. | |||
|
138 | if not fullname.startswith(('mercurial.', 'hgext.', 'hgext3rd.')): | |||
|
139 | return None | |||
|
140 | ||||
|
141 | # This assumes Python 3 doesn't support loading C modules. | |||
|
142 | if fullname in _dualmodules: | |||
|
143 | stem = fullname.split('.')[-1] | |||
|
144 | fullname = 'mercurial.pure.%s' % stem | |||
|
145 | target = pure | |||
|
146 | assert len(path) == 1 | |||
|
147 | path = [os.path.join(path[0], 'pure')] | |||
|
148 | ||||
|
149 | # Try to find the module using other registered finders. | |||
|
150 | spec = None | |||
|
151 | for finder in sys.meta_path: | |||
|
152 | if finder == self: | |||
|
153 | continue | |||
|
154 | ||||
|
155 | spec = finder.find_spec(fullname, path, target=target) | |||
|
156 | if spec: | |||
|
157 | break | |||
|
158 | ||||
|
159 | # This is a Mercurial-related module but we couldn't find it | |||
|
160 | # using the previously-registered finders. This likely means | |||
|
161 | # the module doesn't exist. | |||
|
162 | if not spec: | |||
|
163 | return None | |||
|
164 | ||||
|
165 | if fullname.startswith('mercurial.pure.'): | |||
|
166 | spec.name = spec.name.replace('.pure.', '.') | |||
|
167 | ||||
|
168 | # TODO need to support loaders from alternate specs, like zip | |||
|
169 | # loaders. | |||
|
170 | spec.loader = hgloader(spec.name, spec.origin) | |||
|
171 | return spec | |||
|
172 | ||||
|
173 | def replacetokens(tokens): | |||
|
174 | """Transform a stream of tokens from raw to Python 3. | |||
|
175 | ||||
|
176 | It is called by the custom module loading machinery to rewrite | |||
|
177 | source/tokens between source decoding and compilation. | |||
|
178 | ||||
|
179 | Returns a generator of possibly rewritten tokens. | |||
|
180 | ||||
|
181 | The input token list may be mutated as part of processing. However, | |||
|
182 | its changes do not necessarily match the output token stream. | |||
|
183 | ||||
|
184 | REMEMBER TO CHANGE ``BYTECODEHEADER`` WHEN CHANGING THIS FUNCTION | |||
|
185 | OR CACHED FILES WON'T GET INVALIDATED PROPERLY. | |||
|
186 | """ | |||
|
187 | for i, t in enumerate(tokens): | |||
|
188 | # Convert most string literals to byte literals. String literals | |||
|
189 | # in Python 2 are bytes. String literals in Python 3 are unicode. | |||
|
190 | # Most strings in Mercurial are bytes and unicode strings are rare. | |||
|
191 | # Rather than rewrite all string literals to use ``b''`` to indicate | |||
|
192 | # byte strings, we apply this token transformer to insert the ``b`` | |||
|
193 | # prefix nearly everywhere. | |||
|
194 | if t.type == token.STRING: | |||
|
195 | s = t.string | |||
|
196 | ||||
|
197 | # Preserve docstrings as string literals. This is inconsistent | |||
|
198 | # with regular unprefixed strings. However, the | |||
|
199 | # "from __future__" parsing (which allows a module docstring to | |||
|
200 | # exist before it) doesn't properly handle the docstring if it | |||
|
201 | # is b''' prefixed, leading to a SyntaxError. We leave all | |||
|
202 | # docstrings as unprefixed to avoid this. This means Mercurial | |||
|
203 | # components touching docstrings need to handle unicode, | |||
|
204 | # unfortunately. | |||
|
205 | if s[0:3] in ("'''", '"""'): | |||
|
206 | yield t | |||
|
207 | continue | |||
|
208 | ||||
|
209 | # If the first character isn't a quote, it is likely a string | |||
|
210 | # prefixing character (such as 'b', 'u', or 'r'. Ignore. | |||
|
211 | if s[0] not in ("'", '"'): | |||
|
212 | yield t | |||
|
213 | continue | |||
|
214 | ||||
|
215 | # String literal. Prefix to make a b'' string. | |||
|
216 | yield tokenize.TokenInfo(t.type, 'b%s' % s, t.start, t.end, | |||
|
217 | t.line) | |||
|
218 | continue | |||
|
219 | ||||
|
220 | try: | |||
|
221 | nexttoken = tokens[i + 1] | |||
|
222 | except IndexError: | |||
|
223 | nexttoken = None | |||
|
224 | ||||
|
225 | try: | |||
|
226 | prevtoken = tokens[i - 1] | |||
|
227 | except IndexError: | |||
|
228 | prevtoken = None | |||
|
229 | ||||
|
230 | # This looks like a function call. | |||
|
231 | if (t.type == token.NAME and nexttoken and | |||
|
232 | nexttoken.type == token.OP and nexttoken.string == '('): | |||
|
233 | fn = t.string | |||
|
234 | ||||
|
235 | # *attr() builtins don't accept byte strings to 2nd argument. | |||
|
236 | # Rewrite the token to include the unicode literal prefix so | |||
|
237 | # the string transformer above doesn't add the byte prefix. | |||
|
238 | if fn in ('getattr', 'setattr', 'hasattr', 'safehasattr'): | |||
|
239 | try: | |||
|
240 | # (NAME, 'getattr') | |||
|
241 | # (OP, '(') | |||
|
242 | # (NAME, 'foo') | |||
|
243 | # (OP, ',') | |||
|
244 | # (NAME|STRING, foo) | |||
|
245 | st = tokens[i + 4] | |||
|
246 | if (st.type == token.STRING and | |||
|
247 | st.string[0] in ("'", '"')): | |||
|
248 | rt = tokenize.TokenInfo(st.type, 'u%s' % st.string, | |||
|
249 | st.start, st.end, st.line) | |||
|
250 | tokens[i + 4] = rt | |||
|
251 | except IndexError: | |||
|
252 | pass | |||
|
253 | ||||
|
254 | # .encode() and .decode() on str/bytes/unicode don't accept | |||
|
255 | # byte strings on Python 3. Rewrite the token to include the | |||
|
256 | # unicode literal prefix so the string transformer above doesn't | |||
|
257 | # add the byte prefix. | |||
|
258 | if (fn in ('encode', 'decode') and | |||
|
259 | prevtoken.type == token.OP and prevtoken.string == '.'): | |||
|
260 | # (OP, '.') | |||
|
261 | # (NAME, 'encode') | |||
|
262 | # (OP, '(') | |||
|
263 | # (STRING, 'utf-8') | |||
|
264 | # (OP, ')') | |||
|
265 | try: | |||
|
266 | st = tokens[i + 2] | |||
|
267 | if (st.type == token.STRING and | |||
|
268 | st.string[0] in ("'", '"')): | |||
|
269 | rt = tokenize.TokenInfo(st.type, 'u%s' % st.string, | |||
|
270 | st.start, st.end, st.line) | |||
|
271 | tokens[i + 2] = rt | |||
|
272 | except IndexError: | |||
|
273 | pass | |||
|
274 | ||||
|
275 | # Emit unmodified token. | |||
|
276 | yield t | |||
|
277 | ||||
|
278 | # Header to add to bytecode files. This MUST be changed when | |||
|
279 | # ``replacetoken`` or any mechanism that changes semantics of module | |||
|
280 | # loading is changed. Otherwise cached bytecode may get loaded without | |||
|
281 | # the new transformation mechanisms applied. | |||
|
282 | BYTECODEHEADER = b'HG\x00\x01' | |||
|
283 | ||||
|
284 | class hgloader(importlib.machinery.SourceFileLoader): | |||
|
285 | """Custom module loader that transforms source code. | |||
|
286 | ||||
|
287 | When the source code is converted to a code object, we transform | |||
|
288 | certain patterns to be Python 3 compatible. This allows us to write code | |||
|
289 | that is natively Python 2 and compatible with Python 3 without | |||
|
290 | making the code excessively ugly. | |||
|
291 | ||||
|
292 | We do this by transforming the token stream between parse and compile. | |||
|
293 | ||||
|
294 | Implementing transformations invalidates caching assumptions made | |||
|
295 | by the built-in importer. The built-in importer stores a header on | |||
|
296 | saved bytecode files indicating the Python/bytecode version. If the | |||
|
297 | version changes, the cached bytecode is ignored. The Mercurial | |||
|
298 | transformations could change at any time. This means we need to check | |||
|
299 | that cached bytecode was generated with the current transformation | |||
|
300 | code or there could be a mismatch between cached bytecode and what | |||
|
301 | would be generated from this class. | |||
|
302 | ||||
|
303 | We supplement the bytecode caching layer by wrapping ``get_data`` | |||
|
304 | and ``set_data``. These functions are called when the | |||
|
305 | ``SourceFileLoader`` retrieves and saves bytecode cache files, | |||
|
306 | respectively. We simply add an additional header on the file. As | |||
|
307 | long as the version in this file is changed when semantics change, | |||
|
308 | cached bytecode should be invalidated when transformations change. | |||
|
309 | ||||
|
310 | The added header has the form ``HG<VERSION>``. That is a literal | |||
|
311 | ``HG`` with 2 binary bytes indicating the transformation version. | |||
|
312 | """ | |||
|
313 | def get_data(self, path): | |||
|
314 | data = super(hgloader, self).get_data(path) | |||
|
315 | ||||
|
316 | if not path.endswith(tuple(importlib.machinery.BYTECODE_SUFFIXES)): | |||
|
317 | return data | |||
|
318 | ||||
|
319 | # There should be a header indicating the Mercurial transformation | |||
|
320 | # version. If it doesn't exist or doesn't match the current version, | |||
|
321 | # we raise an OSError because that is what | |||
|
322 | # ``SourceFileLoader.get_code()`` expects when loading bytecode | |||
|
323 | # paths to indicate the cached file is "bad." | |||
|
324 | if data[0:2] != b'HG': | |||
|
325 | raise OSError('no hg header') | |||
|
326 | if data[0:4] != BYTECODEHEADER: | |||
|
327 | raise OSError('hg header version mismatch') | |||
|
328 | ||||
|
329 | return data[4:] | |||
|
330 | ||||
|
331 | def set_data(self, path, data, *args, **kwargs): | |||
|
332 | if path.endswith(tuple(importlib.machinery.BYTECODE_SUFFIXES)): | |||
|
333 | data = BYTECODEHEADER + data | |||
|
334 | ||||
|
335 | return super(hgloader, self).set_data(path, data, *args, **kwargs) | |||
|
336 | ||||
|
337 | def source_to_code(self, data, path): | |||
|
338 | """Perform token transformation before compilation.""" | |||
|
339 | buf = io.BytesIO(data) | |||
|
340 | tokens = tokenize.tokenize(buf.readline) | |||
|
341 | data = tokenize.untokenize(replacetokens(list(tokens))) | |||
|
342 | # Python's built-in importer strips frames from exceptions raised | |||
|
343 | # for this code. Unfortunately, that mechanism isn't extensible | |||
|
344 | # and our frame will be blamed for the import failure. There | |||
|
345 | # are extremely hacky ways to do frame stripping. We haven't | |||
|
346 | # implemented them because they are very ugly. | |||
|
347 | return super(hgloader, self).source_to_code(data, path) | |||
|
348 | ||||
124 | # We automagically register our custom importer as a side-effect of loading. |
|
349 | # We automagically register our custom importer as a side-effect of loading. | |
125 | # This is necessary to ensure that any entry points are able to import |
|
350 | # This is necessary to ensure that any entry points are able to import | |
126 | # mercurial.* modules without having to perform this registration themselves. |
|
351 | # mercurial.* modules without having to perform this registration themselves. | |
127 | if not any(isinstance(x, hgimporter) for x in sys.meta_path): |
|
352 | if sys.version_info[0] >= 3: | |
|
353 | _importercls = hgpathentryfinder | |||
|
354 | else: | |||
|
355 | _importercls = hgimporter | |||
|
356 | if not any(isinstance(x, _importercls) for x in sys.meta_path): | |||
128 | # meta_path is used before any implicit finders and before sys.path. |
|
357 | # meta_path is used before any implicit finders and before sys.path. | |
129 |
sys.meta_path.insert(0, |
|
358 | sys.meta_path.insert(0, _importercls()) |
@@ -1,141 +1,175 b'' | |||||
1 | #require test-repo |
|
1 | #require test-repo | |
2 |
|
2 | |||
3 | $ . "$TESTDIR/helpers-testrepo.sh" |
|
3 | $ . "$TESTDIR/helpers-testrepo.sh" | |
4 | $ cd "$TESTDIR"/.. |
|
4 | $ cd "$TESTDIR"/.. | |
5 |
|
5 | |||
6 | $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py |
|
6 | $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py | |
7 | hgext/fsmonitor/pywatchman/__init__.py not using absolute_import |
|
7 | hgext/fsmonitor/pywatchman/__init__.py not using absolute_import | |
8 | hgext/fsmonitor/pywatchman/__init__.py requires print_function |
|
8 | hgext/fsmonitor/pywatchman/__init__.py requires print_function | |
9 | hgext/fsmonitor/pywatchman/capabilities.py not using absolute_import |
|
9 | hgext/fsmonitor/pywatchman/capabilities.py not using absolute_import | |
10 | hgext/fsmonitor/pywatchman/pybser.py not using absolute_import |
|
10 | hgext/fsmonitor/pywatchman/pybser.py not using absolute_import | |
11 | i18n/check-translation.py not using absolute_import |
|
11 | i18n/check-translation.py not using absolute_import | |
12 | setup.py not using absolute_import |
|
12 | setup.py not using absolute_import | |
13 | tests/test-demandimport.py not using absolute_import |
|
13 | tests/test-demandimport.py not using absolute_import | |
14 |
|
14 | |||
15 | #if py3exe |
|
15 | #if py3exe | |
16 | $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py |
|
16 | $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py | |
17 | doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
17 | doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) | |
18 | hgext/automv.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob) |
|
18 | hgext/acl.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
19 |
hgext/ |
|
19 | hgext/automv.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
20 |
hgext/b |
|
20 | hgext/blackbox.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
21 |
hgext/ |
|
21 | hgext/bugzilla.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
22 |
hgext/c |
|
22 | hgext/censor.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
23 |
hgext/ch |
|
23 | hgext/chgserver.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
24 |
hgext/ch |
|
24 | hgext/children.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
25 |
hgext/c |
|
25 | hgext/churn.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
|
26 | hgext/clonebundles.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |||
26 | hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
27 | hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) | |
27 |
hgext/convert/bzr.py: error importing |
|
28 | hgext/convert/bzr.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
28 |
hgext/convert/con |
|
29 | hgext/convert/common.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
29 | hgext/convert/cvs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
30 | hgext/convert/convcmd.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
30 |
hgext/convert/cvs |
|
31 | hgext/convert/cvs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
31 | hgext/convert/darcs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
32 | hgext/convert/cvsps.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
32 | hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
33 | hgext/convert/darcs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
33 | hgext/convert/git.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
34 | hgext/convert/filemap.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
34 | hgext/convert/gnuarch.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
35 | hgext/convert/git.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
35 |
hgext/convert/h |
|
36 | hgext/convert/gnuarch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
36 | hgext/convert/monotone.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
37 | hgext/convert/hg.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
37 | hgext/convert/p*.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
38 | hgext/convert/monotone.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
38 |
hgext/convert/ |
|
39 | hgext/convert/p4.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
|
40 | hgext/convert/subversion.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |||
39 | hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob) |
|
41 | hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob) | |
40 |
hgext/eol.py: error importing: < |
|
42 | hgext/eol.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
41 | hgext/extdiff.py: error importing module: <SyntaxError> invalid syntax (archival.py, line *) (line *) (glob) |
|
43 | hgext/extdiff.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
42 |
hgext/factotum.py: error importing: < |
|
44 | hgext/factotum.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
43 |
hgext/fetch.py: error importing: < |
|
45 | hgext/fetch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
44 | hgext/fsmonitor/watchmanclient.py: error importing module: <SystemError> Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (line *) (glob) |
|
46 | hgext/fsmonitor/state.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
45 |
hgext/ |
|
47 | hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
46 |
hgext/g |
|
48 | hgext/gpg.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
47 |
hgext/hg |
|
49 | hgext/graphlog.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
48 | hgext/histedit.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob) |
|
50 | hgext/hgk.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
49 |
hgext/ |
|
51 | hgext/highlight/highlight.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
50 | hgext/largefiles/basestore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) (glob) |
|
52 | hgext/histedit.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
51 |
hgext/ |
|
53 | hgext/journal.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
52 |
hgext/ |
|
54 | hgext/keyword.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
53 |
hgext/largefiles/ |
|
55 | hgext/largefiles/basestore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
54 | hgext/largefiles/overrides.py: error importing module: <SyntaxError> invalid syntax (archival.py, line *) (line *) (glob) |
|
56 | hgext/largefiles/lfcommands.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
55 |
hgext/largefiles/ |
|
57 | hgext/largefiles/lfutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
56 |
hgext/largefiles/ |
|
58 | hgext/largefiles/localstore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
57 |
hgext/largefiles/re |
|
59 | hgext/largefiles/overrides.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
58 |
hgext/largefiles/ |
|
60 | hgext/largefiles/proto.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
59 |
hgext/largefiles/ |
|
61 | hgext/largefiles/remotestore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
|
62 | hgext/largefiles/reposetup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |||
|
63 | hgext/largefiles/storefactory.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |||
|
64 | hgext/largefiles/uisetup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |||
60 | hgext/largefiles/wirestore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) (glob) |
|
65 | hgext/largefiles/wirestore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) (glob) | |
61 |
hgext/mq.py: error importing: < |
|
66 | hgext/mq.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
62 |
hgext/notify.py: error importing: < |
|
67 | hgext/notify.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
63 |
hgext/pager.py: error importing: < |
|
68 | hgext/pager.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
64 |
hgext/patchbomb.py: error importing: < |
|
69 | hgext/patchbomb.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
65 |
hgext/purge.py: error importing: < |
|
70 | hgext/purge.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
66 |
hgext/rebase.py: error importing: < |
|
71 | hgext/rebase.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
67 |
hgext/record.py: error importing: < |
|
72 | hgext/record.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
68 |
hgext/relink.py: error importing: < |
|
73 | hgext/relink.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
69 |
hgext/schemes.py: error importing: < |
|
74 | hgext/schemes.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
70 |
hgext/share.py: error importing: < |
|
75 | hgext/share.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
71 | hgext/shelve.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob) |
|
76 | hgext/shelve.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
72 |
hgext/strip.py: error importing: < |
|
77 | hgext/strip.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
73 |
hgext/transplant.py: error importing: < |
|
78 | hgext/transplant.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
|
79 | hgext/win32mbcs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |||
|
80 | hgext/win32text.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |||
74 | mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
81 | mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) | |
75 |
mercurial/b |
|
82 | mercurial/bookmarks.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
76 | mercurial/bundle*.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
83 | mercurial/branchmap.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
77 |
mercurial/bundle |
|
84 | mercurial/bundle2.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) | |
78 |
mercurial/ |
|
85 | mercurial/bundlerepo.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
79 |
mercurial/ |
|
86 | mercurial/byterange.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
80 |
mercurial/c |
|
87 | mercurial/changegroup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
|
88 | mercurial/changelog.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |||
|
89 | mercurial/cmdutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |||
81 | mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
90 | mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) | |
82 |
mercurial/co |
|
91 | mercurial/commandserver.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
83 |
mercurial/co |
|
92 | mercurial/config.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
84 |
mercurial/c |
|
93 | mercurial/context.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
85 |
mercurial/ |
|
94 | mercurial/copies.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
86 |
mercurial/ |
|
95 | mercurial/crecord.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
87 |
mercurial/d |
|
96 | mercurial/dagparser.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
88 | mercurial/exchange.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob) |
|
97 | mercurial/dagutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
89 |
mercurial/ |
|
98 | mercurial/destutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
90 |
mercurial/ |
|
99 | mercurial/dirstate.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
91 |
mercurial/ |
|
100 | mercurial/discovery.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
92 |
mercurial/ |
|
101 | mercurial/dispatch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob) | |
93 |
mercurial/ |
|
102 | mercurial/exchange.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |
94 |
mercurial/ |
|
103 | mercurial/extensions.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |
95 |
mercurial/ |
|
104 | mercurial/fancyopts.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |
96 |
mercurial/ |
|
105 | mercurial/filelog.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |
|
106 | mercurial/filemerge.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |||
|
107 | mercurial/fileset.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |||
|
108 | mercurial/formatter.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |||
|
109 | mercurial/graphmod.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |||
|
110 | mercurial/hbisect.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |||
|
111 | mercurial/help.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |||
|
112 | mercurial/hg.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |||
97 | mercurial/hgweb/common.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob) |
|
113 | mercurial/hgweb/common.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob) | |
98 | mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
114 | mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) | |
99 | mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
115 | mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) | |
100 | mercurial/hgweb/protocol.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
116 | mercurial/hgweb/protocol.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) | |
101 | mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
117 | mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) | |
102 | mercurial/hgweb/server.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob) |
|
118 | mercurial/hgweb/server.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob) | |
103 | mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
119 | mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) | |
104 | mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
120 | mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) | |
105 | mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
121 | mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) | |
106 |
mercurial/hook.py: error importing: < |
|
122 | mercurial/hook.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |
107 |
mercurial/httpconnection.py: error importing: < |
|
123 | mercurial/httpconnection.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |
108 |
mercurial/httppeer.py: error importing |
|
124 | mercurial/httppeer.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob) | |
109 |
mercurial/keepalive.py: error importing |
|
125 | mercurial/keepalive.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
110 |
mercurial/localrepo.py: error importing: < |
|
126 | mercurial/localrepo.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
111 | mercurial/mail.py: error importing module: <AttributeError> module 'email' has no attribute 'Header' (line *) (glob) |
|
127 | mercurial/lock.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
112 |
mercurial/ma |
|
128 | mercurial/mail.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
113 |
mercurial/m |
|
129 | mercurial/manifest.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob) | |
114 |
mercurial/ |
|
130 | mercurial/match.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
115 |
mercurial/ |
|
131 | mercurial/mdiff.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob) | |
|
132 | mercurial/merge.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
133 | mercurial/minirst.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
134 | mercurial/namespaces.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
135 | mercurial/obsolete.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob) | |||
|
136 | mercurial/patch.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
137 | mercurial/pathutil.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
138 | mercurial/peer.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
116 | mercurial/pure/mpatch.py: error importing module: <ImportError> cannot import name 'pycompat' (line *) (glob) |
|
139 | mercurial/pure/mpatch.py: error importing module: <ImportError> cannot import name 'pycompat' (line *) (glob) | |
117 | mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'mercurial.pure.node' (line *) (glob) |
|
140 | mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'mercurial.pure.node' (line *) (glob) | |
118 | mercurial/repair.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob) |
|
141 | mercurial/pushkey.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
119 |
mercurial/ |
|
142 | mercurial/pvec.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
120 | mercurial/revset.py: error importing module: <AttributeError> 'dict' object has no attribute 'iteritems' (line *) (glob) |
|
143 | mercurial/registrar.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
121 | mercurial/scmutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
144 | mercurial/repair.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (line *) (glob) | |
|
145 | mercurial/repoview.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
146 | mercurial/revlog.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
147 | mercurial/revset.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
148 | mercurial/scmposix.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
149 | mercurial/scmutil.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
122 | mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob) |
|
150 | mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob) | |
123 |
mercurial/sim |
|
151 | mercurial/similar.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
124 |
mercurial/s |
|
152 | mercurial/simplemerge.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
125 |
mercurial/ssh |
|
153 | mercurial/sshpeer.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
126 |
mercurial/s |
|
154 | mercurial/sshserver.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
127 |
mercurial/s |
|
155 | mercurial/sslutil.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
128 |
mercurial/st |
|
156 | mercurial/statichttprepo.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
129 |
mercurial/s |
|
157 | mercurial/store.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
130 |
mercurial/ |
|
158 | mercurial/streamclone.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
131 |
mercurial/ |
|
159 | mercurial/subrepo.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
132 |
mercurial/t |
|
160 | mercurial/tagmerge.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
133 |
mercurial/ |
|
161 | mercurial/tags.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
134 |
mercurial/ |
|
162 | mercurial/templatefilters.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
135 |
mercurial/ |
|
163 | mercurial/templatekw.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
136 |
mercurial/ |
|
164 | mercurial/templater.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
137 | mercurial/win*.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob) |
|
165 | mercurial/transaction.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |
|
166 | mercurial/ui.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
167 | mercurial/unionrepo.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
168 | mercurial/url.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
169 | mercurial/util.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
170 | mercurial/verify.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) | |||
|
171 | mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob) | |||
138 | mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob) |
|
172 | mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob) | |
139 |
mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle |
|
173 | mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (line *) (glob) | |
140 |
|
174 | |||
141 | #endif |
|
175 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now