mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
prevent using empty cached version
This commit is contained in:
parent
c09767b58d
commit
033c07f070
16
WakaTime.py
16
WakaTime.py
@ -725,10 +725,7 @@ def getLatestCliVersion():
|
|||||||
try:
|
try:
|
||||||
configs = parseConfigFile(INTERNAL_CONFIG_FILE)
|
configs = parseConfigFile(INTERNAL_CONFIG_FILE)
|
||||||
if configs:
|
if configs:
|
||||||
if configs.has_option('internal', 'cli_version'):
|
last_modified, last_version = lastModifiedAndVersion(configs)
|
||||||
last_version = configs.get('internal', 'cli_version')
|
|
||||||
if last_version and configs.has_option('internal', 'cli_version_last_modified'):
|
|
||||||
last_modified = configs.get('internal', 'cli_version_last_modified')
|
|
||||||
except:
|
except:
|
||||||
log(DEBUG, traceback.format_exc())
|
log(DEBUG, traceback.format_exc())
|
||||||
|
|
||||||
@ -762,6 +759,17 @@ def getLatestCliVersion():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def lastModifiedAndVersion(configs):
|
||||||
|
last_modified, last_version = None, None
|
||||||
|
if configs.has_option('internal', 'cli_version'):
|
||||||
|
last_version = configs.get('internal', 'cli_version')
|
||||||
|
if last_version and configs.has_option('internal', 'cli_version_last_modified'):
|
||||||
|
last_modified = configs.get('internal', 'cli_version_last_modified')
|
||||||
|
if last_modified and last_version and extractVersion(last_version):
|
||||||
|
return last_modified, last_version
|
||||||
|
return None, None
|
||||||
|
|
||||||
|
|
||||||
def extractVersion(text):
|
def extractVersion(text):
|
||||||
pattern = re.compile(r"([0-9]+\.[0-9]+\.[0-9]+)")
|
pattern = re.compile(r"([0-9]+\.[0-9]+\.[0-9]+)")
|
||||||
match = pattern.search(text)
|
match = pattern.search(text)
|
||||||
|
Loading…
Reference in New Issue
Block a user