1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-12 09:28:10 +00:00
trezor-firmware/site_scons/site_tools/micropython/qstrdefs.py

17 lines
389 B
Python
Raw Normal View History

2017-08-01 16:50:28 +00:00
import re
import sys
QSTR_BLACKLIST = set(['NULL', 'number_of'])
def process(source, target):
for line in source:
for match in re.findall(r'MP_QSTR_[_a-zA-Z0-9]+', line):
name = match.replace('MP_QSTR_', '')
if name not in QSTR_BLACKLIST:
target.write('Q(%s)\n' % name)
if __name__ == '__main__':
process(sys.stdin, sys.stdout)