Skip to content

Commit 45c26bd

Browse files
authored
Merge pull request kivy#1282 from AndreMiras/feature/ticket1263_setuptools_python2_and_hostpython3crystax
Builds setuptools with both python2 & hostpython3crystax
2 parents f71d8d7 + d76036d commit 45c26bd

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

.travis.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ before_install:
99
- docker build --tag=p4a .
1010

1111
env:
12-
- COMMAND='uname -a'
13-
- COMMAND='. venv/bin/activate && p4a apk --help'
1412
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk'
1513
# overrides requirements to skip `peewee` pure python module, see:
1614
# https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054
17-
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3'
15+
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3,setuptools'
1816
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/crystax-ndk'
17+
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/crystax-ndk --requirements python3crystax,setuptools,android'
1918

2019
script:
2120
- docker run p4a /bin/sh -c "$COMMAND"

pythonforandroid/recipe.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,10 @@ def real_hostpython_location(self):
732732
return join(
733733
Recipe.get_recipe('hostpython2', self.ctx).get_build_dir(),
734734
'hostpython')
735+
elif 'hostpython3crystax' in self.ctx.recipe_build_order:
736+
return join(
737+
Recipe.get_recipe('hostpython3crystax', self.ctx).get_build_dir(),
738+
'hostpython')
735739
else:
736740
python_recipe = self.ctx.python_recipe
737741
return 'python{}'.format(python_recipe.version)
Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
2-
from pythonforandroid.toolchain import Recipe, shprint, current_directory, info, warning
3-
from os.path import join, exists
4-
from os import chdir
1+
from pythonforandroid.toolchain import Recipe, shprint
2+
from os.path import join
53
import sh
64

75

@@ -13,14 +11,33 @@ class Hostpython3Recipe(Recipe):
1311

1412
conflicts = ['hostpython2']
1513

14+
def get_build_container_dir(self, arch=None):
15+
choices = self.check_recipe_choices()
16+
dir_name = '-'.join([self.name] + choices)
17+
return join(self.ctx.build_dir, 'other_builds', dir_name, 'desktop')
18+
1619
# def prebuild_armeabi(self):
1720
# # Override hostpython Setup?
1821
# shprint(sh.cp, join(self.get_recipe_dir(), 'Setup'),
1922
# join(self.get_build_dir('armeabi'), 'Modules', 'Setup'))
2023

24+
def get_build_dir(self, arch=None):
25+
return join(self.get_build_container_dir(), self.name)
26+
2127
def build_arch(self, arch):
28+
"""
29+
Creates expected build and symlinks system Python version.
30+
"""
2231
self.ctx.hostpython = '/usr/bin/false'
2332
self.ctx.hostpgen = '/usr/bin/false'
33+
# creates the sub buildir (used by other recipes)
34+
# https://github.com/kivy/python-for-android/issues/1154
35+
sub_build_dir = join(self.get_build_dir(), 'build')
36+
shprint(sh.mkdir, '-p', sub_build_dir)
37+
python3crystax = self.get_recipe('python3crystax', self.ctx)
38+
system_python = sh.which("python" + python3crystax.version)
39+
link_dest = join(self.get_build_dir(), 'hostpython')
40+
shprint(sh.ln, '-sf', system_python, link_dest)
2441

2542

2643
recipe = Hostpython3Recipe()

0 commit comments

Comments
 (0)