File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1- VERSION ?= 0.4.1
1+ VERSION ?= 0.4.2
22CACHE ?= --no-cache=1
33FULLVERSION ?= ${VERSION}
44archs ?= arm32v7 amd64 i386 arm64v8 arm32v6
Original file line number Diff line number Diff line change 33"""
44
55__all__ = ['parser' , 'webhook' , 'notifier' ]
6- __version__ = '0.4.1 '
6+ __version__ = '0.4.2 '
Original file line number Diff line number Diff line change 1414__DEFAULT_FILE__ = os .getenv ('GRN_VERSIONS_FILE' , str (Path .home ()) + '/.github_release_notifier/versions' )
1515
1616
17+ def version_compare (version1 : str , version2 : str ) -> int :
18+ def normalize (v ):
19+ return [int (x ) for x in re .sub (r'([^.0-9]+)' , '' , v ).split ("." )]
20+
21+ return (normalize (version1 ) > normalize (version2 )) - (normalize (version1 ) < normalize (version2 ))
22+
23+
1724def _call_webhook (webhook : str , entry : str , logger : logging .Logger ) -> None :
1825 logger .info ("Hook call : %s / %s" % (webhook , json .dumps (entry )))
1926 try :
@@ -32,9 +39,7 @@ def run(file: str = __DEFAULT_FILE__) -> dict:
3239 try :
3340 condition = LooseVersion (str (entry ['version' ])) > LooseVersion (str (get_version (package )))
3441 except TypeError as e :
35- # https://bugs.python.org/issue14894
36- # Always consider the version is new in case of buggy comparision
37- condition = True
42+ condition = version_compare (str (entry ['version' ]), str (get_version (package ))) > 0
3843 if condition :
3944 database = _get_database (file )
4045 database [package ] = entry ['version' ]
You can’t perform that action at this time.
0 commit comments