From 2bd8ac7762dc982bfd19c7950fa23d36fd2e539c Mon Sep 17 00:00:00 2001 From: Marian Beermann Date: Sun, 2 Oct 2016 10:54:30 +0200 Subject: [PATCH] platform: bump API version (and check consistency) --- src/borg/helpers.py | 2 +- src/borg/platform/__init__.py | 11 ++++++++--- src/borg/platform/base.py | 2 +- src/borg/platform/darwin.pyx | 2 +- src/borg/platform/freebsd.pyx | 2 +- src/borg/platform/linux.pyx | 2 +- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/borg/helpers.py b/src/borg/helpers.py index 875d708fd..5535c28dd 100644 --- a/src/borg/helpers.py +++ b/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 diff --git a/src/borg/platform/__init__.py b/src/borg/platform/__init__.py index 5a37cf1b3..1be09fe79 100644 --- a/src/borg/platform/__init__.py +++ b/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 diff --git a/src/borg/platform/base.py b/src/borg/platform/base.py index da8d3bc0c..496a59b50 100644 --- a/src/borg/platform/base.py +++ b/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) diff --git a/src/borg/platform/darwin.pyx b/src/borg/platform/darwin.pyx index 188e5f4f0..7f95f9e31 100644 --- a/src/borg/platform/darwin.pyx +++ b/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: diff --git a/src/borg/platform/freebsd.pyx b/src/borg/platform/freebsd.pyx index 0a02ed8b2..1aed05d04 100644 --- a/src/borg/platform/freebsd.pyx +++ b/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 diff --git a/src/borg/platform/linux.pyx b/src/borg/platform/linux.pyx index d35b28ac2..7b043cf1b 100644 --- a/src/borg/platform/linux.pyx +++ b/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