From 1714f3d1145cc53afa0dab20a9c341a3a4498ef9 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 18 Jan 2023 16:52:51 -0500 Subject: [PATCH 1/2] tools: allow icutrim.py to run on python2 Refs: https://github.com/nodejs/build/issues/2998 Small icu seems broken from 14.x since it uses python2. Although main no longer supports python2 landing and backporting this change to the 14.x line would allow us to simplify future backports as currently the files are the same across lines. Signed-off-by: Michael Dawson --- tools/icu/icutrim.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/icu/icutrim.py b/tools/icu/icutrim.py index f857e73bbce298..1357b067336438 100755 --- a/tools/icu/icutrim.py +++ b/tools/icu/icutrim.py @@ -316,7 +316,10 @@ def removeList(count=0): erritems = fi.readlines() fi.close() #Item zone/zh_Hant_TW.res depends on missing item zone/zh_Hant.res - pat = re.compile(bytes(r"^Item ([^ ]+) depends on missing item ([^ ]+).*", 'utf-8')) + if (sys.version_info.major < 3): + pat = re.compile(bytes(r"^Item ([^ ]+) depends on missing item ([^ ]+).*").encode('utf-8')) + else: + pat = re.compile(bytes(r"^Item ([^ ]+) depends on missing item ([^ ]+).*", 'utf-8')) for i in range(len(erritems)): line = erritems[i].strip() m = pat.match(line) From b7e4e1934085ae960dc5727ba82b4c24b74d2581 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Fri, 20 Jan 2023 14:30:11 -0500 Subject: [PATCH 2/2] Update tools/icu/icutrim.py --- tools/icu/icutrim.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/icu/icutrim.py b/tools/icu/icutrim.py index 1357b067336438..0ae8c23319db93 100755 --- a/tools/icu/icutrim.py +++ b/tools/icu/icutrim.py @@ -316,10 +316,7 @@ def removeList(count=0): erritems = fi.readlines() fi.close() #Item zone/zh_Hant_TW.res depends on missing item zone/zh_Hant.res - if (sys.version_info.major < 3): - pat = re.compile(bytes(r"^Item ([^ ]+) depends on missing item ([^ ]+).*").encode('utf-8')) - else: - pat = re.compile(bytes(r"^Item ([^ ]+) depends on missing item ([^ ]+).*", 'utf-8')) + pat = re.compile(br"^Item ([^ ]+) depends on missing item ([^ ]+).*") for i in range(len(erritems)): line = erritems[i].strip() m = pat.match(line)