mirror of
https://github.com/borgbackup/borg.git
synced 2024-10-26 12:41:29 +03:00
label platform code, exclude freebsd and unknown platform from coverage measurement
this coverage configuration is mostly for travis and there we only can test linux and darwin.
This commit is contained in:
parent
d7b6cc3527
commit
35280e9a65
@ -10,6 +10,8 @@ omit =
|
|||||||
[report]
|
[report]
|
||||||
exclude_lines =
|
exclude_lines =
|
||||||
pragma: no cover
|
pragma: no cover
|
||||||
|
pragma: freebsd only
|
||||||
|
pragma: unknown platform only
|
||||||
def __repr__
|
def __repr__
|
||||||
raise AssertionError
|
raise AssertionError
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
if sys.platform.startswith('linux'):
|
if sys.platform.startswith('linux'): # pragma: linux only
|
||||||
from .platform_linux import acl_get, acl_set, API_VERSION
|
from .platform_linux import acl_get, acl_set, API_VERSION
|
||||||
elif sys.platform.startswith('freebsd'):
|
elif sys.platform.startswith('freebsd'): # pragma: freebsd only
|
||||||
from .platform_freebsd import acl_get, acl_set, API_VERSION
|
from .platform_freebsd import acl_get, acl_set, API_VERSION
|
||||||
elif sys.platform == 'darwin':
|
elif sys.platform == 'darwin': # pragma: darwin only
|
||||||
from .platform_darwin import acl_get, acl_set, API_VERSION
|
from .platform_darwin import acl_get, acl_set, API_VERSION
|
||||||
else:
|
else: # pragma: unknown platform only
|
||||||
API_VERSION = 2
|
API_VERSION = 2
|
||||||
|
|
||||||
def acl_get(path, item, st, numeric_owner=False):
|
def acl_get(path, item, st, numeric_owner=False):
|
||||||
|
@ -36,7 +36,7 @@ def _check(rv, path=None):
|
|||||||
raise OSError(get_errno(), path)
|
raise OSError(get_errno(), path)
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
if sys.platform.startswith('linux'):
|
if sys.platform.startswith('linux'): # pragma: linux only
|
||||||
libc.llistxattr.argtypes = (c_char_p, c_char_p, c_size_t)
|
libc.llistxattr.argtypes = (c_char_p, c_char_p, c_size_t)
|
||||||
libc.llistxattr.restype = c_ssize_t
|
libc.llistxattr.restype = c_ssize_t
|
||||||
libc.flistxattr.argtypes = (c_int, c_char_p, c_size_t)
|
libc.flistxattr.argtypes = (c_int, c_char_p, c_size_t)
|
||||||
@ -100,7 +100,7 @@ def setxattr(path, name, value, *, follow_symlinks=True):
|
|||||||
func = libc.lsetxattr
|
func = libc.lsetxattr
|
||||||
_check(func(path, name, value, len(value) if value else 0, 0), path)
|
_check(func(path, name, value, len(value) if value else 0, 0), path)
|
||||||
|
|
||||||
elif sys.platform == 'darwin':
|
elif sys.platform == 'darwin': # pragma: darwin only
|
||||||
libc.listxattr.argtypes = (c_char_p, c_char_p, c_size_t, c_int)
|
libc.listxattr.argtypes = (c_char_p, c_char_p, c_size_t, c_int)
|
||||||
libc.listxattr.restype = c_ssize_t
|
libc.listxattr.restype = c_ssize_t
|
||||||
libc.flistxattr.argtypes = (c_int, c_char_p, c_size_t)
|
libc.flistxattr.argtypes = (c_int, c_char_p, c_size_t)
|
||||||
@ -166,7 +166,7 @@ def setxattr(path, name, value, *, follow_symlinks=True):
|
|||||||
flags = XATTR_NOFOLLOW
|
flags = XATTR_NOFOLLOW
|
||||||
_check(func(path, name, value, len(value) if value else 0, 0, flags), path)
|
_check(func(path, name, value, len(value) if value else 0, 0, flags), path)
|
||||||
|
|
||||||
elif sys.platform.startswith('freebsd'):
|
elif sys.platform.startswith('freebsd'): # pragma: freebsd only
|
||||||
EXTATTR_NAMESPACE_USER = 0x0001
|
EXTATTR_NAMESPACE_USER = 0x0001
|
||||||
libc.extattr_list_fd.argtypes = (c_int, c_int, c_char_p, c_size_t)
|
libc.extattr_list_fd.argtypes = (c_int, c_int, c_char_p, c_size_t)
|
||||||
libc.extattr_list_fd.restype = c_ssize_t
|
libc.extattr_list_fd.restype = c_ssize_t
|
||||||
@ -247,7 +247,7 @@ def setxattr(path, name, value, *, follow_symlinks=True):
|
|||||||
func = libc.extattr_set_link
|
func = libc.extattr_set_link
|
||||||
_check(func(path, EXTATTR_NAMESPACE_USER, name, value, len(value) if value else 0), path)
|
_check(func(path, EXTATTR_NAMESPACE_USER, name, value, len(value) if value else 0), path)
|
||||||
|
|
||||||
else:
|
else: # pragma: unknown platform only
|
||||||
def listxattr(path, *, follow_symlinks=True):
|
def listxattr(path, *, follow_symlinks=True):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user