]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/metadata.py
metadata: use python-xattr pyxattr compat code
[bup.git] / lib / bup / metadata.py
index 84b0f2a23597c5f61be21808d88b61c1c545833b..fe1d5f378e5750da4d52c707241c0d7787f4cc19 100644 (file)
@@ -20,16 +20,18 @@ 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:
+            from xattr import pyxattr_compat as xattr
+        except ImportError:
             log('Warning: python-xattr module is too old; '
-                'install python-pyxattr instead.\n')
+                'upgrade or install python-pyxattr instead.\n')
             xattr = None
 
 posix1e = None