Explorar el Código

platform: bump API version (and check consistency)

Marian Beermann hace 8 años
padre
commit
2bd8ac7762

+ 1 - 1
src/borg/helpers.py

@@ -94,7 +94,7 @@ def check_extension_modules():
         raise ExtensionModuleError
     if crypto.API_VERSION != 3:
         raise ExtensionModuleError
-    if platform.API_VERSION != 3:
+    if platform.API_VERSION != platform.OS_API_VERSION != 4:
         raise ExtensionModuleError
 
 

+ 8 - 3
src/borg/platform/__init__.py

@@ -12,14 +12,19 @@ from .base import SaveFile, SyncFile, sync_dir, fdatasync
 from .base import swidth, API_VERSION
 from .posix import process_alive, get_process_id, local_pid_alive
 
+
+OS_API_VERSION = API_VERSION
 if sys.platform.startswith('linux'):  # pragma: linux only
+    from .linux import API_VERSION as OS_API_VERSION
     from .linux import acl_get, acl_set
     from .linux import set_flags, get_flags
     from .linux import SyncFile
-    from .linux import swidth, API_VERSION
+    from .linux import swidth
 elif sys.platform.startswith('freebsd'):  # pragma: freebsd only
+    from .freebsd import API_VERSION as OS_API_VERSION
     from .freebsd import acl_get, acl_set
-    from .freebsd import swidth, API_VERSION
+    from .freebsd import swidth
 elif sys.platform == 'darwin':  # pragma: darwin only
+    from .darwin import API_VERSION as OS_API_VERSION
     from .darwin import acl_get, acl_set
-    from .darwin import swidth, API_VERSION
+    from .darwin import swidth

+ 1 - 1
src/borg/platform/base.py

@@ -13,7 +13,7 @@ platform API: that way platform APIs provided by the platform-specific support m
 are correctly composed into the base functionality.
 """
 
-API_VERSION = 3
+API_VERSION = 4
 
 fdatasync = getattr(os, 'fdatasync', os.fsync)
 

+ 1 - 1
src/borg/platform/darwin.pyx

@@ -4,7 +4,7 @@ from ..helpers import user2uid, group2gid
 from ..helpers import safe_decode, safe_encode
 from .posix import swidth
 
-API_VERSION = 3
+API_VERSION = 4
 
 cdef extern from "sys/acl.h":
     ctypedef struct _acl_t:

+ 1 - 1
src/borg/platform/freebsd.pyx

@@ -4,7 +4,7 @@ from ..helpers import posix_acl_use_stored_uid_gid
 from ..helpers import safe_encode, safe_decode
 from .posix import swidth
 
-API_VERSION = 3
+API_VERSION = 4
 
 cdef extern from "errno.h":
     int errno

+ 1 - 1
src/borg/platform/linux.pyx

@@ -12,7 +12,7 @@ from .posix import swidth
 from libc cimport errno
 from libc.stdint cimport int64_t
 
-API_VERSION = 3
+API_VERSION = 4
 
 cdef extern from "sys/types.h":
     int ACL_TYPE_ACCESS