From 658975d4fce7acf858df9a7d045f8e8b21e0d5b1 Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Wed, 13 Jun 2018 16:29:44 +0200 Subject: [PATCH] scons: precompile regexp Reflects micropython commit f6a1f18603de5c4d2321bcf4f967df298850e3f6 --- site_scons/site_tools/micropython/qstrdefs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/site_scons/site_tools/micropython/qstrdefs.py b/site_scons/site_tools/micropython/qstrdefs.py index 9563067d42..5e4e1f2bb2 100644 --- a/site_scons/site_tools/micropython/qstrdefs.py +++ b/site_scons/site_tools/micropython/qstrdefs.py @@ -5,8 +5,9 @@ QSTR_BLACKLIST = set(['NULL', 'number_of']) def process(source, target): + re_qstr = re.compile(r'MP_QSTR_[_a-zA-Z0-9]+') for line in source: - for match in re.findall(r'MP_QSTR_[_a-zA-Z0-9]+', line): + for match in re_qstr.findall(line): name = match.replace('MP_QSTR_', '') if name not in QSTR_BLACKLIST: target.write('Q(%s)\n' % name)