Mercurial > hg
diff tests/hghave @ 5072:7e2385a31933
hghave: detect executable permission availability.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 06 Aug 2007 10:26:04 +0200 |
parents | 4cf6f8dbd1b4 |
children | e86788af599a |
line wrap: on
line diff
--- a/tests/hghave Mon Aug 06 09:57:23 2007 +0200 +++ b/tests/hghave Mon Aug 06 10:26:04 2007 +0200 @@ -5,6 +5,7 @@ import optparse import os import sys +import tempfile def has_symlink(): return hasattr(os, "symlink") @@ -12,9 +13,20 @@ def has_fifo(): return hasattr(os, "mkfifo") +def has_executablebit(): + fd, path = tempfile.mkstemp() + os.close(fd) + try: + s = os.lstat(path).st_mode + os.chmod(path, s | 0100) + return (os.lstat(path).st_mode & 0100 != 0) + finally: + os.remove(path) + checks = { "symlink": (has_symlink, "symbolic links"), "fifo": (has_fifo, "named pipes"), + "execbit": (has_executablebit, "executable bit"), } def list_features():