提交 950d891b 编写于 作者: H Hou Tianze

- Close #437: Ensure cache loading/saving failures won't affect normal operations

- Fix the bug that clean up code not called on exit
- Version bump
上级 206c1c73
### Version History:
- 1.6.1: Ensure cache loading/saving failures won't affect normal operations; Fix the bug that clean up code not called on exit
- 1.6.0: Fix 1000 items limit for remote directory listing
- 1.5.13: Fix multiprocess upload/syncup missing some files
- 1.5.12: Add one more heroku server; Workaround "ValueError: unknown locale: UTF-8" on macOs (by xslidian)
......
Version History:
~~~~~~~~~~~~~~~~
- 1.6.1: Ensure cache loading/saving failures won't affect normal
operations; Fix the bug that clean up code not called on exit
- 1.6.0: Fix 1000 items limit for remote directory listing
- 1.5.13: Fix multiprocess upload/syncup missing some files
- 1.5.12: Add one more heroku server; Workaround "ValueError: unknown
......
......@@ -381,6 +381,8 @@ class ByPy(object):
# so if any code using this class can check the current verbose / debug level
cached.verbose = self.verbose = verbose
cached.debug = self.debug = debug
if not cached.usecache:
pinfo("Forced hash recaculation, hash cache won't be used")
#TODO: SSL verification causes some much trouble for different Python version
# I give up and disable it for good, or for bad
......@@ -491,7 +493,7 @@ class ByPy(object):
"minimum required version is {}.\n"
"Please run 'pip install -U bypy' to update and try again.".format(
const.__version__, minver))
quit(const.EUpdateNeeded)
self.quit(const.EUpdateNeeded)
else:
self.__setting[const.SettingKey_LastUpdateCheckTime] = nowsec
self.savesetting()
......@@ -3561,6 +3563,7 @@ def clean_prog_files(cleanlevel, verbose, configdir = const.ConfigDir):
def main(argv=None): # IGNORE:C0111
''' Main Entry '''
by = None
reqres = check_requirements()
if reqres == CheckResult.Error:
perr("Requirement checking failed")
......@@ -3687,8 +3690,9 @@ def main(argv=None): # IGNORE:C0111
perr("Exception occurred:\n{}".format(formatex(ex)))
pr("Abort")
raise
quit(result)
finally:
if by:
by.quit(result)
if __name__ == "__main__":
main()
......
......@@ -121,10 +121,10 @@ class cached(object):
# periodically save to prevent loss in case of system crash
now = time.time()
if now - gvar.last_cache_save >= const.CacheSavePeriodInSec:
if cached.debug:
pdbg("Periodically saving Hash Cash")
cached.savecache()
gvar.last_cache_save = now
if cached.debug:
pdbg("Periodically saving Hash Cash")
# merge the from 'fromc' cache into the 'to' cache.
# 'keepto':
......@@ -197,7 +197,8 @@ class cached(object):
cached.cacheloaded = True
if cached.verbose:
pr("Hash Cache File loaded.")
except (EOFError, TypeError, ValueError) as ex:
#except (EOFError, TypeError, ValueError, UnicodeDecodeError) as ex:
except Exception as ex:
perr("Fail to load the Hash Cache, no caching.\n{}".format(formatex(ex)))
cached.cache = existingcache
else:
......
......@@ -12,7 +12,7 @@ import os
# https://packaging.python.org/single_source_version/
__title__ = 'bypy'
__version__ = '1.6.0'
__version__ = '1.6.1'
__author__ = 'Hou Tianze'
__license__ = 'MIT'
__desc__ = 'Python client for Baidu Yun (Personal Cloud Storage) 百度云/百度网盘 Python 客户端'
......
{
"comment": "Update info",
"recommendedVersion": "1.6.0",
"minimumRequiredVersion": "1.6.0"
"recommendedVersion": "1.6.1",
"minimumRequiredVersion": "1.6.1"
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册