From d563fcf30630f07be0845271d6faf97e6cdb911d Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Mon, 29 Oct 2018 20:36:08 +0100 Subject: [PATCH] Conditional builds falls back on Python2 if needed Falls back to python2 when tested recipes are python3crystax compatible. This is for instance the case on #1428 where the recipes depend only on python2, hence couldn't be automatically tested. Also updated `vispy` recipe to handle the version string properly, pin it and clean comments. This recipe is a demo case scenario for the conditional build falling back on python2 since `vispy` is not yet compatible with python3crystax. Last, removes the debug flag from the test apps used by the CI as it produces too many logs and halts Travis. --- ci/rebuild_updated_recipes.py | 18 +++++++++++++++--- pythonforandroid/recipes/vispy/__init__.py | 12 ++---------- testapps/setup_testapp_python2.py | 2 +- testapps/setup_testapp_python3.py | 2 +- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/ci/rebuild_updated_recipes.py b/ci/rebuild_updated_recipes.py index 870238994c..b4397a7c65 100755 --- a/ci/rebuild_updated_recipes.py +++ b/ci/rebuild_updated_recipes.py @@ -25,6 +25,8 @@ """ import sh import os +from pythonforandroid.build import Context +from pythonforandroid.graph import get_recipe_order_and_bootstrap from pythonforandroid.toolchain import current_directory from ci.constants import TargetPython, CORE_RECIPES, BROKEN_RECIPES @@ -77,11 +79,21 @@ def main(): target_python = TargetPython.python3crystax recipes = modified_recipes() print('recipes modified:', recipes) - broken_recipes = BROKEN_RECIPES[target_python] - recipes = recipes - (CORE_RECIPES | broken_recipes) + recipes -= CORE_RECIPES print('recipes to build:', recipes) + context = Context() + build_order, python_modules, bs = get_recipe_order_and_bootstrap( + context, recipes, None) + # fallback to python2 if default target is not compatible + if target_python.name not in build_order: + print('incompatible with {}'.format(target_python.name)) + target_python = TargetPython.python2 + print('falling back to {}'.format(target_python.name)) + # removing the known broken recipe for the given target + broken_recipes = BROKEN_RECIPES[target_python] + recipes -= broken_recipes + print('recipes to build (no broken):', recipes) build(target_python, recipes) - print(recipes) if __name__ == '__main__': diff --git a/pythonforandroid/recipes/vispy/__init__.py b/pythonforandroid/recipes/vispy/__init__.py index a05576a768..fc41046bef 100644 --- a/pythonforandroid/recipes/vispy/__init__.py +++ b/pythonforandroid/recipes/vispy/__init__.py @@ -1,18 +1,10 @@ - from pythonforandroid.recipe import PythonRecipe class VispyRecipe(PythonRecipe): - # version = 'v0.4.0' - version = 'master' - url = 'https://github.com/vispy/vispy/archive/{version}.tar.gz' - # version = 'campagnola-scenegraph-update' - # url = 'https://github.com/campagnola/vispy/archive/scenegraph-update.zip' - # version = '???' - # url = 'https://github.com/inclement/vispy/archive/Eric89GXL-arcball.zip' - + version = '0.4.0' + url = 'https://github.com/vispy/vispy/archive/v{version}.tar.gz' depends = ['python2', 'numpy', 'pysdl2'] - patches = ['disable_freetype.patch', 'disable_font_triage.patch', 'use_es2.patch', diff --git a/testapps/setup_testapp_python2.py b/testapps/setup_testapp_python2.py index b54186f423..eabfaec40b 100644 --- a/testapps/setup_testapp_python2.py +++ b/testapps/setup_testapp_python2.py @@ -2,7 +2,7 @@ from distutils.core import setup from setuptools import find_packages -options = {'apk': {'debug': None, +options = {'apk': { 'requirements': 'sdl2,pyjnius,kivy,python2', 'android-api': 19, 'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2', diff --git a/testapps/setup_testapp_python3.py b/testapps/setup_testapp_python3.py index 530381d973..f5e09a22d3 100644 --- a/testapps/setup_testapp_python3.py +++ b/testapps/setup_testapp_python3.py @@ -2,7 +2,7 @@ from distutils.core import setup from setuptools import find_packages -options = {'apk': {'debug': None, +options = {'apk': { 'requirements': 'sdl2,pyjnius,kivy,python3crystax', 'android-api': 19, 'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2',