diff --git a/pipe-cli/mount/pipefuse/cache.py b/pipe-cli/mount/pipefuse/cache.py index 1eab7911d0..be5142e7e2 100644 --- a/pipe-cli/mount/pipefuse/cache.py +++ b/pipe-cli/mount/pipefuse/cache.py @@ -18,7 +18,7 @@ from datetime import datetime from threading import RLock -import pytz +from dateutil.tz import tzlocal from pipefuse.fsclient import File, FileSystemClientDecorator from pipefuse import fuseutils @@ -204,7 +204,7 @@ def _uncached_ls_as_dict(self, path, depth=1): def _root(self): return File(name='root', size=0, - mtime=time.mktime(datetime.now(tz=pytz.utc).timetuple()), + mtime=time.mktime(datetime.now(tz=tzlocal()).timetuple()), ctime=None, contenttype=None, is_dir=True) diff --git a/pipe-cli/mount/pipefuse/gcp.py b/pipe-cli/mount/pipefuse/gcp.py index a195b208be..0a36fcdebd 100644 --- a/pipe-cli/mount/pipefuse/gcp.py +++ b/pipe-cli/mount/pipefuse/gcp.py @@ -4,7 +4,7 @@ import time from datetime import datetime -import pytz +from dateutil.tz import tzlocal from google.auth import _helpers from google.auth.transport.requests import AuthorizedSession from google.cloud.storage import Bucket, Blob, Client @@ -255,7 +255,7 @@ def ls(self, path, depth=1): def _get_file_object(self, blob, prefix, recursive): return File(name=self._get_object_name(blob.name, prefix, recursive), size=blob.size, - mtime=time.mktime(blob.updated.astimezone(pytz.utc).timetuple()), + mtime=time.mktime(blob.updated.astimezone(tzlocal()).timetuple()), ctime=None, contenttype='', is_dir=False) @@ -263,7 +263,7 @@ def _get_file_object(self, blob, prefix, recursive): def _get_folder_object(self, name, prefix, recursive): return File(name=self._get_object_name(name, prefix, recursive), size=0, - mtime=time.mktime(datetime.now(tz=pytz.utc).timetuple()), + mtime=time.mktime(datetime.now(tz=tzlocal()).timetuple()), ctime=None, contenttype='', is_dir=True) diff --git a/pipe-cli/mount/pipefuse/pipefs.py b/pipe-cli/mount/pipefuse/pipefs.py index 61f2b1aa32..2fc9d68773 100644 --- a/pipe-cli/mount/pipefuse/pipefs.py +++ b/pipe-cli/mount/pipefuse/pipefs.py @@ -22,6 +22,7 @@ import time import easywebdav +from dateutil.tz import tzlocal from fuse import FuseOSError, Operations from threading import RLock diff --git a/pipe-cli/mount/pipefuse/s3.py b/pipe-cli/mount/pipefuse/s3.py index 85b9c3bdc7..26bccc372e 100644 --- a/pipe-cli/mount/pipefuse/s3.py +++ b/pipe-cli/mount/pipefuse/s3.py @@ -18,11 +18,11 @@ import time from datetime import datetime -import pytz from boto3 import Session from botocore.config import Config from botocore.credentials import RefreshableCredentials from botocore.session import get_session +from dateutil.tz import tzlocal from pipefuse import fuseutils from pipefuse.fsclient import File @@ -210,7 +210,7 @@ def _matching_paths(self, items, path): def get_folder_object(self, name): return File(name=name, size=0, - mtime=time.mktime(datetime.now(tz=pytz.utc).timetuple()), + mtime=time.mktime(datetime.now(tz=tzlocal()).timetuple()), ctime=None, contenttype='', is_dir=True) @@ -221,7 +221,7 @@ def get_file_name(self, file, prefix, recursive): def get_file_object(self, file, name): return File(name=name, size=file.get('Size', ''), - mtime=time.mktime(file['LastModified'].astimezone(pytz.utc).timetuple()), + mtime=time.mktime(file['LastModified'].astimezone(tzlocal()).timetuple()), ctime=None, contenttype='', is_dir=False) diff --git a/pipe-cli/mount/pipefuse/webdav.py b/pipe-cli/mount/pipefuse/webdav.py index 1f914565b4..83428c6721 100644 --- a/pipe-cli/mount/pipefuse/webdav.py +++ b/pipe-cli/mount/pipefuse/webdav.py @@ -21,8 +21,10 @@ from numbers import Number import easywebdav +import pytz import requests import urllib3 +from dateutil.tz import tzlocal from requests import cookies from pipefuse import fuseutils @@ -109,7 +111,7 @@ def parse_timestamp(self, value, date_format): return try: time_value = datetime.datetime.strptime(value, date_format) - return time.mktime(time_value.timetuple()) + return time.mktime(time_value.replace(tzinfo=pytz.UTC).astimezone(tzlocal()).timetuple()) except ValueError as e: logging.error( 'Failed to parse date: %s. Expected format: "%s". Error: "%s"' % (value, date_format, str(e))) diff --git a/pipe-cli/mount/requirements.txt b/pipe-cli/mount/requirements.txt index cfa152975d..2ea55801f7 100644 --- a/pipe-cli/mount/requirements.txt +++ b/pipe-cli/mount/requirements.txt @@ -10,5 +10,5 @@ cachetools==3.1.1 python-intervals==1.10.0 google-resumable-media==0.3.2 google-cloud-storage==1.15.0 -python-dateutil==2.6.1 +python-dateutil==2.8.1 future==0.18.2