This is currently broken on python3, it returns junk when
we pass bytes because it uses string and %s internally.
I made a fix for it, so we can detect here if it's fixed
(in which case the NS_USER constant is bytes, not string),
load the module only if it is indeed fixed.
We can do this test always since in python2 bytes == str
and thus isinstance('user', bytes) == True.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
if xattr and getattr(xattr, 'get_all', None) is None:
try:
from xattr import pyxattr_compat as xattr
+ if not isinstance(xattr.NS_USER, bytes):
+ xattr = None
except ImportError:
+ xattr = None
+ if xattr is None:
log('Warning: python-xattr module is too old; '
'upgrade or install python-pyxattr instead.\n')
- xattr = None
posix1e = None
if not (sys.platform.startswith('cygwin') \