From a1258f9ef7e1c5152841fb1d714b38f3e6b2403d Mon Sep 17 00:00:00 2001 From: Bob Ippolito Date: Sat, 8 Oct 2005 14:57:02 +0000 Subject: compatibility interface --- Lib/xattr/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Lib/xattr/__init__.py b/Lib/xattr/__init__.py index 8e2f774..3ee1ad5 100644 --- a/Lib/xattr/__init__.py +++ b/Lib/xattr/__init__.py @@ -171,3 +171,19 @@ class xattr(object): def items(self): return list(self.iteritems()) + + +def listxattr(f, symlink=False): + return tuple(xattr(f).list(options=symlink and XATTR_NOFOLLOW or 0)) + +def getxattr(f, attr, symlink=False): + return xattr(f).get(options=symlink and XATTR_NOFOLLOW or 0) + +def setxattr(f, attr, value, options=0, symlink=False): + if symlink: + options |= XATTR_NOFOLLOW + return xattr(f).set(attr, value, options=options) + +def removexattr(f, attr, symlink=False): + options = symlink and XATTR_NOFOLLOW or 0 + return xattr(f).remove(attr, options=options) -- cgit v1.2.1