summaryrefslogtreecommitdiffstatshomepage
path: root/py/makeqstrdefs.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-19 14:39:08 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-04-19 14:39:08 +0300
commit1b60a6dc4e755e14453e024364c8ef5f07780d80 (patch)
tree4e1efeb0ec28a40a66ed101e3f3fcaa9ed785299 /py/makeqstrdefs.py
parent8dd704b019e5c065ced8842e143081be2b7c9a59 (diff)
downloadmicropython-1b60a6dc4e755e14453e024364c8ef5f07780d80.tar.gz
micropython-1b60a6dc4e755e14453e024364c8ef5f07780d80.zip
py: Divide "split" and "cat" phases of qstr extraction for better efficiency.
E.g. for stmhal, accumulated preprocessed output may grow large due to bloated vendor headers, and then reprocessing tens of megabytes on each build make take couple of seconds on fast hardware (=> potentially dozens of seconds on slow hardware). So instead, split once after each change, and only cat repetitively (guaranteed to be fast, as there're thousands of lines involved at most).
Diffstat (limited to 'py/makeqstrdefs.py')
-rw-r--r--py/makeqstrdefs.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/py/makeqstrdefs.py b/py/makeqstrdefs.py
index 0240505579..d02fb7e3a4 100644
--- a/py/makeqstrdefs.py
+++ b/py/makeqstrdefs.py
@@ -87,6 +87,8 @@ def cat_together():
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Generates qstr definitions from a specified source')
+ parser.add_argument('command',
+ help='Command (split/cat)')
parser.add_argument('input_filename',
help='Name of the input file (when not specified, the script reads standard input)')
parser.add_argument('output_dir',
@@ -100,11 +102,9 @@ if __name__ == "__main__":
except OSError:
pass
- if args.input_filename:
- infile = open(args.input_filename, 'r')
- else:
- infile = sys.stdin
+ if args.command == "split":
+ with open(args.input_filename) as infile:
+ process_file(infile)
- file_data = process_file(infile)
- infile.close()
- cat_together()
+ if args.command == "cat":
+ cat_together()