Skip to content

fix(merge): Fix merging CN Json #11574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/scripts/merge_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
# 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)

Expand Down
5 changes: 3 additions & 2 deletions .github/scripts/release_append_cn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down