2222"""
2323import sh
2424import os
25+ import sys
26+ import argparse
2527from pythonforandroid .build import Context
2628from pythonforandroid import logger
2729from pythonforandroid .toolchain import current_directory
@@ -46,7 +48,7 @@ def modified_recipes(branch='origin/develop'):
4648 return recipes
4749
4850
49- def build (target_python , requirements ):
51+ def build (target_python , requirements , archs ):
5052 """
5153 Builds an APK given a target Python and a set of requirements.
5254 """
@@ -57,16 +59,29 @@ def build(target_python, requirements):
5759 requirements .add (target_python .name )
5860 requirements = ',' .join (requirements )
5961 logger .info ('requirements: {}' .format (requirements ))
62+
6063 with current_directory ('testapps/on_device_unit_tests/' ):
6164 # iterates to stream the output
6265 for line in sh .python (
6366 'setup.py' , 'apk' , '--sdk-dir' , android_sdk_home ,
6467 '--ndk-dir' , android_ndk_home , '--requirements' ,
65- requirements , _err_to_out = True , _iter = True ):
68+ requirements , * [f"--arch={ arch } " for arch in archs ],
69+ _err_to_out = True , _iter = True ):
6670 print (line )
6771
6872
6973def main ():
74+ parser = argparse .ArgumentParser ("rebuild_updated_recipes" )
75+ parser .add_argument (
76+ "--arch" ,
77+ help = "The archs to build for during tests" ,
78+ action = "append" ,
79+ default = [],
80+ )
81+ args , unknown = parser .parse_known_args (sys .argv [1 :])
82+
83+ logger .info (f"Building updated recipes for the following archs: { args .arch } " )
84+
7085 target_python = TargetPython .python3
7186 recipes = modified_recipes ()
7287 logger .info ('recipes modified: {}' .format (recipes ))
@@ -89,7 +104,7 @@ def main():
89104 broken_recipes = BROKEN_RECIPES [target_python ]
90105 recipes -= broken_recipes
91106 logger .info ('recipes to build (no broken): {}' .format (recipes ))
92- build (target_python , recipes )
107+ build (target_python , recipes , args . arch )
93108
94109
95110if __name__ == '__main__' :
0 commit comments