diff --git a/CHANGES.rst b/CHANGES.rst index f1ce56f..a9976d6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,14 @@ Changes ======= +0.0.5 (2019-05-06) +------------------ + +* Switched from `fusepy`_ to `refuse`_ + +.. _fusepy: https://github.com/fusepy/fusepy +.. _refuse: https://github.com/pleiszenburg/refuse + 0.0.4 (2019-05-01) ------------------ diff --git a/README.rst b/README.rst index 7e43316..4830a5c 100644 --- a/README.rst +++ b/README.rst @@ -57,18 +57,9 @@ CAVEATS ======= * PROJECT STATUS: **BETA** -* A `CUSTOM BUG-FIXED VERSION OF FUSEPY`_ IS REQUIRED FOR FULL POSIX COMPLIANCE. - IT IS AUTOMATICALLY INSTALLED FROM GITHUB AS A DEPENDENCY OF THIS PACKAGE. - IF THE LATEST OFFICIAL RELEASE OF FUSEPY IS USED INSTEAD, TIMESTAMPS WILL BE - INACCURATE ON A NANOSECOND TO MICROSECOND SCALE AND UTIME_NOW AS WELL AS - UTIME_OMIT WILL NOT BE HONORED. THERE WAS A `PULL REQUEST`_ TO FIX THIS, - WHICH HAS BEEN REJECTED. ALTERNATIVE APPROACHES ARE BEING RESEARCHED. * THE FILESYSTEM IS CURRENTLY **ONLY** BEING DEVELOPED FOR AND TESTED ON **LINUX**. ANYONE INTERESTED IN CONFIRMING MAC OS X AND/OR ADDING BSD SUPPORT? -.. _CUSTOM BUG-FIXED VERSION OF FUSEPY: https://github.com/s-m-e/fusepy -.. _PULL REQUEST: https://github.com/fusepy/fusepy/pull/79 - Installation ============ diff --git a/setup.py b/setup.py index 2664382..e20160a 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ # Bump version HERE! -_version_ = '0.0.4' +_version_ = '0.0.5' # List all versions of Python which are supported @@ -100,7 +100,7 @@ include_package_data = True, install_requires = [ 'click>=7.0', - 'fusepy @ git+https://github.com/s-m-e/fusepy@master#egg=fusepy-2.0.99', + 'refuse==0.0.2', 'xmltodict' ], extras_require = {'dev': development_deps_list}, diff --git a/src/loggedfs/_core/fs.py b/src/loggedfs/_core/fs.py index 706eb3d..2cbf684 100644 --- a/src/loggedfs/_core/fs.py +++ b/src/loggedfs/_core/fs.py @@ -33,18 +33,12 @@ import os import stat -from fuse import ( +from refuse.high import ( FUSE, fuse_get_context, FuseOSError, - Operations, - UTIME_NOW, - UTIME_OMIT, + Operations ) -try: - from fuse import __features__ as fuse_features -except ImportError: - fuse_features = {} from .defaults import ( FUSE_ALLOWOTHER_DEFAULT, @@ -109,13 +103,7 @@ class _loggedfs(Operations): flag_utime_omit_ok = 1 - - - requested_features = { - 'nanosecond_int': True, - 'utime_omit_none': True, - 'utime_now_auto': True - } + use_ns = True _ST_FIELDS = tuple(i for i in dir(os.stat_result) if i.startswith('st_')) @@ -210,13 +198,6 @@ def __init__(self, 'LoggedFS-python using configuration file %s' % log_configfile )) - for flag_name in self.requested_features.keys(): - setattr( - self, - 'flag_' + flag_name, - self.requested_features[flag_name] and fuse_features.get(flag_name, False) - ) - if len(kwargs) > 0: raise ValueError('unknown keyword argument(s)') @@ -317,10 +298,7 @@ def getattr(self, path, fip): ret_dict = {key: getattr(st, key) for key in self._ST_FIELDS} for key in ['st_atime', 'st_ctime', 'st_mtime']: - if self.flag_nanosecond_int: - ret_dict[key] = ret_dict.pop(key + '_ns') - else: - ret_dict.pop(key + '_ns') + ret_dict[key] = ret_dict.pop(key + '_ns') return ret_dict @@ -488,26 +466,17 @@ def unlink(self, path): def utimens(self, path, times = None): def _fix_time_(atime, mtime): - if any(val in (atime, mtime) for val in [UTIME_OMIT, None]): + if None in (atime, mtime): st = os.lstat(relpath, dir_fd = self._root_path_fd) - if atime in [UTIME_OMIT, None]: + if atime is None: atime = st.st_atime_ns - if mtime in [UTIME_OMIT, None]: + if mtime is None: mtime = st.st_mtime_ns - if UTIME_NOW in (atime, mtime): - now = time.time_ns() - if atime == UTIME_NOW: - atime = now - if mtime == UTIME_NOW: - mtime = now return (atime, mtime) relpath = self._rel_path(path) - if self.flag_nanosecond_int: - os.utime(relpath, ns = _fix_time_(*times), dir_fd = self._root_path_fd, follow_symlinks = False) - else: - os.utime(relpath, times = times, dir_fd = self._root_path_fd, follow_symlinks = False) + os.utime(relpath, ns = _fix_time_(*times), dir_fd = self._root_path_fd, follow_symlinks = False) @event(format_pattern = '{param_buf_len} bytes to {param_path} at offset {param_offset} (fh={param_fip})') diff --git a/src/loggedfs/_core/out.py b/src/loggedfs/_core/out.py index a64e67f..1c8ea40 100644 --- a/src/loggedfs/_core/out.py +++ b/src/loggedfs/_core/out.py @@ -38,7 +38,7 @@ import pwd import zlib -from fuse import ( +from refuse.high import ( fuse_get_context, FuseOSError, )