@@ -393,56 +393,45 @@ def __init__(self):
393393 subparsers = parser .add_subparsers (dest = 'subparser_name' ,
394394 help = 'The command to run' )
395395
396- def add_parser (subparsers , * args , ** kwargs ):
397- """
398- argparse in python2 doesn't support the aliases option,
399- so we just don't provide the aliases there.
400- """
401- if 'aliases' in kwargs and sys .version_info .major < 3 :
402- kwargs .pop ('aliases' )
403- return subparsers .add_parser (* args , ** kwargs )
404-
405- add_parser (
406- subparsers ,
396+ subparsers .add_parser (
407397 'recommendations' ,
408398 parents = [generic_parser ],
409399 help = 'List recommended p4a dependencies' )
410- parser_recipes = add_parser (
411- subparsers ,
400+ parser_recipes = subparsers .add_parser (
412401 'recipes' ,
413402 parents = [generic_parser ],
414403 help = 'List the available recipes' )
415404 parser_recipes .add_argument (
416405 "--compact" ,
417406 action = "store_true" , default = False ,
418407 help = "Produce a compact list suitable for scripting" )
419- add_parser (
420- subparsers , 'bootstraps' ,
408+ subparsers . add_parser (
409+ 'bootstraps' ,
421410 help = 'List the available bootstraps' ,
422411 parents = [generic_parser ])
423- add_parser (
424- subparsers , 'clean_all' ,
412+ subparsers . add_parser (
413+ 'clean_all' ,
425414 aliases = ['clean-all' ],
426415 help = 'Delete all builds, dists and caches' ,
427416 parents = [generic_parser ])
428- add_parser (
429- subparsers , 'clean_dists' ,
417+ subparsers . add_parser (
418+ 'clean_dists' ,
430419 aliases = ['clean-dists' ],
431420 help = 'Delete all dists' ,
432421 parents = [generic_parser ])
433- add_parser (
434- subparsers , 'clean_bootstrap_builds' ,
422+ subparsers . add_parser (
423+ 'clean_bootstrap_builds' ,
435424 aliases = ['clean-bootstrap-builds' ],
436425 help = 'Delete all bootstrap builds' ,
437426 parents = [generic_parser ])
438- add_parser (
439- subparsers , 'clean_builds' ,
427+ subparsers . add_parser (
428+ 'clean_builds' ,
440429 aliases = ['clean-builds' ],
441430 help = 'Delete all builds' ,
442431 parents = [generic_parser ])
443432
444- parser_clean = add_parser (
445- subparsers , 'clean' ,
433+ parser_clean = subparsers . add_parser (
434+ 'clean' ,
446435 help = 'Delete build components.' ,
447436 parents = [generic_parser ])
448437 parser_clean .add_argument (
@@ -451,8 +440,7 @@ def add_parser(subparsers, *args, **kwargs):
451440 'number of arguments from "all", "builds", "dists", '
452441 '"distributions", "bootstrap_builds", "downloads".' ))
453442
454- parser_clean_recipe_build = add_parser (
455- subparsers ,
443+ parser_clean_recipe_build = subparsers .add_parser (
456444 'clean_recipe_build' , aliases = ['clean-recipe-build' ],
457445 help = ('Delete the build components of the given recipe. '
458446 'By default this will also delete built dists' ),
@@ -465,8 +453,7 @@ def add_parser(subparsers, *args, **kwargs):
465453 action = 'store_true' ,
466454 help = 'If passed, do not delete existing dists' )
467455
468- parser_clean_download_cache = add_parser (
469- subparsers ,
456+ parser_clean_download_cache = subparsers .add_parser (
470457 'clean_download_cache' , aliases = ['clean-download-cache' ],
471458 help = 'Delete cached downloads for requirement builds' ,
472459 parents = [generic_parser ])
@@ -476,8 +463,7 @@ def add_parser(subparsers, *args, **kwargs):
476463 help = 'The recipes to clean (space-separated). If no recipe name is'
477464 ' provided, the entire cache is cleared.' )
478465
479- parser_export_dist = add_parser (
480- subparsers ,
466+ parser_export_dist = subparsers .add_parser (
481467 'export_dist' , aliases = ['export-dist' ],
482468 help = 'Copy the named dist to the given path' ,
483469 parents = [generic_parser ])
@@ -547,57 +533,46 @@ def add_parser(subparsers, *args, **kwargs):
547533 '--signkeypw' , dest = 'signkeypw' , action = 'store' , default = None ,
548534 help = 'Password for key alias' )
549535
550- add_parser (
551- subparsers ,
536+ subparsers .add_parser (
552537 'aar' , help = 'Build an AAR' ,
553538 parents = [parser_packaging ])
554539
555- add_parser (
556- subparsers ,
540+ subparsers .add_parser (
557541 'apk' , help = 'Build an APK' ,
558542 parents = [parser_packaging ])
559543
560- add_parser (
561- subparsers ,
544+ subparsers .add_parser (
562545 'aab' , help = 'Build an AAB' ,
563546 parents = [parser_packaging ])
564547
565- add_parser (
566- subparsers ,
548+ subparsers .add_parser (
567549 'create' , help = 'Compile a set of requirements into a dist' ,
568550 parents = [generic_parser ])
569- add_parser (
570- subparsers ,
551+ subparsers .add_parser (
571552 'archs' , help = 'List the available target architectures' ,
572553 parents = [generic_parser ])
573- add_parser (
574- subparsers ,
554+ subparsers .add_parser (
575555 'distributions' , aliases = ['dists' ],
576556 help = 'List the currently available (compiled) dists' ,
577557 parents = [generic_parser ])
578- add_parser (
579- subparsers ,
558+ subparsers .add_parser (
580559 'delete_dist' , aliases = ['delete-dist' ], help = 'Delete a compiled dist' ,
581560 parents = [generic_parser ])
582561
583- parser_sdk_tools = add_parser (
584- subparsers ,
562+ parser_sdk_tools = subparsers .add_parser (
585563 'sdk_tools' , aliases = ['sdk-tools' ],
586564 help = 'Run the given binary from the SDK tools dis' ,
587565 parents = [generic_parser ])
588566 parser_sdk_tools .add_argument (
589567 'tool' , help = 'The binary tool name to run' )
590568
591- add_parser (
592- subparsers ,
569+ subparsers .add_parser (
593570 'adb' , help = 'Run adb from the given SDK' ,
594571 parents = [generic_parser ])
595- add_parser (
596- subparsers ,
572+ subparsers .add_parser (
597573 'logcat' , help = 'Run logcat from the given SDK' ,
598574 parents = [generic_parser ])
599- add_parser (
600- subparsers ,
575+ subparsers .add_parser (
601576 'build_status' , aliases = ['build-status' ],
602577 help = 'Print some debug information about current built components' ,
603578 parents = [generic_parser ])
0 commit comments