Show More
@@ -1,1074 +1,1077 | |||||
1 | from __future__ import absolute_import, print_function |
|
1 | from __future__ import absolute_import, print_function | |
2 |
|
2 | |||
3 | import distutils.version |
|
3 | import distutils.version | |
4 | import os |
|
4 | import os | |
5 | import re |
|
5 | import re | |
6 | import socket |
|
6 | import socket | |
7 | import stat |
|
7 | import stat | |
8 | import subprocess |
|
8 | import subprocess | |
9 | import sys |
|
9 | import sys | |
10 | import tempfile |
|
10 | import tempfile | |
11 |
|
11 | |||
12 | tempprefix = 'hg-hghave-' |
|
12 | tempprefix = 'hg-hghave-' | |
13 |
|
13 | |||
14 | checks = { |
|
14 | checks = { | |
15 | "true": (lambda: True, "yak shaving"), |
|
15 | "true": (lambda: True, "yak shaving"), | |
16 | "false": (lambda: False, "nail clipper"), |
|
16 | "false": (lambda: False, "nail clipper"), | |
17 | } |
|
17 | } | |
18 |
|
18 | |||
19 | try: |
|
19 | try: | |
20 | import msvcrt |
|
20 | import msvcrt | |
21 |
|
21 | |||
22 | msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) |
|
22 | msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) | |
23 | msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) |
|
23 | msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) | |
24 | except ImportError: |
|
24 | except ImportError: | |
25 | pass |
|
25 | pass | |
26 |
|
26 | |||
27 | stdout = getattr(sys.stdout, 'buffer', sys.stdout) |
|
27 | stdout = getattr(sys.stdout, 'buffer', sys.stdout) | |
28 | stderr = getattr(sys.stderr, 'buffer', sys.stderr) |
|
28 | stderr = getattr(sys.stderr, 'buffer', sys.stderr) | |
29 |
|
29 | |||
30 | if sys.version_info[0] >= 3: |
|
30 | if sys.version_info[0] >= 3: | |
31 |
|
31 | |||
32 | def _sys2bytes(p): |
|
32 | def _sys2bytes(p): | |
33 | if p is None: |
|
33 | if p is None: | |
34 | return p |
|
34 | return p | |
35 | return p.encode('utf-8') |
|
35 | return p.encode('utf-8') | |
36 |
|
36 | |||
37 | def _bytes2sys(p): |
|
37 | def _bytes2sys(p): | |
38 | if p is None: |
|
38 | if p is None: | |
39 | return p |
|
39 | return p | |
40 | return p.decode('utf-8') |
|
40 | return p.decode('utf-8') | |
41 |
|
41 | |||
42 |
|
42 | |||
43 | else: |
|
43 | else: | |
44 |
|
44 | |||
45 | def _sys2bytes(p): |
|
45 | def _sys2bytes(p): | |
46 | return p |
|
46 | return p | |
47 |
|
47 | |||
48 | _bytes2sys = _sys2bytes |
|
48 | _bytes2sys = _sys2bytes | |
49 |
|
49 | |||
50 |
|
50 | |||
51 | def check(name, desc): |
|
51 | def check(name, desc): | |
52 | """Registers a check function for a feature.""" |
|
52 | """Registers a check function for a feature.""" | |
53 |
|
53 | |||
54 | def decorator(func): |
|
54 | def decorator(func): | |
55 | checks[name] = (func, desc) |
|
55 | checks[name] = (func, desc) | |
56 | return func |
|
56 | return func | |
57 |
|
57 | |||
58 | return decorator |
|
58 | return decorator | |
59 |
|
59 | |||
60 |
|
60 | |||
61 | def checkvers(name, desc, vers): |
|
61 | def checkvers(name, desc, vers): | |
62 | """Registers a check function for each of a series of versions. |
|
62 | """Registers a check function for each of a series of versions. | |
63 |
|
63 | |||
64 | vers can be a list or an iterator. |
|
64 | vers can be a list or an iterator. | |
65 |
|
65 | |||
66 | Produces a series of feature checks that have the form <name><vers> without |
|
66 | Produces a series of feature checks that have the form <name><vers> without | |
67 | any punctuation (even if there's punctuation in 'vers'; i.e. this produces |
|
67 | any punctuation (even if there's punctuation in 'vers'; i.e. this produces | |
68 | 'py38', not 'py3.8' or 'py-38').""" |
|
68 | 'py38', not 'py3.8' or 'py-38').""" | |
69 |
|
69 | |||
70 | def decorator(func): |
|
70 | def decorator(func): | |
71 | def funcv(v): |
|
71 | def funcv(v): | |
72 | def f(): |
|
72 | def f(): | |
73 | return func(v) |
|
73 | return func(v) | |
74 |
|
74 | |||
75 | return f |
|
75 | return f | |
76 |
|
76 | |||
77 | for v in vers: |
|
77 | for v in vers: | |
78 | v = str(v) |
|
78 | v = str(v) | |
79 | f = funcv(v) |
|
79 | f = funcv(v) | |
80 | checks['%s%s' % (name, v.replace('.', ''))] = (f, desc % v) |
|
80 | checks['%s%s' % (name, v.replace('.', ''))] = (f, desc % v) | |
81 | return func |
|
81 | return func | |
82 |
|
82 | |||
83 | return decorator |
|
83 | return decorator | |
84 |
|
84 | |||
85 |
|
85 | |||
86 | def checkfeatures(features): |
|
86 | def checkfeatures(features): | |
87 | result = { |
|
87 | result = { | |
88 | 'error': [], |
|
88 | 'error': [], | |
89 | 'missing': [], |
|
89 | 'missing': [], | |
90 | 'skipped': [], |
|
90 | 'skipped': [], | |
91 | } |
|
91 | } | |
92 |
|
92 | |||
93 | for feature in features: |
|
93 | for feature in features: | |
94 | negate = feature.startswith('no-') |
|
94 | negate = feature.startswith('no-') | |
95 | if negate: |
|
95 | if negate: | |
96 | feature = feature[3:] |
|
96 | feature = feature[3:] | |
97 |
|
97 | |||
98 | if feature not in checks: |
|
98 | if feature not in checks: | |
99 | result['missing'].append(feature) |
|
99 | result['missing'].append(feature) | |
100 | continue |
|
100 | continue | |
101 |
|
101 | |||
102 | check, desc = checks[feature] |
|
102 | check, desc = checks[feature] | |
103 | try: |
|
103 | try: | |
104 | available = check() |
|
104 | available = check() | |
105 | except Exception: |
|
105 | except Exception: | |
106 | result['error'].append('hghave check failed: %s' % feature) |
|
106 | result['error'].append('hghave check failed: %s' % feature) | |
107 | continue |
|
107 | continue | |
108 |
|
108 | |||
109 | if not negate and not available: |
|
109 | if not negate and not available: | |
110 | result['skipped'].append('missing feature: %s' % desc) |
|
110 | result['skipped'].append('missing feature: %s' % desc) | |
111 | elif negate and available: |
|
111 | elif negate and available: | |
112 | result['skipped'].append('system supports %s' % desc) |
|
112 | result['skipped'].append('system supports %s' % desc) | |
113 |
|
113 | |||
114 | return result |
|
114 | return result | |
115 |
|
115 | |||
116 |
|
116 | |||
117 | def require(features): |
|
117 | def require(features): | |
118 | """Require that features are available, exiting if not.""" |
|
118 | """Require that features are available, exiting if not.""" | |
119 | result = checkfeatures(features) |
|
119 | result = checkfeatures(features) | |
120 |
|
120 | |||
121 | for missing in result['missing']: |
|
121 | for missing in result['missing']: | |
122 | stderr.write( |
|
122 | stderr.write( | |
123 | ('skipped: unknown feature: %s\n' % missing).encode('utf-8') |
|
123 | ('skipped: unknown feature: %s\n' % missing).encode('utf-8') | |
124 | ) |
|
124 | ) | |
125 | for msg in result['skipped']: |
|
125 | for msg in result['skipped']: | |
126 | stderr.write(('skipped: %s\n' % msg).encode('utf-8')) |
|
126 | stderr.write(('skipped: %s\n' % msg).encode('utf-8')) | |
127 | for msg in result['error']: |
|
127 | for msg in result['error']: | |
128 | stderr.write(('%s\n' % msg).encode('utf-8')) |
|
128 | stderr.write(('%s\n' % msg).encode('utf-8')) | |
129 |
|
129 | |||
130 | if result['missing']: |
|
130 | if result['missing']: | |
131 | sys.exit(2) |
|
131 | sys.exit(2) | |
132 |
|
132 | |||
133 | if result['skipped'] or result['error']: |
|
133 | if result['skipped'] or result['error']: | |
134 | sys.exit(1) |
|
134 | sys.exit(1) | |
135 |
|
135 | |||
136 |
|
136 | |||
137 | def matchoutput(cmd, regexp, ignorestatus=False): |
|
137 | def matchoutput(cmd, regexp, ignorestatus=False): | |
138 | """Return the match object if cmd executes successfully and its output |
|
138 | """Return the match object if cmd executes successfully and its output | |
139 | is matched by the supplied regular expression. |
|
139 | is matched by the supplied regular expression. | |
140 | """ |
|
140 | """ | |
141 | r = re.compile(regexp) |
|
141 | r = re.compile(regexp) | |
142 | p = subprocess.Popen( |
|
142 | p = subprocess.Popen( | |
143 | cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT |
|
143 | cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT | |
144 | ) |
|
144 | ) | |
145 | s = p.communicate()[0] |
|
145 | s = p.communicate()[0] | |
146 | ret = p.returncode |
|
146 | ret = p.returncode | |
147 | return (ignorestatus or not ret) and r.search(s) |
|
147 | return (ignorestatus or not ret) and r.search(s) | |
148 |
|
148 | |||
149 |
|
149 | |||
150 | @check("baz", "GNU Arch baz client") |
|
150 | @check("baz", "GNU Arch baz client") | |
151 | def has_baz(): |
|
151 | def has_baz(): | |
152 | return matchoutput('baz --version 2>&1', br'baz Bazaar version') |
|
152 | return matchoutput('baz --version 2>&1', br'baz Bazaar version') | |
153 |
|
153 | |||
154 |
|
154 | |||
155 | @check("bzr", "Canonical's Bazaar client") |
|
155 | @check("bzr", "Canonical's Bazaar client") | |
156 | def has_bzr(): |
|
156 | def has_bzr(): | |
157 | try: |
|
157 | try: | |
158 | import bzrlib |
|
158 | import bzrlib | |
159 | import bzrlib.bzrdir |
|
159 | import bzrlib.bzrdir | |
160 | import bzrlib.errors |
|
160 | import bzrlib.errors | |
161 | import bzrlib.revision |
|
161 | import bzrlib.revision | |
162 | import bzrlib.revisionspec |
|
162 | import bzrlib.revisionspec | |
163 |
|
163 | |||
164 | bzrlib.revisionspec.RevisionSpec |
|
164 | bzrlib.revisionspec.RevisionSpec | |
165 | return bzrlib.__doc__ is not None |
|
165 | return bzrlib.__doc__ is not None | |
166 | except (AttributeError, ImportError): |
|
166 | except (AttributeError, ImportError): | |
167 | return False |
|
167 | return False | |
168 |
|
168 | |||
169 |
|
169 | |||
170 | @checkvers("bzr", "Canonical's Bazaar client >= %s", (1.14,)) |
|
170 | @checkvers("bzr", "Canonical's Bazaar client >= %s", (1.14,)) | |
171 | def has_bzr_range(v): |
|
171 | def has_bzr_range(v): | |
172 | major, minor = v.split('rc')[0].split('.')[0:2] |
|
172 | major, minor = v.split('rc')[0].split('.')[0:2] | |
173 | try: |
|
173 | try: | |
174 | import bzrlib |
|
174 | import bzrlib | |
175 |
|
175 | |||
176 | return bzrlib.__doc__ is not None and bzrlib.version_info[:2] >= ( |
|
176 | return bzrlib.__doc__ is not None and bzrlib.version_info[:2] >= ( | |
177 | int(major), |
|
177 | int(major), | |
178 | int(minor), |
|
178 | int(minor), | |
179 | ) |
|
179 | ) | |
180 | except ImportError: |
|
180 | except ImportError: | |
181 | return False |
|
181 | return False | |
182 |
|
182 | |||
183 |
|
183 | |||
184 | @check("chg", "running with chg") |
|
184 | @check("chg", "running with chg") | |
185 | def has_chg(): |
|
185 | def has_chg(): | |
186 | return 'CHGHG' in os.environ |
|
186 | return 'CHGHG' in os.environ | |
187 |
|
187 | |||
188 |
|
188 | |||
189 | @check("cvs", "cvs client/server") |
|
189 | @check("cvs", "cvs client/server") | |
190 | def has_cvs(): |
|
190 | def has_cvs(): | |
191 | re = br'Concurrent Versions System.*?server' |
|
191 | re = br'Concurrent Versions System.*?server' | |
192 | return matchoutput('cvs --version 2>&1', re) and not has_msys() |
|
192 | return matchoutput('cvs --version 2>&1', re) and not has_msys() | |
193 |
|
193 | |||
194 |
|
194 | |||
195 | @check("cvs112", "cvs client/server 1.12.* (not cvsnt)") |
|
195 | @check("cvs112", "cvs client/server 1.12.* (not cvsnt)") | |
196 | def has_cvs112(): |
|
196 | def has_cvs112(): | |
197 | re = br'Concurrent Versions System \(CVS\) 1.12.*?server' |
|
197 | re = br'Concurrent Versions System \(CVS\) 1.12.*?server' | |
198 | return matchoutput('cvs --version 2>&1', re) and not has_msys() |
|
198 | return matchoutput('cvs --version 2>&1', re) and not has_msys() | |
199 |
|
199 | |||
200 |
|
200 | |||
201 | @check("cvsnt", "cvsnt client/server") |
|
201 | @check("cvsnt", "cvsnt client/server") | |
202 | def has_cvsnt(): |
|
202 | def has_cvsnt(): | |
203 | re = br'Concurrent Versions System \(CVSNT\) (\d+).(\d+).*\(client/server\)' |
|
203 | re = br'Concurrent Versions System \(CVSNT\) (\d+).(\d+).*\(client/server\)' | |
204 | return matchoutput('cvsnt --version 2>&1', re) |
|
204 | return matchoutput('cvsnt --version 2>&1', re) | |
205 |
|
205 | |||
206 |
|
206 | |||
207 | @check("darcs", "darcs client") |
|
207 | @check("darcs", "darcs client") | |
208 | def has_darcs(): |
|
208 | def has_darcs(): | |
209 | return matchoutput('darcs --version', br'\b2\.([2-9]|\d{2})', True) |
|
209 | return matchoutput('darcs --version', br'\b2\.([2-9]|\d{2})', True) | |
210 |
|
210 | |||
211 |
|
211 | |||
212 | @check("mtn", "monotone client (>= 1.0)") |
|
212 | @check("mtn", "monotone client (>= 1.0)") | |
213 | def has_mtn(): |
|
213 | def has_mtn(): | |
214 | return matchoutput('mtn --version', br'monotone', True) and not matchoutput( |
|
214 | return matchoutput('mtn --version', br'monotone', True) and not matchoutput( | |
215 | 'mtn --version', br'monotone 0\.', True |
|
215 | 'mtn --version', br'monotone 0\.', True | |
216 | ) |
|
216 | ) | |
217 |
|
217 | |||
218 |
|
218 | |||
219 | @check("eol-in-paths", "end-of-lines in paths") |
|
219 | @check("eol-in-paths", "end-of-lines in paths") | |
220 | def has_eol_in_paths(): |
|
220 | def has_eol_in_paths(): | |
221 | try: |
|
221 | try: | |
222 | fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix, suffix='\n\r') |
|
222 | fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix, suffix='\n\r') | |
223 | os.close(fd) |
|
223 | os.close(fd) | |
224 | os.remove(path) |
|
224 | os.remove(path) | |
225 | return True |
|
225 | return True | |
226 | except (IOError, OSError): |
|
226 | except (IOError, OSError): | |
227 | return False |
|
227 | return False | |
228 |
|
228 | |||
229 |
|
229 | |||
230 | @check("execbit", "executable bit") |
|
230 | @check("execbit", "executable bit") | |
231 | def has_executablebit(): |
|
231 | def has_executablebit(): | |
232 | try: |
|
232 | try: | |
233 | EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH |
|
233 | EXECFLAGS = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH | |
234 | fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix) |
|
234 | fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix) | |
235 | try: |
|
235 | try: | |
236 | os.close(fh) |
|
236 | os.close(fh) | |
237 | m = os.stat(fn).st_mode & 0o777 |
|
237 | m = os.stat(fn).st_mode & 0o777 | |
238 | new_file_has_exec = m & EXECFLAGS |
|
238 | new_file_has_exec = m & EXECFLAGS | |
239 | os.chmod(fn, m ^ EXECFLAGS) |
|
239 | os.chmod(fn, m ^ EXECFLAGS) | |
240 | exec_flags_cannot_flip = (os.stat(fn).st_mode & 0o777) == m |
|
240 | exec_flags_cannot_flip = (os.stat(fn).st_mode & 0o777) == m | |
241 | finally: |
|
241 | finally: | |
242 | os.unlink(fn) |
|
242 | os.unlink(fn) | |
243 | except (IOError, OSError): |
|
243 | except (IOError, OSError): | |
244 | # we don't care, the user probably won't be able to commit anyway |
|
244 | # we don't care, the user probably won't be able to commit anyway | |
245 | return False |
|
245 | return False | |
246 | return not (new_file_has_exec or exec_flags_cannot_flip) |
|
246 | return not (new_file_has_exec or exec_flags_cannot_flip) | |
247 |
|
247 | |||
248 |
|
248 | |||
249 | @check("icasefs", "case insensitive file system") |
|
249 | @check("icasefs", "case insensitive file system") | |
250 | def has_icasefs(): |
|
250 | def has_icasefs(): | |
251 | # Stolen from mercurial.util |
|
251 | # Stolen from mercurial.util | |
252 | fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix) |
|
252 | fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix) | |
253 | os.close(fd) |
|
253 | os.close(fd) | |
254 | try: |
|
254 | try: | |
255 | s1 = os.stat(path) |
|
255 | s1 = os.stat(path) | |
256 | d, b = os.path.split(path) |
|
256 | d, b = os.path.split(path) | |
257 | p2 = os.path.join(d, b.upper()) |
|
257 | p2 = os.path.join(d, b.upper()) | |
258 | if path == p2: |
|
258 | if path == p2: | |
259 | p2 = os.path.join(d, b.lower()) |
|
259 | p2 = os.path.join(d, b.lower()) | |
260 | try: |
|
260 | try: | |
261 | s2 = os.stat(p2) |
|
261 | s2 = os.stat(p2) | |
262 | return s2 == s1 |
|
262 | return s2 == s1 | |
263 | except OSError: |
|
263 | except OSError: | |
264 | return False |
|
264 | return False | |
265 | finally: |
|
265 | finally: | |
266 | os.remove(path) |
|
266 | os.remove(path) | |
267 |
|
267 | |||
268 |
|
268 | |||
269 | @check("fifo", "named pipes") |
|
269 | @check("fifo", "named pipes") | |
270 | def has_fifo(): |
|
270 | def has_fifo(): | |
271 | if getattr(os, "mkfifo", None) is None: |
|
271 | if getattr(os, "mkfifo", None) is None: | |
272 | return False |
|
272 | return False | |
273 | name = tempfile.mktemp(dir='.', prefix=tempprefix) |
|
273 | name = tempfile.mktemp(dir='.', prefix=tempprefix) | |
274 | try: |
|
274 | try: | |
275 | os.mkfifo(name) |
|
275 | os.mkfifo(name) | |
276 | os.unlink(name) |
|
276 | os.unlink(name) | |
277 | return True |
|
277 | return True | |
278 | except OSError: |
|
278 | except OSError: | |
279 | return False |
|
279 | return False | |
280 |
|
280 | |||
281 |
|
281 | |||
282 | @check("killdaemons", 'killdaemons.py support') |
|
282 | @check("killdaemons", 'killdaemons.py support') | |
283 | def has_killdaemons(): |
|
283 | def has_killdaemons(): | |
284 | return True |
|
284 | return True | |
285 |
|
285 | |||
286 |
|
286 | |||
287 | @check("cacheable", "cacheable filesystem") |
|
287 | @check("cacheable", "cacheable filesystem") | |
288 | def has_cacheable_fs(): |
|
288 | def has_cacheable_fs(): | |
289 | from mercurial import util |
|
289 | from mercurial import util | |
290 |
|
290 | |||
291 | fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix) |
|
291 | fd, path = tempfile.mkstemp(dir='.', prefix=tempprefix) | |
292 | os.close(fd) |
|
292 | os.close(fd) | |
293 | try: |
|
293 | try: | |
294 | return util.cachestat(path).cacheable() |
|
294 | return util.cachestat(path).cacheable() | |
295 | finally: |
|
295 | finally: | |
296 | os.remove(path) |
|
296 | os.remove(path) | |
297 |
|
297 | |||
298 |
|
298 | |||
299 | @check("lsprof", "python lsprof module") |
|
299 | @check("lsprof", "python lsprof module") | |
300 | def has_lsprof(): |
|
300 | def has_lsprof(): | |
301 | try: |
|
301 | try: | |
302 | import _lsprof |
|
302 | import _lsprof | |
303 |
|
303 | |||
304 | _lsprof.Profiler # silence unused import warning |
|
304 | _lsprof.Profiler # silence unused import warning | |
305 | return True |
|
305 | return True | |
306 | except ImportError: |
|
306 | except ImportError: | |
307 | return False |
|
307 | return False | |
308 |
|
308 | |||
309 |
|
309 | |||
310 | def _gethgversion(): |
|
310 | def _gethgversion(): | |
311 | m = matchoutput('hg --version --quiet 2>&1', br'(\d+)\.(\d+)') |
|
311 | m = matchoutput('hg --version --quiet 2>&1', br'(\d+)\.(\d+)') | |
312 | if not m: |
|
312 | if not m: | |
313 | return (0, 0) |
|
313 | return (0, 0) | |
314 | return (int(m.group(1)), int(m.group(2))) |
|
314 | return (int(m.group(1)), int(m.group(2))) | |
315 |
|
315 | |||
316 |
|
316 | |||
317 | _hgversion = None |
|
317 | _hgversion = None | |
318 |
|
318 | |||
319 |
|
319 | |||
320 | def gethgversion(): |
|
320 | def gethgversion(): | |
321 | global _hgversion |
|
321 | global _hgversion | |
322 | if _hgversion is None: |
|
322 | if _hgversion is None: | |
323 | _hgversion = _gethgversion() |
|
323 | _hgversion = _gethgversion() | |
324 | return _hgversion |
|
324 | return _hgversion | |
325 |
|
325 | |||
326 |
|
326 | |||
327 | @checkvers( |
|
327 | @checkvers( | |
328 | "hg", "Mercurial >= %s", list([(1.0 * x) / 10 for x in range(9, 99)]) |
|
328 | "hg", "Mercurial >= %s", list([(1.0 * x) / 10 for x in range(9, 99)]) | |
329 | ) |
|
329 | ) | |
330 | def has_hg_range(v): |
|
330 | def has_hg_range(v): | |
331 | major, minor = v.split('.')[0:2] |
|
331 | major, minor = v.split('.')[0:2] | |
332 | return gethgversion() >= (int(major), int(minor)) |
|
332 | return gethgversion() >= (int(major), int(minor)) | |
333 |
|
333 | |||
334 |
|
334 | |||
335 | @check("rust", "Using the Rust extensions") |
|
335 | @check("rust", "Using the Rust extensions") | |
336 | def has_rust(): |
|
336 | def has_rust(): | |
337 | """Check is the mercurial currently running is using some rust code""" |
|
337 | """Check is the mercurial currently running is using some rust code""" | |
338 | cmd = 'hg debuginstall --quiet 2>&1' |
|
338 | cmd = 'hg debuginstall --quiet 2>&1' | |
339 | match = br'checking module policy \(([^)]+)\)' |
|
339 | match = br'checking module policy \(([^)]+)\)' | |
340 | policy = matchoutput(cmd, match) |
|
340 | policy = matchoutput(cmd, match) | |
341 | if not policy: |
|
341 | if not policy: | |
342 | return False |
|
342 | return False | |
343 | return b'rust' in policy.group(1) |
|
343 | return b'rust' in policy.group(1) | |
344 |
|
344 | |||
345 |
|
345 | |||
346 | @check("hg08", "Mercurial >= 0.8") |
|
346 | @check("hg08", "Mercurial >= 0.8") | |
347 | def has_hg08(): |
|
347 | def has_hg08(): | |
348 | if checks["hg09"][0](): |
|
348 | if checks["hg09"][0](): | |
349 | return True |
|
349 | return True | |
350 | return matchoutput('hg help annotate 2>&1', '--date') |
|
350 | return matchoutput('hg help annotate 2>&1', '--date') | |
351 |
|
351 | |||
352 |
|
352 | |||
353 | @check("hg07", "Mercurial >= 0.7") |
|
353 | @check("hg07", "Mercurial >= 0.7") | |
354 | def has_hg07(): |
|
354 | def has_hg07(): | |
355 | if checks["hg08"][0](): |
|
355 | if checks["hg08"][0](): | |
356 | return True |
|
356 | return True | |
357 | return matchoutput('hg --version --quiet 2>&1', 'Mercurial Distributed SCM') |
|
357 | return matchoutput('hg --version --quiet 2>&1', 'Mercurial Distributed SCM') | |
358 |
|
358 | |||
359 |
|
359 | |||
360 | @check("hg06", "Mercurial >= 0.6") |
|
360 | @check("hg06", "Mercurial >= 0.6") | |
361 | def has_hg06(): |
|
361 | def has_hg06(): | |
362 | if checks["hg07"][0](): |
|
362 | if checks["hg07"][0](): | |
363 | return True |
|
363 | return True | |
364 | return matchoutput('hg --version --quiet 2>&1', 'Mercurial version') |
|
364 | return matchoutput('hg --version --quiet 2>&1', 'Mercurial version') | |
365 |
|
365 | |||
366 |
|
366 | |||
367 | @check("gettext", "GNU Gettext (msgfmt)") |
|
367 | @check("gettext", "GNU Gettext (msgfmt)") | |
368 | def has_gettext(): |
|
368 | def has_gettext(): | |
369 | return matchoutput('msgfmt --version', br'GNU gettext-tools') |
|
369 | return matchoutput('msgfmt --version', br'GNU gettext-tools') | |
370 |
|
370 | |||
371 |
|
371 | |||
372 | @check("git", "git command line client") |
|
372 | @check("git", "git command line client") | |
373 | def has_git(): |
|
373 | def has_git(): | |
374 | return matchoutput('git --version 2>&1', br'^git version') |
|
374 | return matchoutput('git --version 2>&1', br'^git version') | |
375 |
|
375 | |||
376 |
|
376 | |||
377 | def getgitversion(): |
|
377 | def getgitversion(): | |
378 | m = matchoutput('git --version 2>&1', br'git version (\d+)\.(\d+)') |
|
378 | m = matchoutput('git --version 2>&1', br'git version (\d+)\.(\d+)') | |
379 | if not m: |
|
379 | if not m: | |
380 | return (0, 0) |
|
380 | return (0, 0) | |
381 | return (int(m.group(1)), int(m.group(2))) |
|
381 | return (int(m.group(1)), int(m.group(2))) | |
382 |
|
382 | |||
383 |
|
383 | |||
384 | @check("pygit2", "pygit2 Python library") |
|
384 | @check("pygit2", "pygit2 Python library") | |
385 | def has_git(): |
|
385 | def has_git(): | |
386 | try: |
|
386 | try: | |
387 | import pygit2 |
|
387 | import pygit2 | |
388 |
|
388 | |||
389 | pygit2.Oid # silence unused import |
|
389 | pygit2.Oid # silence unused import | |
390 | return True |
|
390 | return True | |
391 | except ImportError: |
|
391 | except ImportError: | |
392 | return False |
|
392 | return False | |
393 |
|
393 | |||
394 |
|
394 | |||
395 | # https://github.com/git-lfs/lfs-test-server |
|
395 | # https://github.com/git-lfs/lfs-test-server | |
396 | @check("lfs-test-server", "git-lfs test server") |
|
396 | @check("lfs-test-server", "git-lfs test server") | |
397 | def has_lfsserver(): |
|
397 | def has_lfsserver(): | |
398 | exe = 'lfs-test-server' |
|
398 | exe = 'lfs-test-server' | |
399 | if has_windows(): |
|
399 | if has_windows(): | |
400 | exe = 'lfs-test-server.exe' |
|
400 | exe = 'lfs-test-server.exe' | |
401 | return any( |
|
401 | return any( | |
402 | os.access(os.path.join(path, exe), os.X_OK) |
|
402 | os.access(os.path.join(path, exe), os.X_OK) | |
403 | for path in os.environ["PATH"].split(os.pathsep) |
|
403 | for path in os.environ["PATH"].split(os.pathsep) | |
404 | ) |
|
404 | ) | |
405 |
|
405 | |||
406 |
|
406 | |||
407 | @checkvers("git", "git client (with ext::sh support) version >= %s", (1.9,)) |
|
407 | @checkvers("git", "git client (with ext::sh support) version >= %s", (1.9,)) | |
408 | def has_git_range(v): |
|
408 | def has_git_range(v): | |
409 | major, minor = v.split('.')[0:2] |
|
409 | major, minor = v.split('.')[0:2] | |
410 | return getgitversion() >= (int(major), int(minor)) |
|
410 | return getgitversion() >= (int(major), int(minor)) | |
411 |
|
411 | |||
412 |
|
412 | |||
413 | @check("docutils", "Docutils text processing library") |
|
413 | @check("docutils", "Docutils text processing library") | |
414 | def has_docutils(): |
|
414 | def has_docutils(): | |
415 | try: |
|
415 | try: | |
416 | import docutils.core |
|
416 | import docutils.core | |
417 |
|
417 | |||
418 | docutils.core.publish_cmdline # silence unused import |
|
418 | docutils.core.publish_cmdline # silence unused import | |
419 | return True |
|
419 | return True | |
420 | except ImportError: |
|
420 | except ImportError: | |
421 | return False |
|
421 | return False | |
422 |
|
422 | |||
423 |
|
423 | |||
424 | def getsvnversion(): |
|
424 | def getsvnversion(): | |
425 | m = matchoutput('svn --version --quiet 2>&1', br'^(\d+)\.(\d+)') |
|
425 | m = matchoutput('svn --version --quiet 2>&1', br'^(\d+)\.(\d+)') | |
426 | if not m: |
|
426 | if not m: | |
427 | return (0, 0) |
|
427 | return (0, 0) | |
428 | return (int(m.group(1)), int(m.group(2))) |
|
428 | return (int(m.group(1)), int(m.group(2))) | |
429 |
|
429 | |||
430 |
|
430 | |||
431 | @checkvers("svn", "subversion client and admin tools >= %s", (1.3, 1.5)) |
|
431 | @checkvers("svn", "subversion client and admin tools >= %s", (1.3, 1.5)) | |
432 | def has_svn_range(v): |
|
432 | def has_svn_range(v): | |
433 | major, minor = v.split('.')[0:2] |
|
433 | major, minor = v.split('.')[0:2] | |
434 | return getsvnversion() >= (int(major), int(minor)) |
|
434 | return getsvnversion() >= (int(major), int(minor)) | |
435 |
|
435 | |||
436 |
|
436 | |||
437 | @check("svn", "subversion client and admin tools") |
|
437 | @check("svn", "subversion client and admin tools") | |
438 | def has_svn(): |
|
438 | def has_svn(): | |
439 | return matchoutput('svn --version 2>&1', br'^svn, version') and matchoutput( |
|
439 | return matchoutput('svn --version 2>&1', br'^svn, version') and matchoutput( | |
440 | 'svnadmin --version 2>&1', br'^svnadmin, version' |
|
440 | 'svnadmin --version 2>&1', br'^svnadmin, version' | |
441 | ) |
|
441 | ) | |
442 |
|
442 | |||
443 |
|
443 | |||
444 | @check("svn-bindings", "subversion python bindings") |
|
444 | @check("svn-bindings", "subversion python bindings") | |
445 | def has_svn_bindings(): |
|
445 | def has_svn_bindings(): | |
446 | try: |
|
446 | try: | |
447 | import svn.core |
|
447 | import svn.core | |
448 |
|
448 | |||
449 | version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR |
|
449 | version = svn.core.SVN_VER_MAJOR, svn.core.SVN_VER_MINOR | |
450 | if version < (1, 4): |
|
450 | if version < (1, 4): | |
451 | return False |
|
451 | return False | |
452 | return True |
|
452 | return True | |
453 | except ImportError: |
|
453 | except ImportError: | |
454 | return False |
|
454 | return False | |
455 |
|
455 | |||
456 |
|
456 | |||
457 | @check("p4", "Perforce server and client") |
|
457 | @check("p4", "Perforce server and client") | |
458 | def has_p4(): |
|
458 | def has_p4(): | |
459 | return matchoutput('p4 -V', br'Rev\. P4/') and matchoutput( |
|
459 | return matchoutput('p4 -V', br'Rev\. P4/') and matchoutput( | |
460 | 'p4d -V', br'Rev\. P4D/' |
|
460 | 'p4d -V', br'Rev\. P4D/' | |
461 | ) |
|
461 | ) | |
462 |
|
462 | |||
463 |
|
463 | |||
464 | @check("symlink", "symbolic links") |
|
464 | @check("symlink", "symbolic links") | |
465 | def has_symlink(): |
|
465 | def has_symlink(): | |
466 | # mercurial.windows.checklink() is a hard 'no' at the moment |
|
466 | # mercurial.windows.checklink() is a hard 'no' at the moment | |
467 | if os.name == 'nt' or getattr(os, "symlink", None) is None: |
|
467 | if os.name == 'nt' or getattr(os, "symlink", None) is None: | |
468 | return False |
|
468 | return False | |
469 | name = tempfile.mktemp(dir='.', prefix=tempprefix) |
|
469 | name = tempfile.mktemp(dir='.', prefix=tempprefix) | |
470 | try: |
|
470 | try: | |
471 | os.symlink(".", name) |
|
471 | os.symlink(".", name) | |
472 | os.unlink(name) |
|
472 | os.unlink(name) | |
473 | return True |
|
473 | return True | |
474 | except (OSError, AttributeError): |
|
474 | except (OSError, AttributeError): | |
475 | return False |
|
475 | return False | |
476 |
|
476 | |||
477 |
|
477 | |||
478 | @check("hardlink", "hardlinks") |
|
478 | @check("hardlink", "hardlinks") | |
479 | def has_hardlink(): |
|
479 | def has_hardlink(): | |
480 | from mercurial import util |
|
480 | from mercurial import util | |
481 |
|
481 | |||
482 | fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix) |
|
482 | fh, fn = tempfile.mkstemp(dir='.', prefix=tempprefix) | |
483 | os.close(fh) |
|
483 | os.close(fh) | |
484 | name = tempfile.mktemp(dir='.', prefix=tempprefix) |
|
484 | name = tempfile.mktemp(dir='.', prefix=tempprefix) | |
485 | try: |
|
485 | try: | |
486 | util.oslink(_sys2bytes(fn), _sys2bytes(name)) |
|
486 | util.oslink(_sys2bytes(fn), _sys2bytes(name)) | |
487 | os.unlink(name) |
|
487 | os.unlink(name) | |
488 | return True |
|
488 | return True | |
489 | except OSError: |
|
489 | except OSError: | |
490 | return False |
|
490 | return False | |
491 | finally: |
|
491 | finally: | |
492 | os.unlink(fn) |
|
492 | os.unlink(fn) | |
493 |
|
493 | |||
494 |
|
494 | |||
495 | @check("hardlink-whitelisted", "hardlinks on whitelisted filesystems") |
|
495 | @check("hardlink-whitelisted", "hardlinks on whitelisted filesystems") | |
496 | def has_hardlink_whitelisted(): |
|
496 | def has_hardlink_whitelisted(): | |
497 | from mercurial import util |
|
497 | from mercurial import util | |
498 |
|
498 | |||
499 | try: |
|
499 | try: | |
500 | fstype = util.getfstype(b'.') |
|
500 | fstype = util.getfstype(b'.') | |
501 | except OSError: |
|
501 | except OSError: | |
502 | return False |
|
502 | return False | |
503 | return fstype in util._hardlinkfswhitelist |
|
503 | return fstype in util._hardlinkfswhitelist | |
504 |
|
504 | |||
505 |
|
505 | |||
506 | @check("rmcwd", "can remove current working directory") |
|
506 | @check("rmcwd", "can remove current working directory") | |
507 | def has_rmcwd(): |
|
507 | def has_rmcwd(): | |
508 | ocwd = os.getcwd() |
|
508 | ocwd = os.getcwd() | |
509 | temp = tempfile.mkdtemp(dir='.', prefix=tempprefix) |
|
509 | temp = tempfile.mkdtemp(dir='.', prefix=tempprefix) | |
510 | try: |
|
510 | try: | |
511 | os.chdir(temp) |
|
511 | os.chdir(temp) | |
512 | # On Linux, 'rmdir .' isn't allowed, but the other names are okay. |
|
512 | # On Linux, 'rmdir .' isn't allowed, but the other names are okay. | |
513 | # On Solaris and Windows, the cwd can't be removed by any names. |
|
513 | # On Solaris and Windows, the cwd can't be removed by any names. | |
514 | os.rmdir(os.getcwd()) |
|
514 | os.rmdir(os.getcwd()) | |
515 | return True |
|
515 | return True | |
516 | except OSError: |
|
516 | except OSError: | |
517 | return False |
|
517 | return False | |
518 | finally: |
|
518 | finally: | |
519 | os.chdir(ocwd) |
|
519 | os.chdir(ocwd) | |
520 | # clean up temp dir on platforms where cwd can't be removed |
|
520 | # clean up temp dir on platforms where cwd can't be removed | |
521 | try: |
|
521 | try: | |
522 | os.rmdir(temp) |
|
522 | os.rmdir(temp) | |
523 | except OSError: |
|
523 | except OSError: | |
524 | pass |
|
524 | pass | |
525 |
|
525 | |||
526 |
|
526 | |||
527 | @check("tla", "GNU Arch tla client") |
|
527 | @check("tla", "GNU Arch tla client") | |
528 | def has_tla(): |
|
528 | def has_tla(): | |
529 | return matchoutput('tla --version 2>&1', br'The GNU Arch Revision') |
|
529 | return matchoutput('tla --version 2>&1', br'The GNU Arch Revision') | |
530 |
|
530 | |||
531 |
|
531 | |||
532 | @check("gpg", "gpg client") |
|
532 | @check("gpg", "gpg client") | |
533 | def has_gpg(): |
|
533 | def has_gpg(): | |
534 | return matchoutput('gpg --version 2>&1', br'GnuPG') |
|
534 | return matchoutput('gpg --version 2>&1', br'GnuPG') | |
535 |
|
535 | |||
536 |
|
536 | |||
537 | @check("gpg2", "gpg client v2") |
|
537 | @check("gpg2", "gpg client v2") | |
538 | def has_gpg2(): |
|
538 | def has_gpg2(): | |
539 | return matchoutput('gpg --version 2>&1', br'GnuPG[^0-9]+2\.') |
|
539 | return matchoutput('gpg --version 2>&1', br'GnuPG[^0-9]+2\.') | |
540 |
|
540 | |||
541 |
|
541 | |||
542 | @check("gpg21", "gpg client v2.1+") |
|
542 | @check("gpg21", "gpg client v2.1+") | |
543 | def has_gpg21(): |
|
543 | def has_gpg21(): | |
544 | return matchoutput('gpg --version 2>&1', br'GnuPG[^0-9]+2\.(?!0)') |
|
544 | return matchoutput('gpg --version 2>&1', br'GnuPG[^0-9]+2\.(?!0)') | |
545 |
|
545 | |||
546 |
|
546 | |||
547 | @check("unix-permissions", "unix-style permissions") |
|
547 | @check("unix-permissions", "unix-style permissions") | |
548 | def has_unix_permissions(): |
|
548 | def has_unix_permissions(): | |
549 | d = tempfile.mkdtemp(dir='.', prefix=tempprefix) |
|
549 | d = tempfile.mkdtemp(dir='.', prefix=tempprefix) | |
550 | try: |
|
550 | try: | |
551 | fname = os.path.join(d, 'foo') |
|
551 | fname = os.path.join(d, 'foo') | |
552 | for umask in (0o77, 0o07, 0o22): |
|
552 | for umask in (0o77, 0o07, 0o22): | |
553 | os.umask(umask) |
|
553 | os.umask(umask) | |
554 | f = open(fname, 'w') |
|
554 | f = open(fname, 'w') | |
555 | f.close() |
|
555 | f.close() | |
556 | mode = os.stat(fname).st_mode |
|
556 | mode = os.stat(fname).st_mode | |
557 | os.unlink(fname) |
|
557 | os.unlink(fname) | |
558 | if mode & 0o777 != ~umask & 0o666: |
|
558 | if mode & 0o777 != ~umask & 0o666: | |
559 | return False |
|
559 | return False | |
560 | return True |
|
560 | return True | |
561 | finally: |
|
561 | finally: | |
562 | os.rmdir(d) |
|
562 | os.rmdir(d) | |
563 |
|
563 | |||
564 |
|
564 | |||
565 | @check("unix-socket", "AF_UNIX socket family") |
|
565 | @check("unix-socket", "AF_UNIX socket family") | |
566 | def has_unix_socket(): |
|
566 | def has_unix_socket(): | |
567 | return getattr(socket, 'AF_UNIX', None) is not None |
|
567 | return getattr(socket, 'AF_UNIX', None) is not None | |
568 |
|
568 | |||
569 |
|
569 | |||
570 | @check("root", "root permissions") |
|
570 | @check("root", "root permissions") | |
571 | def has_root(): |
|
571 | def has_root(): | |
572 | return getattr(os, 'geteuid', None) and os.geteuid() == 0 |
|
572 | return getattr(os, 'geteuid', None) and os.geteuid() == 0 | |
573 |
|
573 | |||
574 |
|
574 | |||
575 | @check("pyflakes", "Pyflakes python linter") |
|
575 | @check("pyflakes", "Pyflakes python linter") | |
576 | def has_pyflakes(): |
|
576 | def has_pyflakes(): | |
577 | try: |
|
577 | try: | |
578 | import pyflakes |
|
578 | import pyflakes | |
579 |
|
579 | |||
580 | pyflakes.__version__ |
|
580 | pyflakes.__version__ | |
581 | except ImportError: |
|
581 | except ImportError: | |
582 | return False |
|
582 | return False | |
583 | else: |
|
583 | else: | |
584 | return True |
|
584 | return True | |
585 |
|
585 | |||
586 |
|
586 | |||
587 | @check("pylint", "Pylint python linter") |
|
587 | @check("pylint", "Pylint python linter") | |
588 | def has_pylint(): |
|
588 | def has_pylint(): | |
589 | return matchoutput("pylint --help", br"Usage: pylint", True) |
|
589 | return matchoutput("pylint --help", br"Usage: pylint", True) | |
590 |
|
590 | |||
591 |
|
591 | |||
592 | @check("clang-format", "clang-format C code formatter") |
|
592 | @check("clang-format", "clang-format C code formatter") | |
593 | def has_clang_format(): |
|
593 | def has_clang_format(): | |
594 | m = matchoutput('clang-format --version', br'clang-format version (\d+)') |
|
594 | m = matchoutput('clang-format --version', br'clang-format version (\d+)') | |
595 | # style changed somewhere between 4.x and 6.x |
|
595 | # style changed somewhere between 4.x and 6.x | |
596 | return m and int(m.group(1)) >= 6 |
|
596 | return m and int(m.group(1)) >= 6 | |
597 |
|
597 | |||
598 |
|
598 | |||
599 | @check("jshint", "JSHint static code analysis tool") |
|
599 | @check("jshint", "JSHint static code analysis tool") | |
600 | def has_jshint(): |
|
600 | def has_jshint(): | |
601 | return matchoutput("jshint --version 2>&1", br"jshint v") |
|
601 | return matchoutput("jshint --version 2>&1", br"jshint v") | |
602 |
|
602 | |||
603 |
|
603 | |||
604 | @check("pygments", "Pygments source highlighting library") |
|
604 | @check("pygments", "Pygments source highlighting library") | |
605 | def has_pygments(): |
|
605 | def has_pygments(): | |
606 | try: |
|
606 | try: | |
607 | import pygments |
|
607 | import pygments | |
608 |
|
608 | |||
609 | pygments.highlight # silence unused import warning |
|
609 | pygments.highlight # silence unused import warning | |
610 | return True |
|
610 | return True | |
611 | except ImportError: |
|
611 | except ImportError: | |
612 | return False |
|
612 | return False | |
613 |
|
613 | |||
614 |
|
614 | |||
615 | @check("pygments25", "Pygments version >= 2.5") |
|
615 | @check("pygments25", "Pygments version >= 2.5") | |
616 | def pygments25(): |
|
616 | def pygments25(): | |
617 | try: |
|
617 | try: | |
618 | import pygments |
|
618 | import pygments | |
619 |
|
619 | |||
620 | v = pygments.__version__ |
|
620 | v = pygments.__version__ | |
621 | except ImportError: |
|
621 | except ImportError: | |
622 | return False |
|
622 | return False | |
623 |
|
623 | |||
624 | parts = v.split(".") |
|
624 | parts = v.split(".") | |
625 | major = int(parts[0]) |
|
625 | major = int(parts[0]) | |
626 | minor = int(parts[1]) |
|
626 | minor = int(parts[1]) | |
627 |
|
627 | |||
628 | return (major, minor) >= (2, 5) |
|
628 | return (major, minor) >= (2, 5) | |
629 |
|
629 | |||
630 |
|
630 | |||
631 | @check("outer-repo", "outer repo") |
|
631 | @check("outer-repo", "outer repo") | |
632 | def has_outer_repo(): |
|
632 | def has_outer_repo(): | |
633 | # failing for other reasons than 'no repo' imply that there is a repo |
|
633 | # failing for other reasons than 'no repo' imply that there is a repo | |
634 | return not matchoutput('hg root 2>&1', br'abort: no repository found', True) |
|
634 | return not matchoutput('hg root 2>&1', br'abort: no repository found', True) | |
635 |
|
635 | |||
636 |
|
636 | |||
637 | @check("ssl", "ssl module available") |
|
637 | @check("ssl", "ssl module available") | |
638 | def has_ssl(): |
|
638 | def has_ssl(): | |
639 | try: |
|
639 | try: | |
640 | import ssl |
|
640 | import ssl | |
641 |
|
641 | |||
642 | ssl.CERT_NONE |
|
642 | ssl.CERT_NONE | |
643 | return True |
|
643 | return True | |
644 | except ImportError: |
|
644 | except ImportError: | |
645 | return False |
|
645 | return False | |
646 |
|
646 | |||
647 |
|
647 | |||
648 | @check("defaultcacertsloaded", "detected presence of loaded system CA certs") |
|
648 | @check("defaultcacertsloaded", "detected presence of loaded system CA certs") | |
649 | def has_defaultcacertsloaded(): |
|
649 | def has_defaultcacertsloaded(): | |
650 | import ssl |
|
650 | import ssl | |
651 | from mercurial import sslutil, ui as uimod |
|
651 | from mercurial import sslutil, ui as uimod | |
652 |
|
652 | |||
653 | ui = uimod.ui.load() |
|
653 | ui = uimod.ui.load() | |
654 | cafile = sslutil._defaultcacerts(ui) |
|
654 | cafile = sslutil._defaultcacerts(ui) | |
655 | ctx = ssl.create_default_context() |
|
655 | ctx = ssl.create_default_context() | |
656 | if cafile: |
|
656 | if cafile: | |
657 | ctx.load_verify_locations(cafile=cafile) |
|
657 | ctx.load_verify_locations(cafile=cafile) | |
658 | else: |
|
658 | else: | |
659 | ctx.load_default_certs() |
|
659 | ctx.load_default_certs() | |
660 |
|
660 | |||
661 | return len(ctx.get_ca_certs()) > 0 |
|
661 | return len(ctx.get_ca_certs()) > 0 | |
662 |
|
662 | |||
663 |
|
663 | |||
664 | @check("tls1.2", "TLS 1.2 protocol support") |
|
664 | @check("tls1.2", "TLS 1.2 protocol support") | |
665 | def has_tls1_2(): |
|
665 | def has_tls1_2(): | |
666 | from mercurial import sslutil |
|
666 | from mercurial import sslutil | |
667 |
|
667 | |||
668 | return b'tls1.2' in sslutil.supportedprotocols |
|
668 | return b'tls1.2' in sslutil.supportedprotocols | |
669 |
|
669 | |||
670 |
|
670 | |||
671 | @check("windows", "Windows") |
|
671 | @check("windows", "Windows") | |
672 | def has_windows(): |
|
672 | def has_windows(): | |
673 | return os.name == 'nt' |
|
673 | return os.name == 'nt' | |
674 |
|
674 | |||
675 |
|
675 | |||
676 | @check("system-sh", "system() uses sh") |
|
676 | @check("system-sh", "system() uses sh") | |
677 | def has_system_sh(): |
|
677 | def has_system_sh(): | |
678 | return os.name != 'nt' |
|
678 | return os.name != 'nt' | |
679 |
|
679 | |||
680 |
|
680 | |||
681 | @check("serve", "platform and python can manage 'hg serve -d'") |
|
681 | @check("serve", "platform and python can manage 'hg serve -d'") | |
682 | def has_serve(): |
|
682 | def has_serve(): | |
683 | return True |
|
683 | return True | |
684 |
|
684 | |||
685 |
|
685 | |||
686 | @check("setprocname", "whether osutil.setprocname is available or not") |
|
686 | @check("setprocname", "whether osutil.setprocname is available or not") | |
687 | def has_setprocname(): |
|
687 | def has_setprocname(): | |
688 | try: |
|
688 | try: | |
689 | from mercurial.utils import procutil |
|
689 | from mercurial.utils import procutil | |
690 |
|
690 | |||
691 | procutil.setprocname |
|
691 | procutil.setprocname | |
692 | return True |
|
692 | return True | |
693 | except AttributeError: |
|
693 | except AttributeError: | |
694 | return False |
|
694 | return False | |
695 |
|
695 | |||
696 |
|
696 | |||
697 | @check("test-repo", "running tests from repository") |
|
697 | @check("test-repo", "running tests from repository") | |
698 | def has_test_repo(): |
|
698 | def has_test_repo(): | |
699 | t = os.environ["TESTDIR"] |
|
699 | t = os.environ["TESTDIR"] | |
700 | return os.path.isdir(os.path.join(t, "..", ".hg")) |
|
700 | return os.path.isdir(os.path.join(t, "..", ".hg")) | |
701 |
|
701 | |||
702 |
|
702 | |||
703 | @check("tic", "terminfo compiler and curses module") |
|
703 | @check("tic", "terminfo compiler and curses module") | |
704 | def has_tic(): |
|
704 | def has_tic(): | |
705 | try: |
|
705 | try: | |
706 | import curses |
|
706 | import curses | |
707 |
|
707 | |||
708 | curses.COLOR_BLUE |
|
708 | curses.COLOR_BLUE | |
709 | return matchoutput('test -x "`which tic`"', br'') |
|
709 | return matchoutput('test -x "`which tic`"', br'') | |
710 | except (ImportError, AttributeError): |
|
710 | except (ImportError, AttributeError): | |
711 | return False |
|
711 | return False | |
712 |
|
712 | |||
713 |
|
713 | |||
714 | @check("xz", "xz compression utility") |
|
714 | @check("xz", "xz compression utility") | |
715 | def has_xz(): |
|
715 | def has_xz(): | |
716 | # When Windows invokes a subprocess in shell mode, it uses `cmd.exe`, which |
|
716 | # When Windows invokes a subprocess in shell mode, it uses `cmd.exe`, which | |
717 | # only knows `where`, not `which`. So invoke MSYS shell explicitly. |
|
717 | # only knows `where`, not `which`. So invoke MSYS shell explicitly. | |
718 | return matchoutput("sh -c 'test -x \"`which xz`\"'", b'') |
|
718 | return matchoutput("sh -c 'test -x \"`which xz`\"'", b'') | |
719 |
|
719 | |||
720 |
|
720 | |||
721 | @check("msys", "Windows with MSYS") |
|
721 | @check("msys", "Windows with MSYS") | |
722 | def has_msys(): |
|
722 | def has_msys(): | |
723 | return os.getenv('MSYSTEM') |
|
723 | return os.getenv('MSYSTEM') | |
724 |
|
724 | |||
725 |
|
725 | |||
726 | @check("aix", "AIX") |
|
726 | @check("aix", "AIX") | |
727 | def has_aix(): |
|
727 | def has_aix(): | |
728 | return sys.platform.startswith("aix") |
|
728 | return sys.platform.startswith("aix") | |
729 |
|
729 | |||
730 |
|
730 | |||
731 | @check("osx", "OS X") |
|
731 | @check("osx", "OS X") | |
732 | def has_osx(): |
|
732 | def has_osx(): | |
733 | return sys.platform == 'darwin' |
|
733 | return sys.platform == 'darwin' | |
734 |
|
734 | |||
735 |
|
735 | |||
736 | @check("osxpackaging", "OS X packaging tools") |
|
736 | @check("osxpackaging", "OS X packaging tools") | |
737 | def has_osxpackaging(): |
|
737 | def has_osxpackaging(): | |
738 | try: |
|
738 | try: | |
739 | return ( |
|
739 | return ( | |
740 | matchoutput('pkgbuild', br'Usage: pkgbuild ', ignorestatus=1) |
|
740 | matchoutput('pkgbuild', br'Usage: pkgbuild ', ignorestatus=1) | |
741 | and matchoutput( |
|
741 | and matchoutput( | |
742 | 'productbuild', br'Usage: productbuild ', ignorestatus=1 |
|
742 | 'productbuild', br'Usage: productbuild ', ignorestatus=1 | |
743 | ) |
|
743 | ) | |
744 | and matchoutput('lsbom', br'Usage: lsbom', ignorestatus=1) |
|
744 | and matchoutput('lsbom', br'Usage: lsbom', ignorestatus=1) | |
745 | and matchoutput('xar --help', br'Usage: xar', ignorestatus=1) |
|
745 | and matchoutput('xar --help', br'Usage: xar', ignorestatus=1) | |
746 | ) |
|
746 | ) | |
747 | except ImportError: |
|
747 | except ImportError: | |
748 | return False |
|
748 | return False | |
749 |
|
749 | |||
750 |
|
750 | |||
751 | @check('linuxormacos', 'Linux or MacOS') |
|
751 | @check('linuxormacos', 'Linux or MacOS') | |
752 | def has_linuxormacos(): |
|
752 | def has_linuxormacos(): | |
753 | # This isn't a perfect test for MacOS. But it is sufficient for our needs. |
|
753 | # This isn't a perfect test for MacOS. But it is sufficient for our needs. | |
754 | return sys.platform.startswith(('linux', 'darwin')) |
|
754 | return sys.platform.startswith(('linux', 'darwin')) | |
755 |
|
755 | |||
756 |
|
756 | |||
757 | @check("docker", "docker support") |
|
757 | @check("docker", "docker support") | |
758 | def has_docker(): |
|
758 | def has_docker(): | |
759 | pat = br'A self-sufficient runtime for' |
|
759 | pat = br'A self-sufficient runtime for' | |
760 | if matchoutput('docker --help', pat): |
|
760 | if matchoutput('docker --help', pat): | |
761 | if 'linux' not in sys.platform: |
|
761 | if 'linux' not in sys.platform: | |
762 | # TODO: in theory we should be able to test docker-based |
|
762 | # TODO: in theory we should be able to test docker-based | |
763 | # package creation on non-linux using boot2docker, but in |
|
763 | # package creation on non-linux using boot2docker, but in | |
764 | # practice that requires extra coordination to make sure |
|
764 | # practice that requires extra coordination to make sure | |
765 | # $TESTTEMP is going to be visible at the same path to the |
|
765 | # $TESTTEMP is going to be visible at the same path to the | |
766 | # boot2docker VM. If we figure out how to verify that, we |
|
766 | # boot2docker VM. If we figure out how to verify that, we | |
767 | # can use the following instead of just saying False: |
|
767 | # can use the following instead of just saying False: | |
768 | # return 'DOCKER_HOST' in os.environ |
|
768 | # return 'DOCKER_HOST' in os.environ | |
769 | return False |
|
769 | return False | |
770 |
|
770 | |||
771 | return True |
|
771 | return True | |
772 | return False |
|
772 | return False | |
773 |
|
773 | |||
774 |
|
774 | |||
775 | @check("debhelper", "debian packaging tools") |
|
775 | @check("debhelper", "debian packaging tools") | |
776 | def has_debhelper(): |
|
776 | def has_debhelper(): | |
777 | # Some versions of dpkg say `dpkg', some say 'dpkg' (` vs ' on the first |
|
777 | # Some versions of dpkg say `dpkg', some say 'dpkg' (` vs ' on the first | |
778 | # quote), so just accept anything in that spot. |
|
778 | # quote), so just accept anything in that spot. | |
779 | dpkg = matchoutput( |
|
779 | dpkg = matchoutput( | |
780 | 'dpkg --version', br"Debian .dpkg' package management program" |
|
780 | 'dpkg --version', br"Debian .dpkg' package management program" | |
781 | ) |
|
781 | ) | |
782 | dh = matchoutput( |
|
782 | dh = matchoutput( | |
783 | 'dh --help', br'dh is a part of debhelper.', ignorestatus=True |
|
783 | 'dh --help', br'dh is a part of debhelper.', ignorestatus=True | |
784 | ) |
|
784 | ) | |
785 | dh_py2 = matchoutput( |
|
785 | dh_py2 = matchoutput( | |
786 | 'dh_python2 --help', br'other supported Python versions' |
|
786 | 'dh_python2 --help', br'other supported Python versions' | |
787 | ) |
|
787 | ) | |
788 | # debuild comes from the 'devscripts' package, though you might want |
|
788 | # debuild comes from the 'devscripts' package, though you might want | |
789 | # the 'build-debs' package instead, which has a dependency on devscripts. |
|
789 | # the 'build-debs' package instead, which has a dependency on devscripts. | |
790 | debuild = matchoutput( |
|
790 | debuild = matchoutput( | |
791 | 'debuild --help', br'to run debian/rules with given parameter' |
|
791 | 'debuild --help', br'to run debian/rules with given parameter' | |
792 | ) |
|
792 | ) | |
793 | return dpkg and dh and dh_py2 and debuild |
|
793 | return dpkg and dh and dh_py2 and debuild | |
794 |
|
794 | |||
795 |
|
795 | |||
796 | @check( |
|
796 | @check( | |
797 | "debdeps", "debian build dependencies (run dpkg-checkbuilddeps in contrib/)" |
|
797 | "debdeps", "debian build dependencies (run dpkg-checkbuilddeps in contrib/)" | |
798 | ) |
|
798 | ) | |
799 | def has_debdeps(): |
|
799 | def has_debdeps(): | |
800 | # just check exit status (ignoring output) |
|
800 | # just check exit status (ignoring output) | |
801 | path = '%s/../contrib/packaging/debian/control' % os.environ['TESTDIR'] |
|
801 | path = '%s/../contrib/packaging/debian/control' % os.environ['TESTDIR'] | |
802 | return matchoutput('dpkg-checkbuilddeps %s' % path, br'') |
|
802 | return matchoutput('dpkg-checkbuilddeps %s' % path, br'') | |
803 |
|
803 | |||
804 |
|
804 | |||
805 | @check("demandimport", "demandimport enabled") |
|
805 | @check("demandimport", "demandimport enabled") | |
806 | def has_demandimport(): |
|
806 | def has_demandimport(): | |
807 | # chg disables demandimport intentionally for performance wins. |
|
807 | # chg disables demandimport intentionally for performance wins. | |
808 | return (not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable' |
|
808 | return (not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable' | |
809 |
|
809 | |||
810 |
|
810 | |||
811 | # Add "py27", "py35", ... as possible feature checks. Note that there's no |
|
811 | # Add "py27", "py35", ... as possible feature checks. Note that there's no | |
812 | # punctuation here. |
|
812 | # punctuation here. | |
813 | @checkvers("py", "Python >= %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9)) |
|
813 | @checkvers("py", "Python >= %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9)) | |
814 | def has_python_range(v): |
|
814 | def has_python_range(v): | |
815 | major, minor = v.split('.')[0:2] |
|
815 | major, minor = v.split('.')[0:2] | |
816 | py_major, py_minor = sys.version_info.major, sys.version_info.minor |
|
816 | py_major, py_minor = sys.version_info.major, sys.version_info.minor | |
817 |
|
817 | |||
818 | return (py_major, py_minor) >= (int(major), int(minor)) |
|
818 | return (py_major, py_minor) >= (int(major), int(minor)) | |
819 |
|
819 | |||
820 |
|
820 | |||
821 | @check("py3", "running with Python 3.x") |
|
821 | @check("py3", "running with Python 3.x") | |
822 | def has_py3(): |
|
822 | def has_py3(): | |
823 | return 3 == sys.version_info[0] |
|
823 | return 3 == sys.version_info[0] | |
824 |
|
824 | |||
825 |
|
825 | |||
826 | @check("py3exe", "a Python 3.x interpreter is available") |
|
826 | @check("py3exe", "a Python 3.x interpreter is available") | |
827 | def has_python3exe(): |
|
827 | def has_python3exe(): | |
828 | return matchoutput('python3 -V', br'^Python 3.(5|6|7|8|9)') |
|
828 | return matchoutput('python3 -V', br'^Python 3.(5|6|7|8|9)') | |
829 |
|
829 | |||
830 |
|
830 | |||
831 | @check("pure", "running with pure Python code") |
|
831 | @check("pure", "running with pure Python code") | |
832 | def has_pure(): |
|
832 | def has_pure(): | |
833 | return any( |
|
833 | return any( | |
834 | [ |
|
834 | [ | |
835 | os.environ.get("HGMODULEPOLICY") == "py", |
|
835 | os.environ.get("HGMODULEPOLICY") == "py", | |
836 | os.environ.get("HGTEST_RUN_TESTS_PURE") == "--pure", |
|
836 | os.environ.get("HGTEST_RUN_TESTS_PURE") == "--pure", | |
837 | ] |
|
837 | ] | |
838 | ) |
|
838 | ) | |
839 |
|
839 | |||
840 |
|
840 | |||
841 | @check("slow", "allow slow tests (use --allow-slow-tests)") |
|
841 | @check("slow", "allow slow tests (use --allow-slow-tests)") | |
842 | def has_slow(): |
|
842 | def has_slow(): | |
843 | return os.environ.get('HGTEST_SLOW') == 'slow' |
|
843 | return os.environ.get('HGTEST_SLOW') == 'slow' | |
844 |
|
844 | |||
845 |
|
845 | |||
846 | @check("hypothesis", "Hypothesis automated test generation") |
|
846 | @check("hypothesis", "Hypothesis automated test generation") | |
847 | def has_hypothesis(): |
|
847 | def has_hypothesis(): | |
848 | try: |
|
848 | try: | |
849 | import hypothesis |
|
849 | import hypothesis | |
850 |
|
850 | |||
851 | hypothesis.given |
|
851 | hypothesis.given | |
852 | return True |
|
852 | return True | |
853 | except ImportError: |
|
853 | except ImportError: | |
854 | return False |
|
854 | return False | |
855 |
|
855 | |||
856 |
|
856 | |||
857 | @check("unziplinks", "unzip(1) understands and extracts symlinks") |
|
857 | @check("unziplinks", "unzip(1) understands and extracts symlinks") | |
858 | def unzip_understands_symlinks(): |
|
858 | def unzip_understands_symlinks(): | |
859 | return matchoutput('unzip --help', br'Info-ZIP') |
|
859 | return matchoutput('unzip --help', br'Info-ZIP') | |
860 |
|
860 | |||
861 |
|
861 | |||
862 | @check("zstd", "zstd Python module available") |
|
862 | @check("zstd", "zstd Python module available") | |
863 | def has_zstd(): |
|
863 | def has_zstd(): | |
864 | try: |
|
864 | try: | |
865 | import mercurial.zstd |
|
865 | import mercurial.zstd | |
866 |
|
866 | |||
867 | mercurial.zstd.__version__ |
|
867 | mercurial.zstd.__version__ | |
868 | return True |
|
868 | return True | |
869 | except ImportError: |
|
869 | except ImportError: | |
870 | return False |
|
870 | return False | |
871 |
|
871 | |||
872 |
|
872 | |||
873 | @check("devfull", "/dev/full special file") |
|
873 | @check("devfull", "/dev/full special file") | |
874 | def has_dev_full(): |
|
874 | def has_dev_full(): | |
875 | return os.path.exists('/dev/full') |
|
875 | return os.path.exists('/dev/full') | |
876 |
|
876 | |||
877 |
|
877 | |||
878 | @check("ensurepip", "ensurepip module") |
|
878 | @check("ensurepip", "ensurepip module") | |
879 | def has_ensurepip(): |
|
879 | def has_ensurepip(): | |
880 | try: |
|
880 | try: | |
881 | import ensurepip |
|
881 | import ensurepip | |
882 |
|
882 | |||
883 | ensurepip.bootstrap |
|
883 | ensurepip.bootstrap | |
884 | return True |
|
884 | return True | |
885 | except ImportError: |
|
885 | except ImportError: | |
886 | return False |
|
886 | return False | |
887 |
|
887 | |||
888 |
|
888 | |||
889 | @check("virtualenv", "Python virtualenv support") |
|
889 | @check("py2virtualenv", "Python2 virtualenv support") | |
890 | def has_virtualenv(): |
|
890 | def has_py2virtualenv(): | |
|
891 | if sys.version_info[0] != 2: | |||
|
892 | return False | |||
|
893 | ||||
891 | try: |
|
894 | try: | |
892 | import virtualenv |
|
895 | import virtualenv | |
893 |
|
896 | |||
894 | virtualenv.ACTIVATE_SH |
|
897 | virtualenv.ACTIVATE_SH | |
895 | return True |
|
898 | return True | |
896 | except ImportError: |
|
899 | except ImportError: | |
897 | return False |
|
900 | return False | |
898 |
|
901 | |||
899 |
|
902 | |||
900 | @check("fsmonitor", "running tests with fsmonitor") |
|
903 | @check("fsmonitor", "running tests with fsmonitor") | |
901 | def has_fsmonitor(): |
|
904 | def has_fsmonitor(): | |
902 | return 'HGFSMONITOR_TESTS' in os.environ |
|
905 | return 'HGFSMONITOR_TESTS' in os.environ | |
903 |
|
906 | |||
904 |
|
907 | |||
905 | @check("fuzzywuzzy", "Fuzzy string matching library") |
|
908 | @check("fuzzywuzzy", "Fuzzy string matching library") | |
906 | def has_fuzzywuzzy(): |
|
909 | def has_fuzzywuzzy(): | |
907 | try: |
|
910 | try: | |
908 | import fuzzywuzzy |
|
911 | import fuzzywuzzy | |
909 |
|
912 | |||
910 | fuzzywuzzy.__version__ |
|
913 | fuzzywuzzy.__version__ | |
911 | return True |
|
914 | return True | |
912 | except ImportError: |
|
915 | except ImportError: | |
913 | return False |
|
916 | return False | |
914 |
|
917 | |||
915 |
|
918 | |||
916 | @check("clang-libfuzzer", "clang new enough to include libfuzzer") |
|
919 | @check("clang-libfuzzer", "clang new enough to include libfuzzer") | |
917 | def has_clang_libfuzzer(): |
|
920 | def has_clang_libfuzzer(): | |
918 | mat = matchoutput('clang --version', br'clang version (\d)') |
|
921 | mat = matchoutput('clang --version', br'clang version (\d)') | |
919 | if mat: |
|
922 | if mat: | |
920 | # libfuzzer is new in clang 6 |
|
923 | # libfuzzer is new in clang 6 | |
921 | return int(mat.group(1)) > 5 |
|
924 | return int(mat.group(1)) > 5 | |
922 | return False |
|
925 | return False | |
923 |
|
926 | |||
924 |
|
927 | |||
925 | @check("clang-6.0", "clang 6.0 with version suffix (libfuzzer included)") |
|
928 | @check("clang-6.0", "clang 6.0 with version suffix (libfuzzer included)") | |
926 | def has_clang60(): |
|
929 | def has_clang60(): | |
927 | return matchoutput('clang-6.0 --version', br'clang version 6\.') |
|
930 | return matchoutput('clang-6.0 --version', br'clang version 6\.') | |
928 |
|
931 | |||
929 |
|
932 | |||
930 | @check("xdiff", "xdiff algorithm") |
|
933 | @check("xdiff", "xdiff algorithm") | |
931 | def has_xdiff(): |
|
934 | def has_xdiff(): | |
932 | try: |
|
935 | try: | |
933 | from mercurial import policy |
|
936 | from mercurial import policy | |
934 |
|
937 | |||
935 | bdiff = policy.importmod('bdiff') |
|
938 | bdiff = policy.importmod('bdiff') | |
936 | return bdiff.xdiffblocks(b'', b'') == [(0, 0, 0, 0)] |
|
939 | return bdiff.xdiffblocks(b'', b'') == [(0, 0, 0, 0)] | |
937 | except (ImportError, AttributeError): |
|
940 | except (ImportError, AttributeError): | |
938 | return False |
|
941 | return False | |
939 |
|
942 | |||
940 |
|
943 | |||
941 | @check('extraextensions', 'whether tests are running with extra extensions') |
|
944 | @check('extraextensions', 'whether tests are running with extra extensions') | |
942 | def has_extraextensions(): |
|
945 | def has_extraextensions(): | |
943 | return 'HGTESTEXTRAEXTENSIONS' in os.environ |
|
946 | return 'HGTESTEXTRAEXTENSIONS' in os.environ | |
944 |
|
947 | |||
945 |
|
948 | |||
946 | def getrepofeatures(): |
|
949 | def getrepofeatures(): | |
947 | """Obtain set of repository features in use. |
|
950 | """Obtain set of repository features in use. | |
948 |
|
951 | |||
949 | HGREPOFEATURES can be used to define or remove features. It contains |
|
952 | HGREPOFEATURES can be used to define or remove features. It contains | |
950 | a space-delimited list of feature strings. Strings beginning with ``-`` |
|
953 | a space-delimited list of feature strings. Strings beginning with ``-`` | |
951 | mean to remove. |
|
954 | mean to remove. | |
952 | """ |
|
955 | """ | |
953 | # Default list provided by core. |
|
956 | # Default list provided by core. | |
954 | features = { |
|
957 | features = { | |
955 | 'bundlerepo', |
|
958 | 'bundlerepo', | |
956 | 'revlogstore', |
|
959 | 'revlogstore', | |
957 | 'fncache', |
|
960 | 'fncache', | |
958 | } |
|
961 | } | |
959 |
|
962 | |||
960 | # Features that imply other features. |
|
963 | # Features that imply other features. | |
961 | implies = { |
|
964 | implies = { | |
962 | 'simplestore': ['-revlogstore', '-bundlerepo', '-fncache'], |
|
965 | 'simplestore': ['-revlogstore', '-bundlerepo', '-fncache'], | |
963 | } |
|
966 | } | |
964 |
|
967 | |||
965 | for override in os.environ.get('HGREPOFEATURES', '').split(' '): |
|
968 | for override in os.environ.get('HGREPOFEATURES', '').split(' '): | |
966 | if not override: |
|
969 | if not override: | |
967 | continue |
|
970 | continue | |
968 |
|
971 | |||
969 | if override.startswith('-'): |
|
972 | if override.startswith('-'): | |
970 | if override[1:] in features: |
|
973 | if override[1:] in features: | |
971 | features.remove(override[1:]) |
|
974 | features.remove(override[1:]) | |
972 | else: |
|
975 | else: | |
973 | features.add(override) |
|
976 | features.add(override) | |
974 |
|
977 | |||
975 | for imply in implies.get(override, []): |
|
978 | for imply in implies.get(override, []): | |
976 | if imply.startswith('-'): |
|
979 | if imply.startswith('-'): | |
977 | if imply[1:] in features: |
|
980 | if imply[1:] in features: | |
978 | features.remove(imply[1:]) |
|
981 | features.remove(imply[1:]) | |
979 | else: |
|
982 | else: | |
980 | features.add(imply) |
|
983 | features.add(imply) | |
981 |
|
984 | |||
982 | return features |
|
985 | return features | |
983 |
|
986 | |||
984 |
|
987 | |||
985 | @check('reporevlogstore', 'repository using the default revlog store') |
|
988 | @check('reporevlogstore', 'repository using the default revlog store') | |
986 | def has_reporevlogstore(): |
|
989 | def has_reporevlogstore(): | |
987 | return 'revlogstore' in getrepofeatures() |
|
990 | return 'revlogstore' in getrepofeatures() | |
988 |
|
991 | |||
989 |
|
992 | |||
990 | @check('reposimplestore', 'repository using simple storage extension') |
|
993 | @check('reposimplestore', 'repository using simple storage extension') | |
991 | def has_reposimplestore(): |
|
994 | def has_reposimplestore(): | |
992 | return 'simplestore' in getrepofeatures() |
|
995 | return 'simplestore' in getrepofeatures() | |
993 |
|
996 | |||
994 |
|
997 | |||
995 | @check('repobundlerepo', 'whether we can open bundle files as repos') |
|
998 | @check('repobundlerepo', 'whether we can open bundle files as repos') | |
996 | def has_repobundlerepo(): |
|
999 | def has_repobundlerepo(): | |
997 | return 'bundlerepo' in getrepofeatures() |
|
1000 | return 'bundlerepo' in getrepofeatures() | |
998 |
|
1001 | |||
999 |
|
1002 | |||
1000 | @check('repofncache', 'repository has an fncache') |
|
1003 | @check('repofncache', 'repository has an fncache') | |
1001 | def has_repofncache(): |
|
1004 | def has_repofncache(): | |
1002 | return 'fncache' in getrepofeatures() |
|
1005 | return 'fncache' in getrepofeatures() | |
1003 |
|
1006 | |||
1004 |
|
1007 | |||
1005 | @check('sqlite', 'sqlite3 module is available') |
|
1008 | @check('sqlite', 'sqlite3 module is available') | |
1006 | def has_sqlite(): |
|
1009 | def has_sqlite(): | |
1007 | try: |
|
1010 | try: | |
1008 | import sqlite3 |
|
1011 | import sqlite3 | |
1009 |
|
1012 | |||
1010 | version = sqlite3.sqlite_version_info |
|
1013 | version = sqlite3.sqlite_version_info | |
1011 | except ImportError: |
|
1014 | except ImportError: | |
1012 | return False |
|
1015 | return False | |
1013 |
|
1016 | |||
1014 | if version < (3, 8, 3): |
|
1017 | if version < (3, 8, 3): | |
1015 | # WITH clause not supported |
|
1018 | # WITH clause not supported | |
1016 | return False |
|
1019 | return False | |
1017 |
|
1020 | |||
1018 | return matchoutput('sqlite3 -version', br'^3\.\d+') |
|
1021 | return matchoutput('sqlite3 -version', br'^3\.\d+') | |
1019 |
|
1022 | |||
1020 |
|
1023 | |||
1021 | @check('vcr', 'vcr http mocking library') |
|
1024 | @check('vcr', 'vcr http mocking library') | |
1022 | def has_vcr(): |
|
1025 | def has_vcr(): | |
1023 | try: |
|
1026 | try: | |
1024 | import vcr |
|
1027 | import vcr | |
1025 |
|
1028 | |||
1026 | vcr.VCR |
|
1029 | vcr.VCR | |
1027 | return True |
|
1030 | return True | |
1028 | except (ImportError, AttributeError): |
|
1031 | except (ImportError, AttributeError): | |
1029 | pass |
|
1032 | pass | |
1030 | return False |
|
1033 | return False | |
1031 |
|
1034 | |||
1032 |
|
1035 | |||
1033 | @check('emacs', 'GNU Emacs') |
|
1036 | @check('emacs', 'GNU Emacs') | |
1034 | def has_emacs(): |
|
1037 | def has_emacs(): | |
1035 | # Our emacs lisp uses `with-eval-after-load` which is new in emacs |
|
1038 | # Our emacs lisp uses `with-eval-after-load` which is new in emacs | |
1036 | # 24.4, so we allow emacs 24.4, 24.5, and 25+ (24.5 was the last |
|
1039 | # 24.4, so we allow emacs 24.4, 24.5, and 25+ (24.5 was the last | |
1037 | # 24 release) |
|
1040 | # 24 release) | |
1038 | return matchoutput('emacs --version', b'GNU Emacs 2(4.4|4.5|5|6|7|8|9)') |
|
1041 | return matchoutput('emacs --version', b'GNU Emacs 2(4.4|4.5|5|6|7|8|9)') | |
1039 |
|
1042 | |||
1040 |
|
1043 | |||
1041 | @check('black', 'the black formatter for python') |
|
1044 | @check('black', 'the black formatter for python') | |
1042 | def has_black(): |
|
1045 | def has_black(): | |
1043 | blackcmd = 'black --version' |
|
1046 | blackcmd = 'black --version' | |
1044 | version_regex = b'black, version ([0-9a-b.]+)' |
|
1047 | version_regex = b'black, version ([0-9a-b.]+)' | |
1045 | version = matchoutput(blackcmd, version_regex) |
|
1048 | version = matchoutput(blackcmd, version_regex) | |
1046 | sv = distutils.version.StrictVersion |
|
1049 | sv = distutils.version.StrictVersion | |
1047 | return version and sv(_bytes2sys(version.group(1))) >= sv('19.10b0') |
|
1050 | return version and sv(_bytes2sys(version.group(1))) >= sv('19.10b0') | |
1048 |
|
1051 | |||
1049 |
|
1052 | |||
1050 | @check('pytype', 'the pytype type checker') |
|
1053 | @check('pytype', 'the pytype type checker') | |
1051 | def has_pytype(): |
|
1054 | def has_pytype(): | |
1052 | pytypecmd = 'pytype --version' |
|
1055 | pytypecmd = 'pytype --version' | |
1053 | version = matchoutput(pytypecmd, b'[0-9a-b.]+') |
|
1056 | version = matchoutput(pytypecmd, b'[0-9a-b.]+') | |
1054 | sv = distutils.version.StrictVersion |
|
1057 | sv = distutils.version.StrictVersion | |
1055 | return version and sv(_bytes2sys(version.group(0))) >= sv('2019.10.17') |
|
1058 | return version and sv(_bytes2sys(version.group(0))) >= sv('2019.10.17') | |
1056 |
|
1059 | |||
1057 |
|
1060 | |||
1058 | @check("rustfmt", "rustfmt tool") |
|
1061 | @check("rustfmt", "rustfmt tool") | |
1059 | def has_rustfmt(): |
|
1062 | def has_rustfmt(): | |
1060 | # We use Nightly's rustfmt due to current unstable config options. |
|
1063 | # We use Nightly's rustfmt due to current unstable config options. | |
1061 | return matchoutput( |
|
1064 | return matchoutput( | |
1062 | '`rustup which --toolchain nightly rustfmt` --version', b'rustfmt' |
|
1065 | '`rustup which --toolchain nightly rustfmt` --version', b'rustfmt' | |
1063 | ) |
|
1066 | ) | |
1064 |
|
1067 | |||
1065 |
|
1068 | |||
1066 | @check("lzma", "python lzma module") |
|
1069 | @check("lzma", "python lzma module") | |
1067 | def has_lzma(): |
|
1070 | def has_lzma(): | |
1068 | try: |
|
1071 | try: | |
1069 | import _lzma |
|
1072 | import _lzma | |
1070 |
|
1073 | |||
1071 | _lzma.FORMAT_XZ |
|
1074 | _lzma.FORMAT_XZ | |
1072 | return True |
|
1075 | return True | |
1073 | except ImportError: |
|
1076 | except ImportError: | |
1074 | return False |
|
1077 | return False |
@@ -1,255 +1,255 | |||||
1 | hg debuginstall |
|
1 | hg debuginstall | |
2 | $ hg debuginstall |
|
2 | $ hg debuginstall | |
3 | checking encoding (ascii)... |
|
3 | checking encoding (ascii)... | |
4 | checking Python executable (*) (glob) |
|
4 | checking Python executable (*) (glob) | |
5 | checking Python implementation (*) (glob) |
|
5 | checking Python implementation (*) (glob) | |
6 | checking Python version (2.*) (glob) (no-py3 !) |
|
6 | checking Python version (2.*) (glob) (no-py3 !) | |
7 | checking Python version (3.*) (glob) (py3 !) |
|
7 | checking Python version (3.*) (glob) (py3 !) | |
8 | checking Python lib (.*[Ll]ib.*)... (re) |
|
8 | checking Python lib (.*[Ll]ib.*)... (re) | |
9 | checking Python security support (*) (glob) |
|
9 | checking Python security support (*) (glob) | |
10 | TLS 1.2 not supported by Python install; network connections lack modern security (?) |
|
10 | TLS 1.2 not supported by Python install; network connections lack modern security (?) | |
11 | SNI not supported by Python install; may have connectivity issues with some servers (?) |
|
11 | SNI not supported by Python install; may have connectivity issues with some servers (?) | |
12 | checking Rust extensions \((installed|missing)\) (re) |
|
12 | checking Rust extensions \((installed|missing)\) (re) | |
13 | checking Mercurial version (*) (glob) |
|
13 | checking Mercurial version (*) (glob) | |
14 | checking Mercurial custom build (*) (glob) |
|
14 | checking Mercurial custom build (*) (glob) | |
15 | checking module policy (*) (glob) |
|
15 | checking module policy (*) (glob) | |
16 | checking installed modules (*mercurial)... (glob) |
|
16 | checking installed modules (*mercurial)... (glob) | |
17 | checking registered compression engines (*zlib*) (glob) |
|
17 | checking registered compression engines (*zlib*) (glob) | |
18 | checking available compression engines (*zlib*) (glob) |
|
18 | checking available compression engines (*zlib*) (glob) | |
19 | checking available compression engines for wire protocol (*zlib*) (glob) |
|
19 | checking available compression engines for wire protocol (*zlib*) (glob) | |
20 | checking "re2" regexp engine \((available|missing)\) (re) |
|
20 | checking "re2" regexp engine \((available|missing)\) (re) | |
21 | checking templates (*mercurial?templates)... (glob) |
|
21 | checking templates (*mercurial?templates)... (glob) | |
22 | checking default template (*mercurial?templates?map-cmdline.default) (glob) |
|
22 | checking default template (*mercurial?templates?map-cmdline.default) (glob) | |
23 | checking commit editor... (*) (glob) |
|
23 | checking commit editor... (*) (glob) | |
24 | checking username (test) |
|
24 | checking username (test) | |
25 | no problems detected |
|
25 | no problems detected | |
26 |
|
26 | |||
27 | hg debuginstall JSON |
|
27 | hg debuginstall JSON | |
28 | $ hg debuginstall -Tjson | sed 's|\\\\|\\|g' |
|
28 | $ hg debuginstall -Tjson | sed 's|\\\\|\\|g' | |
29 | [ |
|
29 | [ | |
30 | { |
|
30 | { | |
31 | "compengines": ["bz2", "bz2truncated", "none", "zlib"*], (glob) |
|
31 | "compengines": ["bz2", "bz2truncated", "none", "zlib"*], (glob) | |
32 | "compenginesavail": ["bz2", "bz2truncated", "none", "zlib"*], (glob) |
|
32 | "compenginesavail": ["bz2", "bz2truncated", "none", "zlib"*], (glob) | |
33 | "compenginesserver": [*"zlib"*], (glob) |
|
33 | "compenginesserver": [*"zlib"*], (glob) | |
34 | "defaulttemplate": "*mercurial?templates?map-cmdline.default", (glob) |
|
34 | "defaulttemplate": "*mercurial?templates?map-cmdline.default", (glob) | |
35 | "defaulttemplateerror": null, |
|
35 | "defaulttemplateerror": null, | |
36 | "defaulttemplatenotfound": "default", |
|
36 | "defaulttemplatenotfound": "default", | |
37 | "editor": "*", (glob) |
|
37 | "editor": "*", (glob) | |
38 | "editornotfound": false, |
|
38 | "editornotfound": false, | |
39 | "encoding": "ascii", |
|
39 | "encoding": "ascii", | |
40 | "encodingerror": null, |
|
40 | "encodingerror": null, | |
41 | "extensionserror": null, (no-pure !) |
|
41 | "extensionserror": null, (no-pure !) | |
42 | "hgmodulepolicy": "*", (glob) |
|
42 | "hgmodulepolicy": "*", (glob) | |
43 | "hgmodules": "*mercurial", (glob) |
|
43 | "hgmodules": "*mercurial", (glob) | |
44 | "hgver": "*", (glob) |
|
44 | "hgver": "*", (glob) | |
45 | "hgverextra": "*", (glob) |
|
45 | "hgverextra": "*", (glob) | |
46 | "problems": 0, |
|
46 | "problems": 0, | |
47 | "pythonexe": "*", (glob) |
|
47 | "pythonexe": "*", (glob) | |
48 | "pythonimplementation": "*", (glob) |
|
48 | "pythonimplementation": "*", (glob) | |
49 | "pythonlib": "*", (glob) |
|
49 | "pythonlib": "*", (glob) | |
50 | "pythonsecurity": [*], (glob) |
|
50 | "pythonsecurity": [*], (glob) | |
51 | "pythonver": "*.*.*", (glob) |
|
51 | "pythonver": "*.*.*", (glob) | |
52 | "re2": (true|false), (re) |
|
52 | "re2": (true|false), (re) | |
53 | "templatedirs": "*mercurial?templates", (glob) |
|
53 | "templatedirs": "*mercurial?templates", (glob) | |
54 | "username": "test", |
|
54 | "username": "test", | |
55 | "usernameerror": null, |
|
55 | "usernameerror": null, | |
56 | "vinotfound": false |
|
56 | "vinotfound": false | |
57 | } |
|
57 | } | |
58 | ] |
|
58 | ] | |
59 |
|
59 | |||
60 | hg debuginstall with no username |
|
60 | hg debuginstall with no username | |
61 | $ HGUSER= hg debuginstall |
|
61 | $ HGUSER= hg debuginstall | |
62 | checking encoding (ascii)... |
|
62 | checking encoding (ascii)... | |
63 | checking Python executable (*) (glob) |
|
63 | checking Python executable (*) (glob) | |
64 | checking Python implementation (*) (glob) |
|
64 | checking Python implementation (*) (glob) | |
65 | checking Python version (2.*) (glob) (no-py3 !) |
|
65 | checking Python version (2.*) (glob) (no-py3 !) | |
66 | checking Python version (3.*) (glob) (py3 !) |
|
66 | checking Python version (3.*) (glob) (py3 !) | |
67 | checking Python lib (.*[Ll]ib.*)... (re) |
|
67 | checking Python lib (.*[Ll]ib.*)... (re) | |
68 | checking Python security support (*) (glob) |
|
68 | checking Python security support (*) (glob) | |
69 | TLS 1.2 not supported by Python install; network connections lack modern security (?) |
|
69 | TLS 1.2 not supported by Python install; network connections lack modern security (?) | |
70 | SNI not supported by Python install; may have connectivity issues with some servers (?) |
|
70 | SNI not supported by Python install; may have connectivity issues with some servers (?) | |
71 | checking Rust extensions \((installed|missing)\) (re) |
|
71 | checking Rust extensions \((installed|missing)\) (re) | |
72 | checking Mercurial version (*) (glob) |
|
72 | checking Mercurial version (*) (glob) | |
73 | checking Mercurial custom build (*) (glob) |
|
73 | checking Mercurial custom build (*) (glob) | |
74 | checking module policy (*) (glob) |
|
74 | checking module policy (*) (glob) | |
75 | checking installed modules (*mercurial)... (glob) |
|
75 | checking installed modules (*mercurial)... (glob) | |
76 | checking registered compression engines (*zlib*) (glob) |
|
76 | checking registered compression engines (*zlib*) (glob) | |
77 | checking available compression engines (*zlib*) (glob) |
|
77 | checking available compression engines (*zlib*) (glob) | |
78 | checking available compression engines for wire protocol (*zlib*) (glob) |
|
78 | checking available compression engines for wire protocol (*zlib*) (glob) | |
79 | checking "re2" regexp engine \((available|missing)\) (re) |
|
79 | checking "re2" regexp engine \((available|missing)\) (re) | |
80 | checking templates (*mercurial?templates)... (glob) |
|
80 | checking templates (*mercurial?templates)... (glob) | |
81 | checking default template (*mercurial?templates?map-cmdline.default) (glob) |
|
81 | checking default template (*mercurial?templates?map-cmdline.default) (glob) | |
82 | checking commit editor... (*) (glob) |
|
82 | checking commit editor... (*) (glob) | |
83 | checking username... |
|
83 | checking username... | |
84 | no username supplied |
|
84 | no username supplied | |
85 | (specify a username in your configuration file) |
|
85 | (specify a username in your configuration file) | |
86 | 1 problems detected, please check your install! |
|
86 | 1 problems detected, please check your install! | |
87 | [1] |
|
87 | [1] | |
88 |
|
88 | |||
89 | hg debuginstall with invalid encoding |
|
89 | hg debuginstall with invalid encoding | |
90 | $ HGENCODING=invalidenc hg debuginstall | grep encoding |
|
90 | $ HGENCODING=invalidenc hg debuginstall | grep encoding | |
91 | checking encoding (invalidenc)... |
|
91 | checking encoding (invalidenc)... | |
92 | unknown encoding: invalidenc |
|
92 | unknown encoding: invalidenc | |
93 |
|
93 | |||
94 | exception message in JSON |
|
94 | exception message in JSON | |
95 |
|
95 | |||
96 | $ HGENCODING=invalidenc HGUSER= hg debuginstall -Tjson | grep error |
|
96 | $ HGENCODING=invalidenc HGUSER= hg debuginstall -Tjson | grep error | |
97 | "defaulttemplateerror": null, |
|
97 | "defaulttemplateerror": null, | |
98 | "encodingerror": "unknown encoding: invalidenc", |
|
98 | "encodingerror": "unknown encoding: invalidenc", | |
99 | "extensionserror": null, (no-pure !) |
|
99 | "extensionserror": null, (no-pure !) | |
100 | "usernameerror": "no username supplied", |
|
100 | "usernameerror": "no username supplied", | |
101 |
|
101 | |||
102 | path variables are expanded (~ is the same as $TESTTMP) |
|
102 | path variables are expanded (~ is the same as $TESTTMP) | |
103 | $ mkdir tools |
|
103 | $ mkdir tools | |
104 | $ touch tools/testeditor.exe |
|
104 | $ touch tools/testeditor.exe | |
105 | #if execbit |
|
105 | #if execbit | |
106 | $ chmod 755 tools/testeditor.exe |
|
106 | $ chmod 755 tools/testeditor.exe | |
107 | #endif |
|
107 | #endif | |
108 | $ HGEDITOR="~/tools/testeditor.exe" hg debuginstall |
|
108 | $ HGEDITOR="~/tools/testeditor.exe" hg debuginstall | |
109 | checking encoding (ascii)... |
|
109 | checking encoding (ascii)... | |
110 | checking Python executable (*) (glob) |
|
110 | checking Python executable (*) (glob) | |
111 | checking Python implementation (*) (glob) |
|
111 | checking Python implementation (*) (glob) | |
112 | checking Python version (2.*) (glob) (no-py3 !) |
|
112 | checking Python version (2.*) (glob) (no-py3 !) | |
113 | checking Python version (3.*) (glob) (py3 !) |
|
113 | checking Python version (3.*) (glob) (py3 !) | |
114 | checking Python lib (.*[Ll]ib.*)... (re) |
|
114 | checking Python lib (.*[Ll]ib.*)... (re) | |
115 | checking Python security support (*) (glob) |
|
115 | checking Python security support (*) (glob) | |
116 | TLS 1.2 not supported by Python install; network connections lack modern security (?) |
|
116 | TLS 1.2 not supported by Python install; network connections lack modern security (?) | |
117 | SNI not supported by Python install; may have connectivity issues with some servers (?) |
|
117 | SNI not supported by Python install; may have connectivity issues with some servers (?) | |
118 | checking Rust extensions \((installed|missing)\) (re) |
|
118 | checking Rust extensions \((installed|missing)\) (re) | |
119 | checking Mercurial version (*) (glob) |
|
119 | checking Mercurial version (*) (glob) | |
120 | checking Mercurial custom build (*) (glob) |
|
120 | checking Mercurial custom build (*) (glob) | |
121 | checking module policy (*) (glob) |
|
121 | checking module policy (*) (glob) | |
122 | checking installed modules (*mercurial)... (glob) |
|
122 | checking installed modules (*mercurial)... (glob) | |
123 | checking registered compression engines (*zlib*) (glob) |
|
123 | checking registered compression engines (*zlib*) (glob) | |
124 | checking available compression engines (*zlib*) (glob) |
|
124 | checking available compression engines (*zlib*) (glob) | |
125 | checking available compression engines for wire protocol (*zlib*) (glob) |
|
125 | checking available compression engines for wire protocol (*zlib*) (glob) | |
126 | checking "re2" regexp engine \((available|missing)\) (re) |
|
126 | checking "re2" regexp engine \((available|missing)\) (re) | |
127 | checking templates (*mercurial?templates)... (glob) |
|
127 | checking templates (*mercurial?templates)... (glob) | |
128 | checking default template (*mercurial?templates?map-cmdline.default) (glob) |
|
128 | checking default template (*mercurial?templates?map-cmdline.default) (glob) | |
129 | checking commit editor... ($TESTTMP/tools/testeditor.exe) |
|
129 | checking commit editor... ($TESTTMP/tools/testeditor.exe) | |
130 | checking username (test) |
|
130 | checking username (test) | |
131 | no problems detected |
|
131 | no problems detected | |
132 |
|
132 | |||
133 | print out the binary post-shlexsplit in the error message when commit editor is |
|
133 | print out the binary post-shlexsplit in the error message when commit editor is | |
134 | not found (this is intentionally using backslashes to mimic a windows usecase). |
|
134 | not found (this is intentionally using backslashes to mimic a windows usecase). | |
135 | $ HGEDITOR="c:\foo\bar\baz.exe -y -z" hg debuginstall |
|
135 | $ HGEDITOR="c:\foo\bar\baz.exe -y -z" hg debuginstall | |
136 | checking encoding (ascii)... |
|
136 | checking encoding (ascii)... | |
137 | checking Python executable (*) (glob) |
|
137 | checking Python executable (*) (glob) | |
138 | checking Python implementation (*) (glob) |
|
138 | checking Python implementation (*) (glob) | |
139 | checking Python version (2.*) (glob) (no-py3 !) |
|
139 | checking Python version (2.*) (glob) (no-py3 !) | |
140 | checking Python version (3.*) (glob) (py3 !) |
|
140 | checking Python version (3.*) (glob) (py3 !) | |
141 | checking Python lib (.*[Ll]ib.*)... (re) |
|
141 | checking Python lib (.*[Ll]ib.*)... (re) | |
142 | checking Python security support (*) (glob) |
|
142 | checking Python security support (*) (glob) | |
143 | TLS 1.2 not supported by Python install; network connections lack modern security (?) |
|
143 | TLS 1.2 not supported by Python install; network connections lack modern security (?) | |
144 | SNI not supported by Python install; may have connectivity issues with some servers (?) |
|
144 | SNI not supported by Python install; may have connectivity issues with some servers (?) | |
145 | checking Rust extensions \((installed|missing)\) (re) |
|
145 | checking Rust extensions \((installed|missing)\) (re) | |
146 | checking Mercurial version (*) (glob) |
|
146 | checking Mercurial version (*) (glob) | |
147 | checking Mercurial custom build (*) (glob) |
|
147 | checking Mercurial custom build (*) (glob) | |
148 | checking module policy (*) (glob) |
|
148 | checking module policy (*) (glob) | |
149 | checking installed modules (*mercurial)... (glob) |
|
149 | checking installed modules (*mercurial)... (glob) | |
150 | checking registered compression engines (*zlib*) (glob) |
|
150 | checking registered compression engines (*zlib*) (glob) | |
151 | checking available compression engines (*zlib*) (glob) |
|
151 | checking available compression engines (*zlib*) (glob) | |
152 | checking available compression engines for wire protocol (*zlib*) (glob) |
|
152 | checking available compression engines for wire protocol (*zlib*) (glob) | |
153 | checking "re2" regexp engine \((available|missing)\) (re) |
|
153 | checking "re2" regexp engine \((available|missing)\) (re) | |
154 | checking templates (*mercurial?templates)... (glob) |
|
154 | checking templates (*mercurial?templates)... (glob) | |
155 | checking default template (*mercurial?templates?map-cmdline.default) (glob) |
|
155 | checking default template (*mercurial?templates?map-cmdline.default) (glob) | |
156 | checking commit editor... (c:\foo\bar\baz.exe) (windows !) |
|
156 | checking commit editor... (c:\foo\bar\baz.exe) (windows !) | |
157 | Can't find editor 'c:\foo\bar\baz.exe' in PATH (windows !) |
|
157 | Can't find editor 'c:\foo\bar\baz.exe' in PATH (windows !) | |
158 | checking commit editor... (c:foobarbaz.exe) (no-windows !) |
|
158 | checking commit editor... (c:foobarbaz.exe) (no-windows !) | |
159 | Can't find editor 'c:foobarbaz.exe' in PATH (no-windows !) |
|
159 | Can't find editor 'c:foobarbaz.exe' in PATH (no-windows !) | |
160 | (specify a commit editor in your configuration file) |
|
160 | (specify a commit editor in your configuration file) | |
161 | checking username (test) |
|
161 | checking username (test) | |
162 | 1 problems detected, please check your install! |
|
162 | 1 problems detected, please check your install! | |
163 | [1] |
|
163 | [1] | |
164 |
|
164 | |||
165 | debuginstall extension support |
|
165 | debuginstall extension support | |
166 | $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false | grep atchman |
|
166 | $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false | grep atchman | |
167 | fsmonitor checking for watchman binary... (false) |
|
167 | fsmonitor checking for watchman binary... (false) | |
168 | watchman binary missing or broken: warning: Watchman unavailable: watchman exited with code 1 |
|
168 | watchman binary missing or broken: warning: Watchman unavailable: watchman exited with code 1 | |
169 | Verify the json works too: |
|
169 | Verify the json works too: | |
170 | $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false -Tjson | grep atchman |
|
170 | $ hg debuginstall --config extensions.fsmonitor= --config fsmonitor.watchman_exe=false -Tjson | grep atchman | |
171 | "fsmonitor-watchman": "false", |
|
171 | "fsmonitor-watchman": "false", | |
172 | "fsmonitor-watchman-error": "warning: Watchman unavailable: watchman exited with code 1", |
|
172 | "fsmonitor-watchman-error": "warning: Watchman unavailable: watchman exited with code 1", | |
173 |
|
173 | |||
174 | Verify that Mercurial is installable with pip. Note that this MUST be |
|
174 | Verify that Mercurial is installable with pip. Note that this MUST be | |
175 | the last test in this file, because we do some nasty things to the |
|
175 | the last test in this file, because we do some nasty things to the | |
176 | shell environment in order to make the virtualenv work reliably. |
|
176 | shell environment in order to make the virtualenv work reliably. | |
177 |
|
177 | |||
178 | On Python 3, we use the venv module, which is part of the standard library. |
|
178 | On Python 3, we use the venv module, which is part of the standard library. | |
179 | But some Linux distros strip out this module's functionality involving pip, |
|
179 | But some Linux distros strip out this module's functionality involving pip, | |
180 | so we have to look for the ensurepip module, which these distros strip out |
|
180 | so we have to look for the ensurepip module, which these distros strip out | |
181 | completely. |
|
181 | completely. | |
182 | On Python 2, we use the 3rd party virtualenv module, if available. |
|
182 | On Python 2, we use the 3rd party virtualenv module, if available. | |
183 |
|
183 | |||
184 | $ cd $TESTTMP |
|
184 | $ cd $TESTTMP | |
185 | $ unset PYTHONPATH |
|
185 | $ unset PYTHONPATH | |
186 |
|
186 | |||
187 | #if py3 ensurepip |
|
187 | #if py3 ensurepip | |
188 | $ "$PYTHON" -m venv installenv >> pip.log |
|
188 | $ "$PYTHON" -m venv installenv >> pip.log | |
189 |
|
189 | |||
190 | Note: we use this weird path to run pip and hg to avoid platform differences, |
|
190 | Note: we use this weird path to run pip and hg to avoid platform differences, | |
191 | since it's bin on most platforms but Scripts on Windows. |
|
191 | since it's bin on most platforms but Scripts on Windows. | |
192 | $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log |
|
192 | $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log | |
193 | Failed building wheel for mercurial (?) |
|
193 | Failed building wheel for mercurial (?) | |
194 | $ ./installenv/*/hg debuginstall || cat pip.log |
|
194 | $ ./installenv/*/hg debuginstall || cat pip.log | |
195 | checking encoding (ascii)... |
|
195 | checking encoding (ascii)... | |
196 | checking Python executable (*) (glob) |
|
196 | checking Python executable (*) (glob) | |
197 | checking Python implementation (*) (glob) |
|
197 | checking Python implementation (*) (glob) | |
198 | checking Python version (3.*) (glob) |
|
198 | checking Python version (3.*) (glob) | |
199 | checking Python lib (*)... (glob) |
|
199 | checking Python lib (*)... (glob) | |
200 | checking Python security support (*) (glob) |
|
200 | checking Python security support (*) (glob) | |
201 | checking Rust extensions \((installed|missing)\) (re) |
|
201 | checking Rust extensions \((installed|missing)\) (re) | |
202 | checking Mercurial version (*) (glob) |
|
202 | checking Mercurial version (*) (glob) | |
203 | checking Mercurial custom build (*) (glob) |
|
203 | checking Mercurial custom build (*) (glob) | |
204 | checking module policy (*) (glob) |
|
204 | checking module policy (*) (glob) | |
205 | checking installed modules (*/mercurial)... (glob) |
|
205 | checking installed modules (*/mercurial)... (glob) | |
206 | checking registered compression engines (*) (glob) |
|
206 | checking registered compression engines (*) (glob) | |
207 | checking available compression engines (*) (glob) |
|
207 | checking available compression engines (*) (glob) | |
208 | checking available compression engines for wire protocol (*) (glob) |
|
208 | checking available compression engines for wire protocol (*) (glob) | |
209 | checking "re2" regexp engine \((available|missing)\) (re) |
|
209 | checking "re2" regexp engine \((available|missing)\) (re) | |
210 | checking templates ($TESTTMP/installenv/*/site-packages/mercurial/templates)... (glob) |
|
210 | checking templates ($TESTTMP/installenv/*/site-packages/mercurial/templates)... (glob) | |
211 | checking default template ($TESTTMP/installenv/*/site-packages/mercurial/templates/map-cmdline.default) (glob) |
|
211 | checking default template ($TESTTMP/installenv/*/site-packages/mercurial/templates/map-cmdline.default) (glob) | |
212 | checking commit editor... (*) (glob) |
|
212 | checking commit editor... (*) (glob) | |
213 | checking username (test) |
|
213 | checking username (test) | |
214 | no problems detected |
|
214 | no problems detected | |
215 | #endif |
|
215 | #endif | |
216 |
|
216 | |||
217 |
#if |
|
217 | #if py2virtualenv | |
218 |
|
218 | |||
219 | Note: --no-site-packages is deprecated, but some places have an |
|
219 | Note: --no-site-packages is deprecated, but some places have an | |
220 | ancient virtualenv from their linux distro or similar and it's not yet |
|
220 | ancient virtualenv from their linux distro or similar and it's not yet | |
221 | the default for them. |
|
221 | the default for them. | |
222 |
|
222 | |||
223 | $ "$PYTHON" -m virtualenv --no-site-packages --never-download installenv >> pip.log |
|
223 | $ "$PYTHON" -m virtualenv --no-site-packages --never-download installenv >> pip.log | |
224 | DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. (?) |
|
224 | DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. (?) | |
225 | DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support (?) |
|
225 | DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support (?) | |
226 |
|
226 | |||
227 | Note: we use this weird path to run pip and hg to avoid platform differences, |
|
227 | Note: we use this weird path to run pip and hg to avoid platform differences, | |
228 | since it's bin on most platforms but Scripts on Windows. |
|
228 | since it's bin on most platforms but Scripts on Windows. | |
229 | $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log |
|
229 | $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log | |
230 | DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. (?) |
|
230 | DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. (?) | |
231 | DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support (?) |
|
231 | DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support (?) | |
232 | $ ./installenv/*/hg debuginstall || cat pip.log |
|
232 | $ ./installenv/*/hg debuginstall || cat pip.log | |
233 | checking encoding (ascii)... |
|
233 | checking encoding (ascii)... | |
234 | checking Python executable (*) (glob) |
|
234 | checking Python executable (*) (glob) | |
235 | checking Python implementation (*) (glob) |
|
235 | checking Python implementation (*) (glob) | |
236 | checking Python version (2.*) (glob) |
|
236 | checking Python version (2.*) (glob) | |
237 | checking Python lib (*)... (glob) |
|
237 | checking Python lib (*)... (glob) | |
238 | checking Python security support (*) (glob) |
|
238 | checking Python security support (*) (glob) | |
239 | TLS 1.2 not supported by Python install; network connections lack modern security (?) |
|
239 | TLS 1.2 not supported by Python install; network connections lack modern security (?) | |
240 | SNI not supported by Python install; may have connectivity issues with some servers (?) |
|
240 | SNI not supported by Python install; may have connectivity issues with some servers (?) | |
241 | checking Rust extensions \((installed|missing)\) (re) |
|
241 | checking Rust extensions \((installed|missing)\) (re) | |
242 | checking Mercurial version (*) (glob) |
|
242 | checking Mercurial version (*) (glob) | |
243 | checking Mercurial custom build (*) (glob) |
|
243 | checking Mercurial custom build (*) (glob) | |
244 | checking module policy (*) (glob) |
|
244 | checking module policy (*) (glob) | |
245 | checking installed modules (*/mercurial)... (glob) |
|
245 | checking installed modules (*/mercurial)... (glob) | |
246 | checking registered compression engines (*) (glob) |
|
246 | checking registered compression engines (*) (glob) | |
247 | checking available compression engines (*) (glob) |
|
247 | checking available compression engines (*) (glob) | |
248 | checking available compression engines for wire protocol (*) (glob) |
|
248 | checking available compression engines for wire protocol (*) (glob) | |
249 | checking "re2" regexp engine \((available|missing)\) (re) |
|
249 | checking "re2" regexp engine \((available|missing)\) (re) | |
250 | checking templates ($TESTTMP/installenv/*/site-packages/mercurial/templates)... (glob) |
|
250 | checking templates ($TESTTMP/installenv/*/site-packages/mercurial/templates)... (glob) | |
251 | checking default template ($TESTTMP/installenv/*/site-packages/mercurial/templates/map-cmdline.default) (glob) |
|
251 | checking default template ($TESTTMP/installenv/*/site-packages/mercurial/templates/map-cmdline.default) (glob) | |
252 | checking commit editor... (*) (glob) |
|
252 | checking commit editor... (*) (glob) | |
253 | checking username (test) |
|
253 | checking username (test) | |
254 | no problems detected |
|
254 | no problems detected | |
255 | #endif |
|
255 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now