Skip to content

Commit

Permalink
Handle looseversion errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jaymoulin committed May 31, 2019
1 parent f5c7ee6 commit 1f1159f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
@@ -1,4 +1,4 @@
VERSION ?= 0.4.3
VERSION ?= 0.4.4
CACHE ?= --no-cache=1
FULLVERSION ?= ${VERSION}
archs ?= arm32v7 amd64 i386 arm64v8 arm32v6
Expand Down
2 changes: 1 addition & 1 deletion github_release_notifier/__init__.py
Expand Up @@ -3,4 +3,4 @@
"""

__all__ = ['parser', 'webhook', 'notifier']
__version__ = '0.4.3'
__version__ = '0.4.4'
7 changes: 5 additions & 2 deletions github_release_notifier/notifier.py
Expand Up @@ -38,8 +38,11 @@ def run(file: str = __DEFAULT_FILE__) -> dict:
for entry in parse(package):
try:
condition = version_compare(str(entry['version']), str(get_version(package))) > 0
except ValueError as e:
condition = LooseVersion(str(entry['version'])) > LooseVersion(str(get_version(package)))
except e:
try:
condition = LooseVersion(str(entry['version'])) > LooseVersion(str(get_version(package)))
except e:
condition = False
if condition:
database = _get_database(file)
database[package] = entry['version']
Expand Down
6 changes: 3 additions & 3 deletions github_release_notifier/parser.py
Expand Up @@ -26,9 +26,9 @@ def parse(package: str) -> List[dict]:
if 'content' in item and item['content'][0] is not None and 'value' in item['content'][0]:
current_dict['content'] = item['content'][0]['value']
if (
'media_thumbnail' in item and
item['media_thumbnail'][0] is not None
and 'url' in item['media_thumbnail'][0]
'media_thumbnail' in item and
item['media_thumbnail'][0] is not None
and 'url' in item['media_thumbnail'][0]
):
current_dict['media'] = item['media_thumbnail'][0]['url']
entries.append(current_dict)
Expand Down

0 comments on commit 1f1159f

Please sign in to comment.