Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Akinwale Ariwodola 2018-09-25 19:07:28 +01:00
commit 4a1253e00a
11 changed files with 170 additions and 78 deletions

40
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,40 @@
<!--
The issue tracker is a tool to address bugs.
Please use the #kivy IRC channel on freenode or Stack Overflow for
support questions, more information at https://github.com/kivy/buildozer#support
Before opening a new issue, make sure you do the following:
* check that your issue isn't already filed: https://github.com/kivy/buildozer/issues
* prepare a short, runnable example that reproduces the issue
* make sure to have `log_level = 2` in your `buildozer.spec`
* reproduce the problem with the latest development version of Kivy
* double-check that the issue is indeed a bug and not a support request
-->
### Versions
* Python:
* OS:
* Kivy:
* Cython:
### Description
// REPLACE ME: What are you trying to get done, what has happened, what went wrong, and what did you expect?
### buildozer.spec
Command:
```sh
// REPLACE ME: buildozer command ran? e.g. buildozer android debug
```
Spec file:
```
// REPLACE ME: Paste your buildozer.spec file here
```
### Logs
```
// REPLACE ME: Paste the build ouput containing the error
```

55
Dockerfile Normal file
View file

@ -0,0 +1,55 @@
# Dockerfile for providing buildozer
# Build with:
# docker build --tag=buildozer .
# In order to give the container access to your current working directory
# it must be mounted using the --volume option.
# Run with (e.g. `buildozer --version`):
# docker run --volume "$(pwd)":/home/user/hostcwd buildozer --version
# Or for interactive shell:
# docker run --volume "$(pwd)":/home/user/hostcwd --entrypoint /bin/bash -it --rm buildozer
FROM ubuntu:18.04
ENV USER="user"
ENV HOME_DIR="/home/${USER}"
ENV WORK_DIR="${HOME_DIR}/hostcwd" \
PATH="${HOME_DIR}/.local/bin:${PATH}"
# configures locale
RUN apt update -qq > /dev/null && \
apt install -qq --yes --no-install-recommends \
locales && \
locale-gen en_US.UTF-8
ENV LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"
# installs system dependencies (required to setup all the tools)
RUN apt install -qq --yes --no-install-recommends \
sudo python-pip python-setuptools file
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-18-04-64bit
RUN dpkg --add-architecture i386 && apt update -qq > /dev/null && \
apt install -qq --yes --no-install-recommends \
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
# prepares non root env
RUN useradd --create-home --shell /bin/bash ${USER}
# with sudo access and no password
RUN usermod -append --groups sudo ${USER}
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER ${USER}
WORKDIR ${WORK_DIR}
# installs buildozer and dependencies
RUN pip install --user Cython==0.25.2 buildozer
# calling buildozer adb command should trigger SDK/NDK first install and update
# but it requires a buildozer.spec file
RUN cd /tmp/ && buildozer init && buildozer android adb -- version && cd -
# fixes source and target JDK version, refs https://github.com/kivy/buildozer/issues/625
RUN sed s/'name="java.source" value="1.5"'/'name="java.source" value="7"'/ -i ${HOME_DIR}/.buildozer/android/platform/android-sdk-20/tools/ant/build.xml
RUN sed s/'name="java.target" value="1.5"'/'name="java.target" value="7"'/ -i ${HOME_DIR}/.buildozer/android/platform/android-sdk-20/tools/ant/build.xml
ENTRYPOINT ["buildozer"]

View file

@ -14,15 +14,18 @@ project, and for iOS via the kivy-ios project. iOS and OSX are still under work.
For Android: please have a look at `Android-SDK-NDK-Informations
<https://github.com/kivy/kivy/wiki/Android-SDK-NDK-Informations>`_. Please note that
the default SDK/NDK coded in Buildozer works for Python 2.
the default SDK/NDK coded in Buildozer works for target Python 2.
For target Python 3 see `Installing Buildozer with target Python 3 (CrystaX)
<#installing-buildozer-with-target-python-3-crystax>`_.
For host Python, both versions are seamlessly supported.
We provide a ready-to-use `Virtual Machine for Virtualbox <https://kivy.org/#download>`_.
Note that this tool has nothing to do with the eponymous online build service
`buildozer.io <http://buildozer.io />`_.
Installing Buildozer with python2 support:
------------------------------------------
Installing Buildozer with target Python 2 (default):
----------------------------------------------------
#. Install buildozer::
@ -44,22 +47,13 @@ Installing Buildozer with python2 support:
# edit the buildozer.spec, then
buildozer android debug deploy run
Installing Buildozer with python3 support:
------------------------------------------
Installing Buildozer with target Python 3 (CrystaX):
----------------------------------------------------
The pip package does not yet support python3.
#. Install buildozer from source::
git clone https://github.com/kivy/buildozer
cd buildozer
python setup.py build
sudo pip install -e .
After following the steps above to install buildozer and generate the default spec file,
you need to setup Crystax NDK as described below.
#. Download and extract the Crystax NDK somewhere (~/.buildozer/crystax-ndk is one option): https://www.crystax.net/en/download
#. Go into your application directory and execute::
buildozer init
#. Make sure the following lines are in your buildozer.spec file.::
@ -73,7 +67,20 @@ The pip package does not yet support python3.
buildozer android debug deploy run
#. Please note the "android" buildozer target, and use that for any and all buildozer commands you run (even if the docs just say "android").
Buildozer Docker image
----------------------
A Dockerfile is available to use buildozer through a Docker environment.
#. Build with::
docker build --tag=buildozer .
#. Run with::
docker run --volume "$(pwd)":/home/user/hostcwd buildozer --version
Examples of Buildozer commands:

View file

@ -611,7 +611,8 @@ class Buildozer(object):
target = join(cwd, target)
self.debug('Rename {0} to {1}'.format(source, target))
if not os.path.isdir(os.path.dirname(target)):
self.error('Rename {0} to {1} fails becaues {2} is not a directory'.format(source, target, os.path.directory(target)))
self.error(('Rename {0} to {1} fails because {2} is not a '
'directory').format(source, target, target))
rename(source, target)
def file_copy(self, source, target, cwd=None):

View file

@ -146,6 +146,9 @@ fullscreen = 0
# bootstrap)
#android.gradle_dependencies =
# (list) Java classes to add as activities to the manifest.
#android.add_activites = com.example.ExampleActivity
# (str) python-for-android branch to use, defaults to stable
#p4a.branch = stable
@ -159,6 +162,9 @@ fullscreen = 0
# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =
# (str) launchMode to set for the main activity
#android.manifest.launch_mode = standard
# (list) Android additionnal libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so

View file

@ -255,7 +255,7 @@ class Version(_BaseVersion):
# Pre-release
if self._version.pre is not None:
parts.append("".join(str(x) for x in self._version.pre))
parts.append("-" + "".join(str(x) for x in self._version.pre))
# Post-release
if self._version.post is not None:

View file

@ -34,6 +34,7 @@ from shutil import copyfile
from glob import glob
from buildozer.libs.version import parse
from distutils.version import LooseVersion
class TargetAndroid(Target):
@ -722,6 +723,11 @@ class TargetAndroid(Target):
raise SystemError('Failed to find jar file: {}'.format(
pattern))
# add Java activity
add_activities = config.getlist('app', 'android.add_activities', [])
for activity in add_activities:
build_cmd += [("--add-activity", activity)]
# add presplash
presplash = config.getdefault('app', 'presplash.filename', '')
if presplash:
@ -771,6 +777,12 @@ class TargetAndroid(Target):
build_cmd += [("--intent-filters", join(self.buildozer.root_dir,
intent_filters))]
# activity launch mode
launch_mode = config.getdefault(
'app', 'android.manifest.launch_mode', '')
if launch_mode:
build_cmd += [("--activity-launch-mode", launch_mode)]
# build only in debug right now.
if self.build_mode == 'debug':
build_cmd += [("debug", )]
@ -789,10 +801,13 @@ class TargetAndroid(Target):
# maybe the hook fail because the apk is not
pass
# XXX found how the apk name is really built from the title
build_tools_versions = os.listdir(join(self.android_sdk_dir, "build-tools"))
build_tools_versions = sorted(build_tools_versions, key=LooseVersion)
build_tools_version = build_tools_versions[-1]
gradle_files = ["build.gradle", "gradle", "gradlew"]
is_gradle_build = any((
exists(join(dist_dir, x)) for x in gradle_files))
is_gradle_build = build_tools_version >= "25.0" and any(
(exists(join(dist_dir, x)) for x in gradle_files))
if is_gradle_build:
# on gradle build, the apk use the package name, and have no version
packagename = config.get('app', 'package.name')

View file

@ -27,7 +27,7 @@ class TargetAndroidNew(TargetAndroid):
'app', 'p4a.bootstrap', 'sdl2')
self.p4a_apk_cmd += self._p4a_bootstrap
color = 'always' if USE_COLOR else 'never'
self.extra_p4a_args = ' --color={} --storage-dir={}'.format(
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:
@ -48,7 +48,6 @@ class TargetAndroidNew(TargetAndroid):
def compile_platform(self):
app_requirements = self.buildozer.config.getlist(
'app', 'requirements', '')
onlyname = lambda x: x.split('==')[0]
dist_name = self.buildozer.config.get('app', 'package.name')
local_recipes = self.get_local_recipes_dir()
requirements = ','.join(app_requirements)

View file

@ -111,9 +111,6 @@ class TargetOSX(Target):
def build_package(self):
self.buildozer.info('Building package')
kivy_app_dir = join(
self.buildozer.platform_dir,
'kivy-sdk-packager-master', 'osx', 'Kivy.app')
bc = self.buildozer.config
bcg = bc.get
@ -121,28 +118,30 @@ class TargetOSX(Target):
package_name = bcg('app', 'package.name')
domain = bcg('app', 'package.domain')
title = bcg('app', 'title')
app_deps = bcgl('app', 'requirements', '')
garden_deps = bcgl('app', 'garden_requirements', '')
app_deps = open('requirements.txt').read()
icon = bc.getdefault('app', 'icon.filename', '')
version = self.buildozer.get_version()
author = bc.getdefault('app', 'author', '')
#print(title, package_name, domain, version,
# source_dir, app_deps, garden_deps, icon, author)
#return
self.buildozer.info('Create {}.app'.format(package_name))
cwd = join(self.buildozer.platform_dir,'kivy-sdk-packager-master', 'osx')
# remove kivy from app_deps
app_deps = ','.join(
[word for word in app_deps if 'kivy' not in word])
app_deps = [a for a in app_deps.split('\n') if not a.startswith('#') and a not in ['kivy', '']]
cmd = [
'Kivy.app/Contents/Resources/script',
'-m', 'pip', 'install',
]
cmd.extend(app_deps)
check_output(cmd, cwd=cwd)
cmd = [
'python', 'package_app.py', self.buildozer.app_dir,
'--appname={}'.format(package_name),
'--bundlename={}'.format(title),
'--bundleid={}'.format(domain),
'--bundleversion={}'.format(version),
#'--deps={}'.format(app_deps),
#'--deps={}'.format(','.join(app_deps)),
'--displayname={}'.format(title)
]
if icon:
@ -151,6 +150,7 @@ class TargetOSX(Target):
cmd.append('--author={}'.format(author))
check_output(cmd, cwd=cwd)
self.buildozer.info('{}.app created.'.format(package_name))
self.buildozer.info('Creating {}.dmg'.format(package_name))
check_output(
@ -264,3 +264,4 @@ class TargetOSX(Target):
def get_target(buildozer):
return TargetOSX(buildozer)

View file

@ -11,7 +11,3 @@ apt-get -y install lib32stdc++6 lib32z1 lib32ncurses5
apt-get -y install build-essential
apt-get -y install git openjdk-8-jdk --no-install-recommends zlib1g-dev
pip install cython buildozer python-for-android
# latest sh is too slow, use a previous working version
# CF https://github.com/amoffat/sh/issues/378
pip install sh\<1.12.5

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 18.04 (64bit)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
sudo pip install --upgrade cython==0.21
sudo dpkg --add-architecture i386
sudo apt update
sudo apt 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 16.04 (64bit)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -26,41 +36,3 @@ Android on Ubuntu 16.04 (64bit)
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)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
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-7-jdk unzip zlib1g-dev zlib1g:i386
Android on Ubuntu 14.10 (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 lib32stdc++6 lib32z1 lib32z1-dev python2.7 python2.7-dev openjdk-7-jdk unzip zlib1g-dev zlib1g:i386
Android on Ubuntu 13.10 (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 lib32z1 lib32bz2-1.0 libncurses5:i386 libstdc++6:i386 python2.7 python2.7-dev openjdk-7-jdk unzip zlib1g-dev zlib1g:i386
Android on Ubuntu 12.04 (64bit)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
::
sudo pip install --upgrade cython==0.21
sudo apt-get install build-essential ccache git lib32z1 lib32bz2-1.0 libncurses5:i386 libstdc++6:i386 python2.7 python2.7-dev openjdk-7-jdk unzip zlib1g-dev zlib1g:i386