From 9d37e71959e1a0e78e161d5a54a65a0858284a9b Mon Sep 17 00:00:00 2001 From: Maxim Kudinov <44256757+max-kudinov@users.noreply.github.com> Date: Mon, 15 Jul 2024 12:37:40 +0300 Subject: [PATCH] Fix regex (#259) --- apycula/gowin_pack.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/apycula/gowin_pack.py b/apycula/gowin_pack.py index 02f7db2..b973704 100644 --- a/apycula/gowin_pack.py +++ b/apycula/gowin_pack.py @@ -2740,11 +2740,12 @@ def main(): is_himbaechel = True # For tool integration it is allowed to pass a full part number - m = re.match("GW1N(S|Z)?[A-Z]*-(LV|UV|UX)([0-9])C?([A-Z]{2}[0-9]+P?)(C[0-9]/I[0-9])", device) + m = re.match("(GW..)(S|Z)?[A-Z]*-(LV|UV|UX)([0-9]{1,2})C?([A-Z]{2}[0-9]+P?)(C[0-9]/I[0-9])", device) if m: - mods = m.group(1) or "" - luts = m.group(3) - device = f"GW1N{mods}-{luts}" + series = m.group(1) + mods = m.group(2) or "" + num = m.group(4) + device = f"{series}{mods}-{num}" with importlib.resources.path('apycula', f'{device}.pickle') as path: with closing(gzip.open(path, 'rb')) as f: db = pickle.load(f)