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