Parse the given input directory and emit generated code.
(argv)
| 229 | |
| 230 | |
| 231 | def _standalone(argv): |
| 232 | """Parse the given input directory and emit generated code.""" |
| 233 | varprefix = "GEOCODE" |
| 234 | per_locale = True |
| 235 | separator = None |
| 236 | chunks = -1 |
| 237 | try: |
| 238 | opts, args = getopt.getopt(argv, "hv:fs:c:", ("help", "var=", "flat", "sep=", "chunks=")) |
| 239 | except getopt.GetoptError: |
| 240 | prnt(__doc__, file=sys.stderr) |
| 241 | sys.exit(1) |
| 242 | for opt, arg in opts: |
| 243 | if opt in ("-h", "--help"): |
| 244 | prnt(__doc__, file=sys.stderr) |
| 245 | sys.exit(1) |
| 246 | elif opt in ("-v", "--var"): |
| 247 | varprefix = arg |
| 248 | elif opt in ("-f", "--flat"): |
| 249 | per_locale = False |
| 250 | elif opt in ("-s", "--sep"): |
| 251 | separator = arg |
| 252 | elif opt in ("-c", "--chunks"): |
| 253 | chunks = int(arg) |
| 254 | else: |
| 255 | prnt("Unknown option %s" % opt, file=sys.stderr) |
| 256 | prnt(__doc__, file=sys.stderr) |
| 257 | sys.exit(1) |
| 258 | if len(args) != 3: |
| 259 | prnt(__doc__, file=sys.stderr) |
| 260 | sys.exit(1) |
| 261 | if per_locale: |
| 262 | prefixdata = load_locale_prefixdata(args[0], separator=separator) |
| 263 | else: |
| 264 | prefixdata = {} |
| 265 | load_locale_prefixdata_file(prefixdata, args[0], separator=separator) |
| 266 | output_prefixdata_code(prefixdata, args[1], args[2], varprefix, per_locale, chunks) |
| 267 | |
| 268 | |
| 269 | if __name__ == "__main__": |
no test coverage detected