Skip to content

Commit 4b4d55a

Browse files
authored
Merge pull request #1604 from AndreMiras/feature/conditional_build_improvements
Conditional build script fixes
2 parents 52f4bbc + 92fde71 commit 4b4d55a

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

ci/rebuild_updated_recipes.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
import sh
2525
import os
2626
from pythonforandroid.build import Context
27+
from pythonforandroid import logger
2728
from pythonforandroid.graph import get_recipe_order_and_bootstrap
2829
from pythonforandroid.toolchain import current_directory
30+
from pythonforandroid.util import BuildInterruptingException
2931
from ci.constants import TargetPython, CORE_RECIPES, BROKEN_RECIPES
3032

3133

@@ -59,9 +61,10 @@ def build(target_python, requirements):
5961
testapp = 'setup_testapp_python3.py'
6062
requirements.add(target_python.name)
6163
requirements = ','.join(requirements)
62-
print('requirements:', requirements)
64+
logger.info('requirements: {}'.format(requirements))
6365
with current_directory('testapps/'):
6466
try:
67+
# iterates to stream the output
6568
for line in sh.python(
6669
testapp, 'apk', '--sdk-dir', android_sdk_home,
6770
'--ndk-dir', android_ndk_home, '--bootstrap', 'sdl2', '--requirements',
@@ -74,21 +77,24 @@ def build(target_python, requirements):
7477
def main():
7578
target_python = TargetPython.python3
7679
recipes = modified_recipes()
77-
print('recipes modified:', recipes)
80+
logger.info('recipes modified: {}'.format(recipes))
7881
recipes -= CORE_RECIPES
79-
print('recipes to build:', recipes)
82+
logger.info('recipes to build: {}'.format(recipes))
8083
context = Context()
81-
build_order, python_modules, bs = get_recipe_order_and_bootstrap(
82-
context, recipes, None)
83-
# fallback to python2 if default target is not compatible
84-
if target_python.name not in build_order:
85-
print('incompatible with {}'.format(target_python.name))
84+
# forces the default target
85+
recipes_and_target = recipes | set([target_python.name])
86+
try:
87+
build_order, python_modules, bs = get_recipe_order_and_bootstrap(
88+
context, recipes_and_target, None)
89+
except BuildInterruptingException:
90+
# fallback to python2 if default target is not compatible
91+
logger.info('incompatible with {}'.format(target_python.name))
8692
target_python = TargetPython.python2
87-
print('falling back to {}'.format(target_python.name))
93+
logger.info('falling back to {}'.format(target_python.name))
8894
# removing the known broken recipe for the given target
8995
broken_recipes = BROKEN_RECIPES[target_python]
9096
recipes -= broken_recipes
91-
print('recipes to build (no broken):', recipes)
97+
logger.info('recipes to build (no broken): {}'.format(recipes))
9298
build(target_python, recipes)
9399

94100

pythonforandroid/recipes/libzbar/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class LibZBarRecipe(Recipe):
1717

1818
def should_build(self, arch):
1919
return not os.path.exists(
20-
os.path.join(self.ctx.get_libs_dir(arch.arch), 'libzbar.so'))
20+
os.path.join(self.ctx.get_libs_dir(arch.arch), 'libzbar.so'))
2121

2222
def get_recipe_env(self, arch=None, with_flags_in_cc=True):
2323
env = super(LibZBarRecipe, self).get_recipe_env(arch, with_flags_in_cc)

0 commit comments

Comments
 (0)