platform.py 989 B

123456789101112131415161718192021222324252627282930313233
  1. import errno
  2. import os
  3. import sys
  4. # POSIX-only, from borg 1.1 platform.base
  5. def sync_dir(path):
  6. fd = os.open(path, os.O_RDONLY)
  7. try:
  8. os.fsync(fd)
  9. except OSError as os_error:
  10. # Some network filesystems don't support this and fail with EINVAL.
  11. # Other error codes (e.g. EIO) shouldn't be silenced.
  12. if os_error.errno != errno.EINVAL:
  13. raise
  14. finally:
  15. os.close(fd)
  16. if sys.platform.startswith('linux'): # pragma: linux only
  17. from .platform_linux import acl_get, acl_set, API_VERSION
  18. elif sys.platform.startswith('freebsd'): # pragma: freebsd only
  19. from .platform_freebsd import acl_get, acl_set, API_VERSION
  20. elif sys.platform == 'darwin': # pragma: darwin only
  21. from .platform_darwin import acl_get, acl_set, API_VERSION
  22. else: # pragma: unknown platform only
  23. API_VERSION = 2
  24. def acl_get(path, item, st, numeric_owner=False):
  25. pass
  26. def acl_set(path, item, numeric_owner=False):
  27. pass