resolve conflicts

This commit is contained in:
Robert Niederreiter 2017-03-21 17:32:23 +01:00
commit c6061bdfc0
7 changed files with 55 additions and 23 deletions

4
.gitignore vendored
View file

@ -14,6 +14,7 @@ var
sdist
develop-eggs
.installed.cfg
.idea
# Installer logs
pip-log.txt
@ -29,6 +30,8 @@ pip-log.txt
.mr.developer.cfg
MANIFEST
release\.log\.utf-8\.tmp
# Eclipse
.project
.pydevproject
@ -36,3 +39,4 @@ MANIFEST
# Custom virtualenv location
venv

View file

@ -627,10 +627,7 @@ class Buildozer(object):
return
if archive.endswith('.zip'):
archive = join(cwd, archive)
zf = zipfile.ZipFile(archive)
zf.extractall(path=cwd)
zf.close()
self.cmd('unzip {}'.format(join(cwd, archive)), cwd=cwd)
return
raise Exception('Unhandled extraction for type {0}'.format(archive))
@ -826,9 +823,9 @@ class Buildozer(object):
#self.error('Unable to patch main_py to add applibs directory.')
return
header = ('import sys, os; '
'sys.path = [os.path.join(os.getcwd(),'
'"..", "_applibs")] + sys.path\n')
header = (b'import sys, os; '
b'sys.path = [os.path.join(os.getcwd(),'
b'"..", "_applibs")] + sys.path\n')
with open(main_py, 'rb') as fd:
data = fd.read()
data = header + data

View file

@ -109,7 +109,10 @@ fullscreen = 1
#android.p4a_dir =
# (str) The directory in which python-for-android should look for your own build recipes (if any)
#p4a.local_recipes =
#p4a.local_recipes =
# (str) Filename to the hook for p4a
#p4a.hook =
# (list) python-for-android whitelist
#android.p4a_whitelist =
@ -172,6 +175,9 @@ fullscreen = 1
# (bool) Copy library instead of making a libpymodules.so
#android.copy_libs = 1
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
android.arch = armeabi-v7a
#
# iOS specific
#

View file

@ -1,11 +1,12 @@
from sys import exit
def no_config(f):
f.__no_config = True
return f
class Target(object):
class Target(object):
def __init__(self, buildozer):
super(Target, self).__init__()
self.buildozer = buildozer

View file

@ -604,6 +604,11 @@ class TargetAndroid(Target):
def get_dist_dir(self, dist_name):
return join(self.pa_dir, 'dist', dist_name)
@property
def dist_dir(self):
dist_name = self.buildozer.config.get('app', 'package.name')
return self.get_dist_dir(dist_name)
def execute_build_package(self, build_cmd):
dist_name = self.buildozer.config.get('app', 'package.name')
cmd = [self.p4a_apk_cmd]
@ -750,6 +755,14 @@ class TargetAndroid(Target):
self.execute_build_package(build_cmd)
try:
self.buildozer.hook("android_pre_build_apk")
self.execute_build_package(build_cmd)
self.buildozer.hook("android_post_build_apk")
except:
# maybe the hook fail because the apk is not
pass
# XXX found how the apk name is really built from the title
bl = u'\'" ,'
apptitle = config.get('app', 'title')
@ -807,11 +820,7 @@ class TargetAndroid(Target):
# recreate the project.properties
with io.open(project_fn, 'w', encoding='utf-8') as fd:
for line in content:
if IS_PY3:
fd.write(line)
else:
fd.write(line.decode('utf-8'))
fd.writelines(content)
for index, ref in enumerate(references):
fd.write(u'android.library.reference.{}={}\n'.format(index + 1,
ref))
@ -930,3 +939,4 @@ class TargetAndroid(Target):
def get_target(buildozer):
return TargetAndroid(buildozer)

View file

@ -4,6 +4,7 @@ Android target, based on python-for-android project (new toolchain)
'''
import sys
import buildozer
from buildozer.targets.android import TargetAndroid
from buildozer import USE_COLOR
from os.path import join, expanduser, realpath
@ -13,19 +14,22 @@ class TargetAndroidNew(TargetAndroid):
targetname = 'android_new'
p4a_branch = "master"
p4a_directory = "python-for-android-master"
p4a_apk_cmd = "apk --bootstrap="
p4a_apk_cmd = "apk --debug --bootstrap="
extra_p4a_args = ''
def __init__(self, buildozer):
super(TargetAndroidNew, self).__init__(buildozer)
self._build_dir = join(self.buildozer.platform_dir, 'build')
self._p4a_cmd = ('python -m pythonforandroid.toolchain ')
self._p4a_cmd = 'python -m pythonforandroid.toolchain '
self._p4a_bootstrap = self.buildozer.config.getdefault(
'app', 'android.bootstrap', 'sdl2')
self.p4a_apk_cmd += self._p4a_bootstrap
color = 'always' if USE_COLOR else 'never'
self.extra_p4a_args = ' --color={} --storage-dir={}'.format(
color, self._build_dir)
hook = self.buildozer.config.getdefault("app", "p4a.hook", None)
if hook is not None:
self.extra_p4a_args += ' --hook={}'.format(realpath(hook))
def _p4a(self, cmd, **kwargs):
if not hasattr(self, "pa_dir"):
@ -63,14 +67,11 @@ class TargetAndroidNew(TargetAndroid):
options.append('--local-recipes')
options.append(local_recipes)
available_modules = self._p4a(
"create --dist_name={} --bootstrap={} --requirements={} --arch armeabi-v7a {}".format(
dist_name, self._p4a_bootstrap, requirements, " ".join(options)),
"create --dist_name={} --bootstrap={} --requirements={} --arch {} {}".format(
dist_name, self._p4a_bootstrap, requirements,
self.buildozer.config.getdefault('app', 'android.arch', "armeabi-v7a"), " ".join(options)),
get_stdout=True)[0]
def _update_libraries_references(self, dist_dir):
# UNSUPPORTED YET
pass
def get_dist_dir(self, dist_name):
return join(self._build_dir, 'dists', dist_name)
@ -89,6 +90,7 @@ class TargetAndroidNew(TargetAndroid):
continue
elif option == "release":
cmd.append("--release")
cmd.append("--sign")
continue
if option == "--window":
cmd.append("--window")
@ -129,6 +131,9 @@ class TargetAndroidNew(TargetAndroid):
cmd.append('--blacklist')
cmd.append(realpath(blacklist_src))
cmd.append('--arch')
cmd.append(self.buildozer.config.getdefault('app', 'android.arch', "armeabi-v7a"))
cmd = " ".join(cmd)
self._p4a(cmd)

View file

@ -17,6 +17,16 @@ If you target Android, you must install at least Cython, few build libs, and a
Java SDK. Some binaries of the Android SDK are still in 32 bits, so you need
few 32bits libraries available:
Android on Ubuntu 16.04 (64bit)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
sudo pip install --upgrade cython==0.21
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-8-jdk unzip zlib1g-dev zlib1g:i386
Android on Ubuntu 15.10 (64bit)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -27,7 +37,6 @@ Android on Ubuntu 15.10 (64bit)
sudo apt-get update
sudo apt-get install build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev openjdk-7-jdk unzip zlib1g-dev zlib1g:i386
Android on Ubuntu 14.10 (64bit)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~