tests/hghave.py
changeset 1352 9dcd045229b4
parent 1351 49bef9bfeb50
equal deleted inserted replaced
1349:42b428c5fcd8 1352:9dcd045229b4
     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-'
    93             return s2 == s1
    93             return s2 == s1
    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 
       
    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 
    98 
   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)
   313     "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
   298     "gettext": (has_gettext, "GNU Gettext (msgfmt)"),
   314     "git": (has_git, "git command line client"),
   299     "git": (has_git, "git command line client"),
   315     "gpg": (has_gpg, "gpg client"),
   300     "gpg": (has_gpg, "gpg client"),
   316     "hardlink": (has_hardlink, "hardlinks"),
   301     "hardlink": (has_hardlink, "hardlinks"),
   317     "icasefs": (has_icasefs, "case insensitive file system"),
   302     "icasefs": (has_icasefs, "case insensitive file system"),
   318     "inotify": (has_inotify, "inotify extension support"),
       
   319     "killdaemons": (has_killdaemons, 'killdaemons.py support'),
   303     "killdaemons": (has_killdaemons, 'killdaemons.py support'),
   320     "lsprof": (has_lsprof, "python lsprof module"),
   304     "lsprof": (has_lsprof, "python lsprof module"),
   321     "mtn": (has_mtn, "monotone client (>= 1.0)"),
   305     "mtn": (has_mtn, "monotone client (>= 1.0)"),
   322     "outer-repo": (has_outer_repo, "outer repo"),
   306     "outer-repo": (has_outer_repo, "outer repo"),
   323     "p4": (has_p4, "Perforce server and client"),
   307     "p4": (has_p4, "Perforce server and client"),