diff options
author | Bob Ippolito <bob@redivi.com> | 2020-01-22 00:01:56 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-22 00:01:56 +0800 |
commit | 3e146d58daa9b17d4ff9d32a185d5d9bbaf45b16 (patch) | |
tree | 44e796b0cab3a67542111c6ac1ad1dfed2e12ca5 | |
parent | 81643bb53ec113113ed2c64f6fc2a80e450fc3c5 (diff) | |
parent | 6ea2434a407410e7d61a0e878b11cfa139ae53c1 (diff) | |
download | xattr-3e146d58daa9b17d4ff9d32a185d5d9bbaf45b16.tar.gz |
Merge pull request #88 from jmberg/pyxattr-py3
pyxattr_compat: make compatible with python3
-rw-r--r-- | xattr/pyxattr_compat.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/xattr/pyxattr_compat.py b/xattr/pyxattr_compat.py index 3d594de..c9242d3 100644 --- a/xattr/pyxattr_compat.py +++ b/xattr/pyxattr_compat.py @@ -20,10 +20,10 @@ __all__ = [ "removexattr", "remove", "listxattr", "list" ] -NS_SECURITY = "security" -NS_USER = "user" -NS_SYSTEM = "system" -NS_TRUSTED = "trusted" +NS_SECURITY = b"security" +NS_USER = b"user" +NS_SYSTEM = b"system" +NS_TRUSTED = b"trusted" _NO_NS = object() @@ -47,7 +47,7 @@ def _add_ns(item, ns): raise TypeError("namespace must not be None") if ns == _NO_NS: return item - return "%s.%s" % (ns, item) + return b'.'.join((ns, item)) def getxattr(item, attribute, nofollow=False): options = nofollow and XATTR_NOFOLLOW or 0 @@ -59,7 +59,7 @@ def get(item, name, nofollow=False, namespace=_NO_NS): def get_all(item, nofollow=False, namespace=_NO_NS): if namespace is not None and namespace != _NO_NS: - namespace = '%s.' % namespace + namespace += b'.' l = listxattr(item, nofollow=nofollow) result = [] for name in l: @@ -101,7 +101,7 @@ def listxattr(item, nofollow=False): def list(item, nofollow=False, namespace=_NO_NS): if not namespace or namespace == _NO_NS: return listxattr(item, nofollow=nofollow) - namespace = "%s." % namespace + namespace += b'.' l = listxattr(item, nofollow=nofollow) result = [] for name in l: |