Skip to content

Commit

Permalink
fix(release): Update merge_package.py (#9694)
Browse files Browse the repository at this point in the history
Use packaging.version instead of the deprecated distutils.version
  • Loading branch information
me-no-dev authored May 27, 2024
1 parent d94b32e commit b3ad98c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/scripts/merge_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# Written by Ivan Grokhotkov, 2015
#
from __future__ import print_function
from distutils.version import LooseVersion
#from distutils.version import LooseVersion
from packaging.version import Version
import re
import json
import sys
Expand Down Expand Up @@ -33,7 +34,7 @@ def merge_objects(versions, obj):
def pkgVersionNormalized(versionString):

verStr = str(versionString)
verParts = re.split('\.|-rc', verStr, flags=re.IGNORECASE)
verParts = re.split('\.|-rc|-alpha', verStr, flags=re.IGNORECASE)

if len(verParts) == 3:
if (sys.version_info > (3, 0)): # Python 3
Expand Down Expand Up @@ -74,7 +75,8 @@ def main(args):
print("Adding platform {0}-{1}".format(name, version), file=sys.stderr)
pkg1['platforms'].append(platforms[name][version])

pkg1['platforms'] = sorted(pkg1['platforms'], key=lambda k: LooseVersion(pkgVersionNormalized(k['version'])), reverse=True)
#pkg1['platforms'] = sorted(pkg1['platforms'], key=lambda k: LooseVersion(pkgVersionNormalized(k['version'])), reverse=True)
pkg1['platforms'] = sorted(pkg1['platforms'], key=lambda k: Version(pkgVersionNormalized(k['version'])), reverse=True)

json.dump({'packages':[pkg1]}, sys.stdout, indent=2)

Expand Down

0 comments on commit b3ad98c

Please sign in to comment.