File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55This script works with Python 2.6, 2.7, 3.3 and 3.4.
66"""
77
8+ from __future__ import print_function
9+
810import re
9- import argparse
11+ import sys
1012import os
1113
1214# Blacklist of qstrings that are specially handled in further
@@ -84,18 +86,18 @@ def cat_together():
8486
8587
8688if __name__ == "__main__" :
87- parser = argparse . ArgumentParser ( description = 'Generates qstr definitions from a specified source' )
88-
89- parser . add_argument ( 'command' ,
90- help = 'Command (split/cat)' )
91- parser . add_argument ( 'input_filename' ,
92- help = 'Name of the input file (when not specified, the script reads standard input)' )
93- parser . add_argument ( 'output_dir' ,
94- help = 'Output directory to store individual qstr files' )
95- parser . add_argument ( 'output_file' ,
96- help = 'Name of the output file with collected qstrs' )
97-
98- args = parser . parse_args ()
89+ if len ( sys . argv ) != 5 :
90+ print ( 'usage: %s command input_filename output_dir output_file' % sys . argv [ 0 ])
91+ sys . exit ( 2 )
92+
93+ class Args :
94+ pass
95+ args = Args ()
96+ args . command = sys . argv [ 1 ]
97+ args . input_filename = sys . argv [ 2 ]
98+ args . output_dir = sys . argv [ 3 ]
99+ args . output_file = sys . argv [ 4 ]
100+
99101 try :
100102 os .makedirs (args .output_dir )
101103 except OSError :
You can’t perform that action at this time.
0 commit comments