##// END OF EJS Templates
hghave: matchoutput needs to use bytes for regexp...
timeless -
r29140:47eab0cb default
parent child Browse files
Show More
@@ -104,7 +104,7 b' def matchoutput(cmd, regexp, ignorestatu'
104
104
105 @check("baz", "GNU Arch baz client")
105 @check("baz", "GNU Arch baz client")
106 def has_baz():
106 def has_baz():
107 return matchoutput('baz --version 2>&1', r'baz Bazaar version')
107 return matchoutput('baz --version 2>&1', br'baz Bazaar version')
108
108
109 @check("bzr", "Canonical's Bazaar client")
109 @check("bzr", "Canonical's Bazaar client")
110 def has_bzr():
110 def has_bzr():
@@ -130,27 +130,27 b' def has_chg():'
130
130
131 @check("cvs", "cvs client/server")
131 @check("cvs", "cvs client/server")
132 def has_cvs():
132 def has_cvs():
133 re = r'Concurrent Versions System.*?server'
133 re = br'Concurrent Versions System.*?server'
134 return matchoutput('cvs --version 2>&1', re) and not has_msys()
134 return matchoutput('cvs --version 2>&1', re) and not has_msys()
135
135
136 @check("cvs112", "cvs client/server 1.12.* (not cvsnt)")
136 @check("cvs112", "cvs client/server 1.12.* (not cvsnt)")
137 def has_cvs112():
137 def has_cvs112():
138 re = r'Concurrent Versions System \(CVS\) 1.12.*?server'
138 re = br'Concurrent Versions System \(CVS\) 1.12.*?server'
139 return matchoutput('cvs --version 2>&1', re) and not has_msys()
139 return matchoutput('cvs --version 2>&1', re) and not has_msys()
140
140
141 @check("cvsnt", "cvsnt client/server")
141 @check("cvsnt", "cvsnt client/server")
142 def has_cvsnt():
142 def has_cvsnt():
143 re = r'Concurrent Versions System \(CVSNT\) (\d+).(\d+).*\(client/server\)'
143 re = br'Concurrent Versions System \(CVSNT\) (\d+).(\d+).*\(client/server\)'
144 return matchoutput('cvsnt --version 2>&1', re)
144 return matchoutput('cvsnt --version 2>&1', re)
145
145
146 @check("darcs", "darcs client")
146 @check("darcs", "darcs client")
147 def has_darcs():
147 def has_darcs():
148 return matchoutput('darcs --version', r'2\.[2-9]', True)
148 return matchoutput('darcs --version', br'2\.[2-9]', True)
149
149
150 @check("mtn", "monotone client (>= 1.0)")
150 @check("mtn", "monotone client (>= 1.0)")
151 def has_mtn():
151 def has_mtn():
152 return matchoutput('mtn --version', r'monotone', True) and not matchoutput(
152 return matchoutput('mtn --version', br'monotone', True) and not matchoutput(
153 'mtn --version', r'monotone 0\.', True)
153 'mtn --version', br'monotone 0\.', True)
154
154
155 @check("eol-in-paths", "end-of-lines in paths")
155 @check("eol-in-paths", "end-of-lines in paths")
156 def has_eol_in_paths():
156 def has_eol_in_paths():
@@ -236,7 +236,7 b' def has_lsprof():'
236 return False
236 return False
237
237
238 def gethgversion():
238 def gethgversion():
239 m = matchoutput('hg --version --quiet 2>&1', r'(\d+)\.(\d+)')
239 m = matchoutput('hg --version --quiet 2>&1', br'(\d+)\.(\d+)')
240 if not m:
240 if not m:
241 return (0, 0)
241 return (0, 0)
242 return (int(m.group(1)), int(m.group(2)))
242 return (int(m.group(1)), int(m.group(2)))
@@ -267,11 +267,11 b' def has_hg06():'
267
267
268 @check("gettext", "GNU Gettext (msgfmt)")
268 @check("gettext", "GNU Gettext (msgfmt)")
269 def has_gettext():
269 def has_gettext():
270 return matchoutput('msgfmt --version', 'GNU gettext-tools')
270 return matchoutput('msgfmt --version', br'GNU gettext-tools')
271
271
272 @check("git", "git command line client")
272 @check("git", "git command line client")
273 def has_git():
273 def has_git():
274 return matchoutput('git --version 2>&1', r'^git version')
274 return matchoutput('git --version 2>&1', br'^git version')
275
275
276 @check("docutils", "Docutils text processing library")
276 @check("docutils", "Docutils text processing library")
277 def has_docutils():
277 def has_docutils():
@@ -283,7 +283,7 b' def has_docutils():'
283 return False
283 return False
284
284
285 def getsvnversion():
285 def getsvnversion():
286 m = matchoutput('svn --version --quiet 2>&1', r'^(\d+)\.(\d+)')
286 m = matchoutput('svn --version --quiet 2>&1', br'^(\d+)\.(\d+)')
287 if not m:
287 if not m:
288 return (0, 0)
288 return (0, 0)
289 return (int(m.group(1)), int(m.group(2)))
289 return (int(m.group(1)), int(m.group(2)))
@@ -295,8 +295,8 b' def has_svn_range(v):'
295
295
296 @check("svn", "subversion client and admin tools")
296 @check("svn", "subversion client and admin tools")
297 def has_svn():
297 def has_svn():
298 return matchoutput('svn --version 2>&1', r'^svn, version') and \
298 return matchoutput('svn --version 2>&1', br'^svn, version') and \
299 matchoutput('svnadmin --version 2>&1', r'^svnadmin, version')
299 matchoutput('svnadmin --version 2>&1', br'^svnadmin, version')
300
300
301 @check("svn-bindings", "subversion python bindings")
301 @check("svn-bindings", "subversion python bindings")
302 def has_svn_bindings():
302 def has_svn_bindings():
@@ -311,8 +311,8 b' def has_svn_bindings():'
311
311
312 @check("p4", "Perforce server and client")
312 @check("p4", "Perforce server and client")
313 def has_p4():
313 def has_p4():
314 return (matchoutput('p4 -V', r'Rev\. P4/') and
314 return (matchoutput('p4 -V', br'Rev\. P4/') and
315 matchoutput('p4d -V', r'Rev\. P4D/'))
315 matchoutput('p4d -V', br'Rev\. P4D/'))
316
316
317 @check("symlink", "symbolic links")
317 @check("symlink", "symbolic links")
318 def has_symlink():
318 def has_symlink():
@@ -343,11 +343,11 b' def has_hardlink():'
343
343
344 @check("tla", "GNU Arch tla client")
344 @check("tla", "GNU Arch tla client")
345 def has_tla():
345 def has_tla():
346 return matchoutput('tla --version 2>&1', r'The GNU Arch Revision')
346 return matchoutput('tla --version 2>&1', br'The GNU Arch Revision')
347
347
348 @check("gpg", "gpg client")
348 @check("gpg", "gpg client")
349 def has_gpg():
349 def has_gpg():
350 return matchoutput('gpg --version 2>&1', r'GnuPG')
350 return matchoutput('gpg --version 2>&1', br'GnuPG')
351
351
352 @check("unix-permissions", "unix-style permissions")
352 @check("unix-permissions", "unix-style permissions")
353 def has_unix_permissions():
353 def has_unix_permissions():
@@ -377,7 +377,7 b' def has_root():'
377 @check("pyflakes", "Pyflakes python linter")
377 @check("pyflakes", "Pyflakes python linter")
378 def has_pyflakes():
378 def has_pyflakes():
379 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
379 return matchoutput("sh -c \"echo 'import re' 2>&1 | pyflakes\"",
380 r"<stdin>:1: 're' imported but unused",
380 br"<stdin>:1: 're' imported but unused",
381 True)
381 True)
382
382
383 @check("pygments", "Pygments source highlighting library")
383 @check("pygments", "Pygments source highlighting library")
@@ -393,7 +393,7 b' def has_pygments():'
393 def has_outer_repo():
393 def has_outer_repo():
394 # failing for other reasons than 'no repo' imply that there is a repo
394 # failing for other reasons than 'no repo' imply that there is a repo
395 return not matchoutput('hg root 2>&1',
395 return not matchoutput('hg root 2>&1',
396 r'abort: no repository found', True)
396 br'abort: no repository found', True)
397
397
398 @check("ssl", "ssl module available")
398 @check("ssl", "ssl module available")
399 def has_ssl():
399 def has_ssl():
@@ -440,7 +440,7 b' def has_tic():'
440 try:
440 try:
441 import curses
441 import curses
442 curses.COLOR_BLUE
442 curses.COLOR_BLUE
443 return matchoutput('test -x "`which tic`"', '')
443 return matchoutput('test -x "`which tic`"', br'')
444 except ImportError:
444 except ImportError:
445 return False
445 return False
446
446
@@ -459,19 +459,19 b' def has_osx():'
459 @check("osxpackaging", "OS X packaging tools")
459 @check("osxpackaging", "OS X packaging tools")
460 def has_osxpackaging():
460 def has_osxpackaging():
461 try:
461 try:
462 return (matchoutput('pkgbuild', 'Usage: pkgbuild ', ignorestatus=1)
462 return (matchoutput('pkgbuild', br'Usage: pkgbuild ', ignorestatus=1)
463 and matchoutput(
463 and matchoutput(
464 'productbuild', 'Usage: productbuild ',
464 'productbuild', br'Usage: productbuild ',
465 ignorestatus=1)
465 ignorestatus=1)
466 and matchoutput('lsbom', 'Usage: lsbom', ignorestatus=1)
466 and matchoutput('lsbom', br'Usage: lsbom', ignorestatus=1)
467 and matchoutput(
467 and matchoutput(
468 'xar --help', 'Usage: xar', ignorestatus=1))
468 'xar --help', br'Usage: xar', ignorestatus=1))
469 except ImportError:
469 except ImportError:
470 return False
470 return False
471
471
472 @check("docker", "docker support")
472 @check("docker", "docker support")
473 def has_docker():
473 def has_docker():
474 pat = r'A self-sufficient runtime for'
474 pat = br'A self-sufficient runtime for'
475 if matchoutput('docker --help', pat):
475 if matchoutput('docker --help', pat):
476 if 'linux' not in sys.platform:
476 if 'linux' not in sys.platform:
477 # TODO: in theory we should be able to test docker-based
477 # TODO: in theory we should be able to test docker-based
@@ -489,11 +489,11 b' def has_docker():'
489 @check("debhelper", "debian packaging tools")
489 @check("debhelper", "debian packaging tools")
490 def has_debhelper():
490 def has_debhelper():
491 dpkg = matchoutput('dpkg --version',
491 dpkg = matchoutput('dpkg --version',
492 "Debian `dpkg' package management program")
492 br"Debian `dpkg' package management program")
493 dh = matchoutput('dh --help',
493 dh = matchoutput('dh --help',
494 'dh is a part of debhelper.', ignorestatus=True)
494 br'dh is a part of debhelper.', ignorestatus=True)
495 dh_py2 = matchoutput('dh_python2 --help',
495 dh_py2 = matchoutput('dh_python2 --help',
496 'other supported Python versions')
496 br'other supported Python versions')
497 return dpkg and dh and dh_py2
497 return dpkg and dh and dh_py2
498
498
499 @check("absimport", "absolute_import in __future__")
499 @check("absimport", "absolute_import in __future__")
General Comments 0
You need to be logged in to leave comments. Login now