diff --git a/.github/scripts/merge_packages.py b/.github/scripts/merge_packages.py index 7e4f47ca8b3..8d1f200ec5c 100755 --- a/.github/scripts/merge_packages.py +++ b/.github/scripts/merge_packages.py @@ -4,6 +4,7 @@ # Usage: # python merge_packages.py package_esp8266com_index.json version/new/package_esp8266com_index.json # Written by Ivan Grokhotkov, 2015 +# Updated by lucasssvaz to handle Chinese version sorting, 2025 # 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' (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 # (unlike NormalizedVersion/LooseVersion/StrictVersion & similar crap) def pkgVersionNormalized(versionString): - - verStr = str(versionString) + verStr = str(versionString).replace("-cn", "") verParts = re.split(r"\.|-rc|-alpha", verStr, flags=re.IGNORECASE) if len(verParts) == 3: - if sys.version_info > (3, 0): # Python 3 - verStr = str(versionString) + "-rc" + str(sys.maxsize) - else: # Python 2 - verStr = str(versionString) + "-rc" + str(sys.maxint) - + if "-cn" in str(versionString): + verStr = verStr + "-rc" + str(sys.maxsize // 2) + else: + verStr = verStr + "-rc" + str(sys.maxsize) elif len(verParts) != 4: print("pkgVersionNormalized WARNING: unexpected version format: {0})".format(verStr), file=sys.stderr) diff --git a/.github/scripts/release_append_cn.py b/.github/scripts/release_append_cn.py index b29fe0c31ba..2342834bb7e 100755 --- a/.github/scripts/release_append_cn.py +++ b/.github/scripts/release_append_cn.py @@ -17,8 +17,9 @@ def append_cn_to_versions(obj): if isinstance(obj, dict): - # dfu-util comes from arduino.cc and not from the Chinese mirrors, so we skip it - if obj.get("name") == "dfu-util": + # Skip tools that are not from the esp32 package + packager = obj.get("packager") + if packager is not None and packager != "esp32": return for key, value in obj.items():