فهرست منبع

dummy xattr implementation for unsupported platforms

raising "Unsupported platform" (and making attic completely unusable) just because there is no xattr support isn't necessary.
Thomas Waldmann 10 سال پیش
والد
کامیت
1fe844a896
1فایلهای تغییر یافته به همراه11 افزوده شده و 1 حذف شده
  1. 11 1
      attic/xattr.py

+ 11 - 1
attic/xattr.py

@@ -248,4 +248,14 @@ elif sys.platform.startswith('freebsd'):
         _check(func(path, EXTATTR_NAMESPACE_USER, name, value, len(value) if value else 0), path)
 
 else:
-    raise Exception('Unsupported platform: %s' % sys.platform)
+    # this is a dummy xattr interface for platforms for which we do not have
+    # a real implementation (or which do not support xattr at all).
+
+    def listxattr(path, *, follow_symlinks=True):
+        return []
+
+    def getxattr(path, name, *, follow_symlinks=True):
+        return
+
+    def setxattr(path, name, value, *, follow_symlinks=True):
+        return