fix(merge): Fix merging CN Json (#11574)
This commit is contained in:
parent
ee021855a1
commit
87b718a59c
2 changed files with 11 additions and 10 deletions
16
.github/scripts/merge_packages.py
vendored
16
.github/scripts/merge_packages.py
vendored
|
|
@ -4,6 +4,7 @@
|
||||||
# Usage:
|
# Usage:
|
||||||
# python merge_packages.py package_esp8266com_index.json version/new/package_esp8266com_index.json
|
# python merge_packages.py package_esp8266com_index.json version/new/package_esp8266com_index.json
|
||||||
# Written by Ivan Grokhotkov, 2015
|
# Written by Ivan Grokhotkov, 2015
|
||||||
|
# Updated by lucasssvaz to handle Chinese version sorting, 2025
|
||||||
#
|
#
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
@ -36,20 +37,19 @@ def merge_objects(versions, obj):
|
||||||
|
|
||||||
|
|
||||||
# Normalize ESP release version string (x.x.x) by adding '-rc<MAXINT>' (x.x.x-rc9223372036854775807)
|
# Normalize ESP release version string (x.x.x) by adding '-rc<MAXINT>' (x.x.x-rc9223372036854775807)
|
||||||
# to ensure having REL above any RC
|
# to ensure having REL above any RC. CN version will be sorted after the official version if they happen
|
||||||
|
# to be mixed (normally, CN and non-CN versions should not be mixed)
|
||||||
# Dummy approach, functional anyway for current ESP package versioning
|
# Dummy approach, functional anyway for current ESP package versioning
|
||||||
# (unlike NormalizedVersion/LooseVersion/StrictVersion & similar crap)
|
# (unlike NormalizedVersion/LooseVersion/StrictVersion & similar crap)
|
||||||
def pkgVersionNormalized(versionString):
|
def pkgVersionNormalized(versionString):
|
||||||
|
verStr = str(versionString).replace("-cn", "")
|
||||||
verStr = str(versionString)
|
|
||||||
verParts = re.split(r"\.|-rc|-alpha", verStr, flags=re.IGNORECASE)
|
verParts = re.split(r"\.|-rc|-alpha", verStr, flags=re.IGNORECASE)
|
||||||
|
|
||||||
if len(verParts) == 3:
|
if len(verParts) == 3:
|
||||||
if sys.version_info > (3, 0): # Python 3
|
if "-cn" in str(versionString):
|
||||||
verStr = str(versionString) + "-rc" + str(sys.maxsize)
|
verStr = verStr + "-rc" + str(sys.maxsize // 2)
|
||||||
else: # Python 2
|
else:
|
||||||
verStr = str(versionString) + "-rc" + str(sys.maxint)
|
verStr = verStr + "-rc" + str(sys.maxsize)
|
||||||
|
|
||||||
elif len(verParts) != 4:
|
elif len(verParts) != 4:
|
||||||
print("pkgVersionNormalized WARNING: unexpected version format: {0})".format(verStr), file=sys.stderr)
|
print("pkgVersionNormalized WARNING: unexpected version format: {0})".format(verStr), file=sys.stderr)
|
||||||
|
|
||||||
|
|
|
||||||
5
.github/scripts/release_append_cn.py
vendored
5
.github/scripts/release_append_cn.py
vendored
|
|
@ -17,8 +17,9 @@ import json
|
||||||
|
|
||||||
def append_cn_to_versions(obj):
|
def append_cn_to_versions(obj):
|
||||||
if isinstance(obj, dict):
|
if isinstance(obj, dict):
|
||||||
# dfu-util comes from arduino.cc and not from the Chinese mirrors, so we skip it
|
# Skip tools that are not from the esp32 package
|
||||||
if obj.get("name") == "dfu-util":
|
packager = obj.get("packager")
|
||||||
|
if packager is not None and packager != "esp32":
|
||||||
return
|
return
|
||||||
|
|
||||||
for key, value in obj.items():
|
for key, value in obj.items():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue