Skip to content
Snippets Groups Projects
Commit b24ccfc6 authored by Damien George's avatar Damien George
Browse files

py/makeqstrdefs.py: Make script run correctly with Python 2.6.

parent a8a5d1e8
No related branches found
No related tags found
No related merge requests found
...@@ -5,8 +5,10 @@ qstr. Each qstr is transformed into a qstr definition of the form 'Q(...)'. ...@@ -5,8 +5,10 @@ qstr. Each qstr is transformed into a qstr definition of the form 'Q(...)'.
This script works with Python 2.6, 2.7, 3.3 and 3.4. This script works with Python 2.6, 2.7, 3.3 and 3.4.
""" """
from __future__ import print_function
import re import re
import argparse import sys
import os import os
# Blacklist of qstrings that are specially handled in further # Blacklist of qstrings that are specially handled in further
...@@ -84,18 +86,18 @@ def cat_together(): ...@@ -84,18 +86,18 @@ def cat_together():
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Generates qstr definitions from a specified source') if len(sys.argv) != 5:
print('usage: %s command input_filename output_dir output_file' % sys.argv[0])
parser.add_argument('command', sys.exit(2)
help='Command (split/cat)')
parser.add_argument('input_filename', class Args:
help='Name of the input file (when not specified, the script reads standard input)') pass
parser.add_argument('output_dir', args = Args()
help='Output directory to store individual qstr files') args.command = sys.argv[1]
parser.add_argument('output_file', args.input_filename = sys.argv[2]
help='Name of the output file with collected qstrs') args.output_dir = sys.argv[3]
args.output_file = sys.argv[4]
args = parser.parse_args()
try: try:
os.makedirs(args.output_dir) os.makedirs(args.output_dir)
except OSError: except OSError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment