Add option to specify specific p4a commit to build with

This commit is contained in:
0xloem 2020-12-23 20:09:10 -05:00
parent 3e008a4609
commit cd380cc87b
2 changed files with 9 additions and 0 deletions

View file

@ -245,6 +245,9 @@ android.allow_backup = True
# (str) python-for-android branch to use, defaults to master
#p4a.branch = master
# (str) python-for-android specific commit to use, defaults to HEAD, must be within p4a.branch
#p4a.commit = HEAD
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#p4a.source_dir =

View file

@ -60,6 +60,7 @@ class TargetAndroid(Target):
p4a_directory_name = "python-for-android"
p4a_fork = 'kivy'
p4a_branch = 'master'
p4a_commit = 'HEAD'
p4a_apk_cmd = "apk --debug --bootstrap="
p4a_recommended_ndk_version = None
extra_p4a_args = ''
@ -691,6 +692,9 @@ class TargetAndroid(Target):
p4a_branch = self.buildozer.config.getdefault(
'app', 'p4a.branch', self.p4a_branch
)
p4a_commit = self.buildozer.config.getdefault(
'app', 'p4a.commit', self.p4a_commit
)
p4a_dir = self.p4a_dir
system_p4a_dir = self.buildozer.config.getdefault('app',
@ -744,6 +748,8 @@ class TargetAndroid(Target):
cmd('git fetch --tags origin {0}:{0}'.format(p4a_branch),
cwd=p4a_dir)
cmd('git checkout {}'.format(p4a_branch), cwd=p4a_dir)
if p4a_commit != 'HEAD':
cmd('git reset --hard {}'.format(p4a_commit), cwd=p4a_dir)
# also install dependencies (currently, only setup.py knows about it)
# let's extract them.