Skip to content

Commit 0092491

Browse files
authored
Merge pull request #1435 from AndreMiras/feature/conditional_build_python2_fallback
Conditional builds falls back on Python2 if needed
2 parents cf6164d + d563fcf commit 0092491

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

ci/rebuild_updated_recipes.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
"""
2626
import sh
2727
import os
28+
from pythonforandroid.build import Context
29+
from pythonforandroid.graph import get_recipe_order_and_bootstrap
2830
from pythonforandroid.toolchain import current_directory
2931
from ci.constants import TargetPython, CORE_RECIPES, BROKEN_RECIPES
3032

@@ -77,11 +79,21 @@ def main():
7779
target_python = TargetPython.python3crystax
7880
recipes = modified_recipes()
7981
print('recipes modified:', recipes)
80-
broken_recipes = BROKEN_RECIPES[target_python]
81-
recipes = recipes - (CORE_RECIPES | broken_recipes)
82+
recipes -= CORE_RECIPES
8283
print('recipes to build:', recipes)
84+
context = Context()
85+
build_order, python_modules, bs = get_recipe_order_and_bootstrap(
86+
context, recipes, None)
87+
# fallback to python2 if default target is not compatible
88+
if target_python.name not in build_order:
89+
print('incompatible with {}'.format(target_python.name))
90+
target_python = TargetPython.python2
91+
print('falling back to {}'.format(target_python.name))
92+
# removing the known broken recipe for the given target
93+
broken_recipes = BROKEN_RECIPES[target_python]
94+
recipes -= broken_recipes
95+
print('recipes to build (no broken):', recipes)
8396
build(target_python, recipes)
84-
print(recipes)
8597

8698

8799
if __name__ == '__main__':

pythonforandroid/recipes/vispy/__init__.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
21
from pythonforandroid.recipe import PythonRecipe
32

43

54
class VispyRecipe(PythonRecipe):
6-
# version = 'v0.4.0'
7-
version = 'master'
8-
url = 'https://github.com/vispy/vispy/archive/{version}.tar.gz'
9-
# version = 'campagnola-scenegraph-update'
10-
# url = 'https://github.com/campagnola/vispy/archive/scenegraph-update.zip'
11-
# version = '???'
12-
# url = 'https://github.com/inclement/vispy/archive/Eric89GXL-arcball.zip'
13-
5+
version = '0.4.0'
6+
url = 'https://github.com/vispy/vispy/archive/v{version}.tar.gz'
147
depends = ['python2', 'numpy', 'pysdl2']
15-
168
patches = ['disable_freetype.patch',
179
'disable_font_triage.patch',
1810
'use_es2.patch',

testapps/setup_testapp_python2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from distutils.core import setup
33
from setuptools import find_packages
44

5-
options = {'apk': {'debug': None,
5+
options = {'apk': {
66
'requirements': 'sdl2,pyjnius,kivy,python2',
77
'android-api': 19,
88
'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2',

testapps/setup_testapp_python3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from distutils.core import setup
33
from setuptools import find_packages
44

5-
options = {'apk': {'debug': None,
5+
options = {'apk': {
66
'requirements': 'sdl2,pyjnius,kivy,python3crystax',
77
'android-api': 19,
88
'ndk-dir': '/home/asandy/android/crystax-ndk-10.3.2',

0 commit comments

Comments
 (0)