@@ -102,8 +102,6 @@ def dist_from_args(ctx, dist_args):
102102 ctx ,
103103 name = dist_args .dist_name ,
104104 recipes = split_argument_list (dist_args .requirements ),
105- allow_download = False , # TODO: remove
106- allow_build = dist_args .allow_build ,
107105 extra_dist_dirs = split_argument_list (dist_args .extra_dist_dirs ),
108106 require_perfect_match = dist_args .require_perfect_match )
109107
@@ -535,16 +533,6 @@ def __init__(self):
535533 help = 'The bootstrap to build with. Leave unset to choose automatically.' ,
536534 default = None )
537535
538- add_boolean_option (
539- generic_parser , ["allow-download" ],
540- default = False ,
541- description = 'Whether to allow binary dist download:' )
542-
543- add_boolean_option (
544- generic_parser , ["allow-build" ],
545- default = True ,
546- description = 'Whether to allow compilation of a new distribution:' )
547-
548536 add_boolean_option (
549537 generic_parser , ["force-build" ],
550538 default = False ,
@@ -681,21 +669,23 @@ def __init__(self):
681669 parents = [generic_parser ])
682670
683671 print ('ready to parse' , sys .argv [1 :])
684- args = parser .parse_args (sys .argv [1 :])
672+ args , unknown = parser .parse_known_args (sys .argv [1 :])
673+ args .unknown_args = unknown
685674 print ('args are' , args )
686675
687676 setup_color (args .color )
688677
689678 # strip version from requirements, and put them in environ
690- requirements = []
691- for requirement in split_argument_list (args .requirements ):
692- if "==" in requirement :
693- requirement , version = requirement .split (u"==" , 1 )
694- os .environ ["VERSION_{}" .format (requirement )] = version
695- info ('Recipe {}: version "{}" requested' .format (
696- requirement , version ))
697- requirements .append (requirement )
698- args .requirements = u"," .join (requirements )
679+ if hasattr (args , 'requirements' ):
680+ requirements = []
681+ for requirement in split_argument_list (args .requirements ):
682+ if "==" in requirement :
683+ requirement , version = requirement .split (u"==" , 1 )
684+ os .environ ["VERSION_{}" .format (requirement )] = version
685+ info ('Recipe {}: version "{}" requested' .format (
686+ requirement , version ))
687+ requirements .append (requirement )
688+ args .requirements = u"," .join (requirements )
699689
700690 self .ctx = Context ()
701691 self .storage_dir = args .storage_dir
@@ -845,7 +835,7 @@ def export_dist(self, args):
845835 and can use the apk command instead.
846836 '''
847837 ctx = self .ctx
848- dist = dist_from_args (ctx , self . dist_args )
838+ dist = dist_from_args (ctx , args )
849839 if dist .needs_build :
850840 info ('You asked to export a dist, but there is no dist '
851841 'with suitable recipes available. For now, you must '
@@ -918,7 +908,7 @@ def apk(self, args):
918908
919909 build = imp .load_source ('build' , join (dist .dist_dir , 'build.py' ))
920910 with current_directory (dist .dist_dir ):
921- build_args = build .parse_args (args )
911+ build_args = build .parse_args (args . unknown_args )
922912 output = shprint (sh .ant , apk_args .build_mode , _tail = 20 , _critical = True , _env = env )
923913
924914 info_main ('# Copying APK to current directory' )
@@ -1049,7 +1039,7 @@ def adb(self, args):
10491039 def logcat (self , args ):
10501040 '''Runs ``adb logcat`` using the adb binary from the detected SDK
10511041 directory. All extra args are passed as arguments to logcat.'''
1052- self .adb (['logcat' ] + args )
1042+ self .adb (['logcat' ] + args . unknown_args )
10531043
10541044 def build_status (self , args ):
10551045
0 commit comments