2016-07-08 11:36:30 -04:00
|
|
|
import errno
|
2016-06-30 20:07:30 -04:00
|
|
|
import os
|
2016-11-17 14:16:28 -05:00
|
|
|
import subprocess
|
2015-04-19 17:54:44 -04:00
|
|
|
import sys
|
2014-04-13 14:26:46 -04:00
|
|
|
|
2016-06-30 20:07:30 -04:00
|
|
|
|
|
|
|
|
# POSIX-only, from borg 1.1 platform.base
|
|
|
|
|
def sync_dir(path):
|
|
|
|
|
fd = os.open(path, os.O_RDONLY)
|
|
|
|
|
try:
|
|
|
|
|
os.fsync(fd)
|
2016-07-08 11:36:30 -04:00
|
|
|
except OSError as os_error:
|
|
|
|
|
# Some network filesystems don't support this and fail with EINVAL.
|
|
|
|
|
# Other error codes (e.g. EIO) shouldn't be silenced.
|
|
|
|
|
if os_error.errno != errno.EINVAL:
|
|
|
|
|
raise
|
2016-06-30 20:07:30 -04:00
|
|
|
finally:
|
|
|
|
|
os.close(fd)
|
|
|
|
|
|
|
|
|
|
|
2016-11-17 14:16:28 -05:00
|
|
|
# most POSIX platforms (but not Linux), see also borg 1.1 platform.base
|
|
|
|
|
def umount(mountpoint):
|
|
|
|
|
return subprocess.call(['umount', mountpoint])
|
|
|
|
|
|
|
|
|
|
|
2015-11-01 17:06:52 -05:00
|
|
|
if sys.platform.startswith('linux'): # pragma: linux only
|
2016-11-17 14:16:28 -05:00
|
|
|
from .platform_linux import acl_get, acl_set, umount, API_VERSION
|
2015-11-01 17:06:52 -05:00
|
|
|
elif sys.platform.startswith('freebsd'): # pragma: freebsd only
|
2015-05-22 13:21:41 -04:00
|
|
|
from .platform_freebsd import acl_get, acl_set, API_VERSION
|
2015-11-01 17:06:52 -05:00
|
|
|
elif sys.platform == 'darwin': # pragma: darwin only
|
2015-05-22 13:21:41 -04:00
|
|
|
from .platform_darwin import acl_get, acl_set, API_VERSION
|
2015-11-01 17:06:52 -05:00
|
|
|
else: # pragma: unknown platform only
|
2017-01-13 15:23:21 -05:00
|
|
|
API_VERSION = '1.0_01'
|
2015-03-18 13:21:04 -04:00
|
|
|
|
|
|
|
|
def acl_get(path, item, st, numeric_owner=False):
|
2014-04-13 14:26:46 -04:00
|
|
|
pass
|
2015-03-18 13:21:04 -04:00
|
|
|
|
2014-04-13 14:26:46 -04:00
|
|
|
def acl_set(path, item, numeric_owner=False):
|
|
|
|
|
pass
|