Mercurial > hg-stable
changeset 6063:b74a0c4bfb30
hghave: detect unix-style permissions
By "unix-style" I mean:
- user/group/other permissions
- umask determines original permissions
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sat, 09 Feb 2008 18:38:54 -0200 |
parents | 3c3b126e5619 |
children | c608f67a87c0 |
files | tests/hghave |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/hghave Sat Feb 09 18:38:54 2008 -0200 +++ b/tests/hghave Sat Feb 09 18:38:54 2008 -0200 @@ -85,6 +85,22 @@ def has_symlink(): return hasattr(os, "symlink") +def has_unix_permissions(): + d = tempfile.mkdtemp(prefix=tempprefix, dir=".") + try: + fname = os.path.join(d, 'foo') + for umask in (077, 007, 022): + os.umask(umask) + f = open(fname, 'w') + f.close() + mode = os.stat(fname).st_mode + os.unlink(fname) + if mode & 0777 != ~umask & 0666: + return False + return True + finally: + os.rmdir(d) + checks = { "cvs": (has_cvs, "cvs client"), "cvsps": (has_cvsps, "cvsps utility"), @@ -98,6 +114,7 @@ "svn": (has_svn, "subversion client and admin tools"), "svn-bindings": (has_svn_bindings, "subversion python bindings"), "symlink": (has_symlink, "symbolic links"), + "unix-permissions": (has_unix_permissions, "unix-style permissions"), } def list_features():