Script main program.
()
| 313 | |
| 314 | |
| 315 | def main(): |
| 316 | """Script main program.""" |
| 317 | import argparse |
| 318 | |
| 319 | parser = argparse.ArgumentParser( |
| 320 | description='Utilities to support installing Python libraries.', |
| 321 | color=True, |
| 322 | ) |
| 323 | parser.add_argument('-l', action='store_const', const=0, |
| 324 | default=None, dest='maxlevels', |
| 325 | help="don't recurse into subdirectories") |
| 326 | parser.add_argument('-r', type=int, dest='recursion', |
| 327 | help=('control the maximum recursion level. ' |
| 328 | 'if `-l` and `-r` options are specified, ' |
| 329 | 'then `-r` takes precedence.')) |
| 330 | parser.add_argument('-f', action='store_true', dest='force', |
| 331 | help='force rebuild even if timestamps are up to date') |
| 332 | parser.add_argument('-q', action='count', dest='quiet', default=0, |
| 333 | help='output only error messages; -qq will suppress ' |
| 334 | 'the error messages as well.') |
| 335 | parser.add_argument('-b', action='store_true', dest='legacy', |
| 336 | help='use legacy (pre-PEP3147) compiled file locations') |
| 337 | parser.add_argument('-d', metavar='DESTDIR', dest='ddir', default=None, |
| 338 | help=('directory to prepend to file paths for use in ' |
| 339 | 'compile-time tracebacks and in runtime ' |
| 340 | 'tracebacks in cases where the source file is ' |
| 341 | 'unavailable')) |
| 342 | parser.add_argument('-s', metavar='STRIPDIR', dest='stripdir', |
| 343 | default=None, |
| 344 | help=('part of path to left-strip from path ' |
| 345 | 'to source file - for example buildroot. ' |
| 346 | '`-d` and `-s` options cannot be ' |
| 347 | 'specified together.')) |
| 348 | parser.add_argument('-p', metavar='PREPENDDIR', dest='prependdir', |
| 349 | default=None, |
| 350 | help=('path to add as prefix to path ' |
| 351 | 'to source file - for example / to make ' |
| 352 | 'it absolute when some part is removed ' |
| 353 | 'by `-s` option. ' |
| 354 | '`-d` and `-p` options cannot be ' |
| 355 | 'specified together.')) |
| 356 | parser.add_argument('-x', metavar='REGEXP', dest='rx', default=None, |
| 357 | help=('skip files matching the regular expression; ' |
| 358 | 'the regexp is searched for in the full path ' |
| 359 | 'of each file considered for compilation')) |
| 360 | parser.add_argument('-i', metavar='FILE', dest='flist', |
| 361 | help=('add all the files and directories listed in ' |
| 362 | 'FILE to the list considered for compilation; ' |
| 363 | 'if "-", names are read from stdin')) |
| 364 | parser.add_argument('compile_dest', metavar='FILE|DIR', nargs='*', |
| 365 | help=('zero or more file and directory names ' |
| 366 | 'to compile; if no arguments given, defaults ' |
| 367 | 'to the equivalent of -l sys.path')) |
| 368 | parser.add_argument('-j', '--workers', default=1, |
| 369 | type=int, help='Run compileall concurrently') |
| 370 | invalidation_modes = [mode.name.lower().replace('_', '-') |
| 371 | for mode in py_compile.PycInvalidationMode] |
| 372 | parser.add_argument('--invalidation-mode', |
no test coverage detected