from bup import vint, xstat
from bup.drecurse import recursive_dirlist
from bup.helpers import add_error, mkdirp, log, is_superuser, format_filesize
-from bup.helpers import pwd_from_uid, pwd_from_name, grp_from_gid, grp_from_name
+from bup.pwdgrp import pwd_from_uid, pwd_from_name, grp_from_gid, grp_from_name
from bup.xstat import utime, lutime
xattr = None
if sys.platform.startswith('linux'):
+ # prefer python-pyxattr (it's a lot faster), but fall back to python-xattr
+ # as the two are incompatible and only one can be installed on a system
try:
import xattr
except ImportError:
log('Warning: Linux xattr support missing; install python-pyxattr.\n')
- if xattr:
+ if xattr and getattr(xattr, 'get_all', None) is None:
try:
- xattr.get_all
- except AttributeError:
- log('Warning: python-xattr module is too old; '
- 'install python-pyxattr instead.\n')
+ 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')
posix1e = None
if not (sys.platform.startswith('cygwin') \