tests/hghave.py
branchstable
changeset 21160 564f55b25122
parent 20644 779ceb84f4f7
child 21208 0e1cbd3d52f7
equal deleted inserted replaced
21028:a0f437e2f5a9 21160:564f55b25122
     1 import os, stat, socket
     1 import os, stat
     2 import re
     2 import re
     3 import sys
     3 import sys
     4 import tempfile
     4 import tempfile
     5 
     5 
     6 tempprefix = 'hg-hghave-'
     6 tempprefix = 'hg-hghave-'
    94         except OSError:
    94         except OSError:
    95             return False
    95             return False
    96     finally:
    96     finally:
    97         os.remove(path)
    97         os.remove(path)
    98 
    98 
    99 def has_inotify():
       
   100     try:
       
   101         import hgext.inotify.linux.watcher
       
   102     except ImportError:
       
   103         return False
       
   104     name = tempfile.mktemp(dir='.', prefix=tempprefix)
       
   105     sock = socket.socket(socket.AF_UNIX)
       
   106     try:
       
   107         sock.bind(name)
       
   108     except socket.error:
       
   109         return False
       
   110     sock.close()
       
   111     os.unlink(name)
       
   112     return True
       
   113 
       
   114 def has_fifo():
    99 def has_fifo():
   115     if getattr(os, "mkfifo", None) is None:
   100     if getattr(os, "mkfifo", None) is None:
   116         return False
   101         return False
   117     name = tempfile.mktemp(dir='.', prefix=tempprefix)
   102     name = tempfile.mktemp(dir='.', prefix=tempprefix)
   118     try:
   103     try:
   245     try:
   230     try:
   246         import pygments
   231         import pygments
   247         return True
   232         return True
   248     except ImportError:
   233     except ImportError:
   249         return False
   234         return False
       
   235 
       
   236 def has_python243():
       
   237     return sys.version_info >= (2, 4, 3)
   250 
   238 
   251 def has_outer_repo():
   239 def has_outer_repo():
   252     # failing for other reasons than 'no repo' imply that there is a repo
   240     # failing for other reasons than 'no repo' imply that there is a repo
   253     return not matchoutput('hg root 2>&1',
   241     return not matchoutput('hg root 2>&1',
   254                            r'abort: no repository found', True)
   242                            r'abort: no repository found', True)
   310     "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
   298     "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
   311     "git": (has_git, "git command line client"),
   299     "git": (has_git, "git command line client"),
   312     "gpg": (has_gpg, "gpg client"),
   300     "gpg": (has_gpg, "gpg client"),
   313     "hardlink": (has_hardlink, "hardlinks"),
   301     "hardlink": (has_hardlink, "hardlinks"),
   314     "icasefs": (has_icasefs, "case insensitive file system"),
   302     "icasefs": (has_icasefs, "case insensitive file system"),
   315     "inotify": (has_inotify, "inotify extension support"),
       
   316     "killdaemons": (has_killdaemons, 'killdaemons.py support'),
   303     "killdaemons": (has_killdaemons, 'killdaemons.py support'),
   317     "lsprof": (has_lsprof, "python lsprof module"),
   304     "lsprof": (has_lsprof, "python lsprof module"),
   318     "mtn": (has_mtn, "monotone client (>= 1.0)"),
   305     "mtn": (has_mtn, "monotone client (>= 1.0)"),
   319     "outer-repo": (has_outer_repo, "outer repo"),
   306     "outer-repo": (has_outer_repo, "outer repo"),
   320     "p4": (has_p4, "Perforce server and client"),
   307     "p4": (has_p4, "Perforce server and client"),
   321     "pyflakes": (has_pyflakes, "Pyflakes python linter"),
   308     "pyflakes": (has_pyflakes, "Pyflakes python linter"),
   322     "pygments": (has_pygments, "Pygments source highlighting library"),
   309     "pygments": (has_pygments, "Pygments source highlighting library"),
       
   310     "python243": (has_python243, "python >= 2.4.3"),
   323     "root": (has_root, "root permissions"),
   311     "root": (has_root, "root permissions"),
   324     "serve": (has_serve, "platform and python can manage 'hg serve -d'"),
   312     "serve": (has_serve, "platform and python can manage 'hg serve -d'"),
   325     "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
   313     "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"),
   326     "svn": (has_svn, "subversion client and admin tools"),
   314     "svn": (has_svn, "subversion client and admin tools"),
   327     "svn13": (has_svn13, "subversion client and admin tools >= 1.3"),
   315     "svn13": (has_svn13, "subversion client and admin tools >= 1.3"),