From ef5e5865fc15c4d724485b76848b874d79a2c9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20Meza=20Cabrera?= Date: Sat, 31 Mar 2018 13:19:14 -0600 Subject: [PATCH 001/218] Fixes https://github.com/kivy/buildozer/issues/644 --- buildozer/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 3bbc2e3..d11007a 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -20,9 +20,9 @@ from sys import stdout, stderr, exit from re import search from os.path import join, exists, dirname, realpath, splitext, expanduser from subprocess import Popen, PIPE -from os import environ, unlink, rename, walk, sep, listdir, makedirs +from os import environ, unlink, walk, sep, listdir, makedirs from copy import copy -from shutil import copyfile, rmtree, copytree +from shutil import copyfile, rmtree, copytree, move from fnmatch import fnmatch try: from urllib.request import FancyURLopener @@ -612,7 +612,7 @@ class Buildozer(object): 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))) - rename(source, target) + move(source, target) def file_copy(self, source, target, cwd=None): if cwd: From f2e6c19e816670054e63163f64896d73231695eb Mon Sep 17 00:00:00 2001 From: Richard Larkin Date: Mon, 8 Oct 2018 09:52:51 +0200 Subject: [PATCH 002/218] Various spelling corrections --- buildozer/__init__.py | 2 +- buildozer/default.spec | 4 ++-- buildozer/libs/version.py | 4 ++-- buildozer/targets/android.py | 2 +- buildozer/tools/packer/http/welcome/index.html | 4 ++-- docs/source/contribute.rst | 2 +- docs/source/quickstart.rst | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index cb21074..b546800 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -1177,7 +1177,7 @@ class Buildozer(object): def _get_config_list(self, section, token, default=None, with_values=False): # monkey-patch method for ConfigParser - # get a key as a list of string, seperated from the comma + # get a key as a list of string, separated from the comma # check if an env var exists that should replace the file config set_config_token_from_env(section, token, self.config) diff --git a/buildozer/default.spec b/buildozer/default.spec index 611016f..a62d279 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -35,7 +35,7 @@ version = 0.1 # version.filename = %(source.dir)s/main.py # (list) Application requirements -# comma seperated e.g. requirements = sqlite3,kivy +# comma separated e.g. requirements = sqlite3,kivy requirements = kivy # (str) Custom source folders for requirements @@ -165,7 +165,7 @@ fullscreen = 0 # (str) launchMode to set for the main activity #android.manifest.launch_mode = standard -# (list) Android additionnal libraries to copy into libs/armeabi +# (list) Android additional libraries to copy into libs/armeabi #android.add_libs_armeabi = libs/android/*.so #android.add_libs_armeabi_v7a = libs/android-v7/*.so #android.add_libs_x86 = libs/android-x86/*.so diff --git a/buildozer/libs/version.py b/buildozer/libs/version.py index bf155d6..a7ec64a 100644 --- a/buildozer/libs/version.py +++ b/buildozer/libs/version.py @@ -334,7 +334,7 @@ def _parse_letter_version(letter, number): return letter, int(number) -_local_version_seperators = re.compile(r"[\._-]") +_local_version_separators = re.compile(r"[\._-]") def _parse_local_version(local): @@ -344,7 +344,7 @@ def _parse_local_version(local): if local is not None: return tuple( part.lower() if not part.isdigit() else int(part) - for part in _local_version_seperators.split(local) + for part in _local_version_separators.split(local) ) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index c7654f3..fc123b3 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -421,7 +421,7 @@ class TargetAndroid(Target): ver = self._find_latest_package(packages, 'build-tools-') if ver and ver > v_build_tools and not skip_upd: self._android_update_sdk(self._build_package_string('build-tools', ver)) - # 2.bis check aidl can be runned + # 2. check aidl can be run self._check_aidl(v_build_tools) # 3. finally, install the android for the current api diff --git a/buildozer/tools/packer/http/welcome/index.html b/buildozer/tools/packer/http/welcome/index.html index 394acb3..22dcd56 100644 --- a/buildozer/tools/packer/http/welcome/index.html +++ b/buildozer/tools/packer/http/welcome/index.html @@ -25,7 +25,7 @@ download the Android SDK/NDK (automatically done), and during the first compilation.
- It is preferrable to add a share a folder + It is preferable to add a share a folder between your host and the VM, then build from there.
By the time we shipped the VM and you using it, you may need to @@ -83,7 +83,7 @@ build_dir = /build/buildozer-myapp

Update buildozer

The buildozer version you have may be outdated, as well as the dependencies. - The best is to regulary update buildozer: + The best is to regularly update buildozer:

sudo pip install -U buildozer

diff --git a/docs/source/contribute.rst b/docs/source/contribute.rst index de2802d..f3c7575 100644 --- a/docs/source/contribute.rst +++ b/docs/source/contribute.rst @@ -7,7 +7,7 @@ Write your own recipe A recipe allows you to compile libraries / python extension for the mobile. Most of the time, the default compilation instructions doesn't work for the -target, as ARM compiler / Android NDK introduce specifities that the library +target, as ARM compiler / Android NDK introduce specificities that the library you want doesn't handle correctly, and you'll need to patch. Also, because the Android platform cannot load more than 64 inline dynamic libraries, we have a mechanism to bundle all of them in one to ensure you'll not hit this diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 527f088..dde5607 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -8,7 +8,7 @@ Init and build for Android #. Buildozer will try to guess the version of your application, by searching a line like `__version__ = "1.0.3"` in your `main.py`. Ensure you have one at - the start of your application. It is not mandatory but heavilly advised. + the start of your application. It is not mandatory but heavily advised. #. Create a `buildozer.spec` file, with:: @@ -26,7 +26,7 @@ Init and build for Android The first build will be slow, as it will download the Android SDK, NDK, and others tools needed for the compilation. Don't worry, thoses files will be saved in a global directory and will be - shared accross the different project you'll manage with Buildozer. + shared across the different project you'll manage with Buildozer. #. At the end, you should have an APK file in the `bin/` directory. From a63979279fb9c21276830dba012a3d35d5c90a7e Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Thu, 18 Oct 2018 20:41:32 +0100 Subject: [PATCH 003/218] Improved error handling if p4a setup.py can't be read --- buildozer/targets/android.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index fc123b3..f335f36 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -523,8 +523,10 @@ class TargetAndroid(Target): setup = fd.read() deps = re.findall("install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[1] deps = ast.literal_eval(deps) - except Exception: - deps = [] + except IOError: + self.buildozer.error('Failed to read python-for-android setup.py at {}'.format( + join(self.pa_dir, 'setup.py'))) + exit(1) pip_deps = [] for dep in deps: pip_deps.append('"{}"'.format(dep)) From 10a3915c677fc23f2c1028812a3e26af1b9c203b Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Sat, 20 Oct 2018 11:53:50 +0200 Subject: [PATCH 004/218] Updates p4a deps parsing Now deals with conditional statements introduced in: https://github.com/kivy/python-for-android/pull/1418 --- buildozer/targets/android.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index fc123b3..7698ac7 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -521,13 +521,13 @@ class TargetAndroid(Target): try: with open(join(self.pa_dir, "setup.py")) as fd: setup = fd.read() - deps = re.findall("install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[1] + deps = re.findall("^install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0] deps = ast.literal_eval(deps) except Exception: deps = [] pip_deps = [] for dep in deps: - pip_deps.append('"{}"'.format(dep)) + pip_deps.append("'{}'".format(dep)) # in virtualenv or conda env options = "--user" From fec6610fbd442c43163d3a8c90d8bbd82ae3fdbc Mon Sep 17 00:00:00 2001 From: Armin Sebastian Date: Wed, 24 Oct 2018 11:27:03 +0300 Subject: [PATCH 005/218] Enable Support app --- .github/.support.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/.support.yml diff --git a/.github/.support.yml b/.github/.support.yml new file mode 100644 index 0000000..9958e6f --- /dev/null +++ b/.github/.support.yml @@ -0,0 +1,19 @@ +# Configuration for support-requests - https://github.com/dessant/support-requests + +# Label used to mark issues as support requests +supportLabel: support +# Comment to post on issues marked as support requests. Add a link +# to a support page, or set to `false` to disable +supportComment: > + :wave: @{issue-author}, we use the issue tracker exclusively for bug reports + and feature requests. However, this issue appears to be a support request. + Please use our [support channels](https://github.com/kivy/buildozer#support) + to get help with the project. + + + Let us know if this comment was made in error, and we'll be happy + to reopen the issue. +# Whether to close issues marked as support requests +close: true +# Whether to lock issues marked as support requests +lock: false From 862f7f43770bfb2c73521fb7cb97025e1d456a7b Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Wed, 24 Oct 2018 10:37:07 +0200 Subject: [PATCH 006/218] Bump to 0.35 --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 3d7146a..400a955 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -6,7 +6,7 @@ Generic Python packager for Android / iOS. Desktop later. ''' -__version__ = '0.35dev' +__version__ = '0.35' import os import re From 52ece9ba0f6f3d81705c6441c1200ead2e60c40b Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Wed, 24 Oct 2018 10:37:11 +0200 Subject: [PATCH 007/218] Bump to 0.36.dev0 --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 400a955..aa4b440 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -6,7 +6,7 @@ Generic Python packager for Android / iOS. Desktop later. ''' -__version__ = '0.35' +__version__ = '0.36.dev0' import os import re From 01a4d92ea5d32bcdb5aa6b09b994f65de321b5f9 Mon Sep 17 00:00:00 2001 From: Armin Sebastian Date: Wed, 24 Oct 2018 11:37:51 +0300 Subject: [PATCH 008/218] Fix Support config file name --- .github/{.support.yml => support.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{.support.yml => support.yml} (100%) diff --git a/.github/.support.yml b/.github/support.yml similarity index 100% rename from .github/.support.yml rename to .github/support.yml From e4182fea1c35982e6f84c3c030f20c7bfdc43b08 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Wed, 24 Oct 2018 10:49:04 +0200 Subject: [PATCH 009/218] update changelog --- CHANGELOG.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbe0ac8..a53f46e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,81 @@ # Change Log +## [0.35](https://github.com/kivy/buildozer/tree/0.35) (2018-10-24) +[Full Changelog](https://github.com/kivy/buildozer/compare/0.34...0.35) + +**Fixed bugs:** + +- Buildozer should not regex/hack install\_reqs [\#722](https://github.com/kivy/buildozer/issues/722) + +**Closed issues:** + +- Command failed: /usr/bin/python -m pythonforandroid.toolchain create... [\#727](https://github.com/kivy/buildozer/issues/727) +- buildozer fails at installing platfrom [\#726](https://github.com/kivy/buildozer/issues/726) +- Unable to build APK [\#725](https://github.com/kivy/buildozer/issues/725) +- Buildozer APK not working: OS X, Docker, or fresh Ubuntu 16.04 [\#723](https://github.com/kivy/buildozer/issues/723) +- gcc Segmentation Fault [\#720](https://github.com/kivy/buildozer/issues/720) +- Error debugging for android [\#719](https://github.com/kivy/buildozer/issues/719) +- ndk\_platform doesn't exist \(when switching to API = 28\) [\#717](https://github.com/kivy/buildozer/issues/717) +- FileNotFoundError: \[Errno 2\] \(SOLVED\) - It was Encoding Error [\#715](https://github.com/kivy/buildozer/issues/715) +- SDL\_JAVA\_PACKAGE\_PATH error? [\#714](https://github.com/kivy/buildozer/issues/714) +- Python3Crystax instructions in README [\#710](https://github.com/kivy/buildozer/issues/710) +- Bug or support request? [\#708](https://github.com/kivy/buildozer/issues/708) +- build requirement failed [\#701](https://github.com/kivy/buildozer/issues/701) +- I am using Virtual Machine provided in the official kivy website for building android APK, this is the part of log file [\#696](https://github.com/kivy/buildozer/issues/696) +- App minimizes instantly after launching. [\#695](https://github.com/kivy/buildozer/issues/695) +- Aidl not detected [\#694](https://github.com/kivy/buildozer/issues/694) +- python 3 ssl [\#690](https://github.com/kivy/buildozer/issues/690) +- Is there something like multiprocessing? [\#685](https://github.com/kivy/buildozer/issues/685) +- Kivy in pyCharm [\#682](https://github.com/kivy/buildozer/issues/682) +- Toolchain error. Help,please! [\#678](https://github.com/kivy/buildozer/issues/678) +- virtual machine does not compile apk Fails with errors [\#677](https://github.com/kivy/buildozer/issues/677) +- An error in Buildozer Apk \(Python Kivy\) Help PLZ! [\#676](https://github.com/kivy/buildozer/issues/676) +- App crashes on android but works fine in idle window using buildozer [\#675](https://github.com/kivy/buildozer/issues/675) +- Pyjnius exception Adbuddiz class not found [\#661](https://github.com/kivy/buildozer/issues/661) +- Buildozer failed to execute the last command \#/usr/bin/python3 -m pythonforandroid.toolchain create --dist\_name=blueb --bootstrap=sdl2 --requirements=python3crystax,kivy --arch x86 --copy-libs --color=always --storage-dir=/home/jp/Desktop/BlueB/.buildozer/android/platform/build [\#654](https://github.com/kivy/buildozer/issues/654) +- java.lang.ClassNotFoundException: sun.misc.BASE64Encoder [\#639](https://github.com/kivy/buildozer/issues/639) +- IOError: \[Errno 2\] No such file or directory: [\#636](https://github.com/kivy/buildozer/issues/636) +- App crashes with aws boto3 [\#635](https://github.com/kivy/buildozer/issues/635) +- APK Immediately Closes After Opening in Debug, Release, and Zipaligned & Signed Versions [\#629](https://github.com/kivy/buildozer/issues/629) +- Using Python/Buildozer to compile Kivy for Android [\#628](https://github.com/kivy/buildozer/issues/628) +- "configure: error: C compiler cannot create executables See `config.log' for more details" \(\# Command failed: ./distribute.sh -m "kivy" -d "pollygot"\) [\#627](https://github.com/kivy/buildozer/issues/627) +- "OSError: \[Errno 30\] Read-only file system" \(\# Command failed: virtualenv --python=python2.7 ./venv\) [\#626](https://github.com/kivy/buildozer/issues/626) +- Java compiling issue: buildozer uses obsolete source value 1.5 [\#619](https://github.com/kivy/buildozer/issues/619) +- Cloning into 'python-for-android-new-toolchain'... [\#618](https://github.com/kivy/buildozer/issues/618) +- Failed to build application: 'WindowInfoX11' is not a type identifier [\#616](https://github.com/kivy/buildozer/issues/616) +- Sudo issue\[closed\] [\#615](https://github.com/kivy/buildozer/issues/615) +- buildozer-vm-2 installed from scratch ABENDS [\#611](https://github.com/kivy/buildozer/issues/611) +- ASCII decode problem [\#608](https://github.com/kivy/buildozer/issues/608) +- error: could not delete 'build/lib.linux-x86\_64-2.7/buildozer/targets/android.py': Permission denied [\#607](https://github.com/kivy/buildozer/issues/607) +- APK Build Failing with Python 3.6 [\#605](https://github.com/kivy/buildozer/issues/605) +- IOError: \[Errno 2\] No such file or directory: u'/home/kivy/buildozer/.buildozer/android/platform/build/... [\#603](https://github.com/kivy/buildozer/issues/603) +- Feature Request: Dockerfile or image in dockerhub [\#589](https://github.com/kivy/buildozer/issues/589) +- Buildozer debug error. [\#545](https://github.com/kivy/buildozer/issues/545) + +**Merged pull requests:** + +- Fix \#645 [\#729](https://github.com/kivy/buildozer/pull/729) ([tito](https://github.com/tito)) +- Enable Support app [\#728](https://github.com/kivy/buildozer/pull/728) ([dessant](https://github.com/dessant)) +- Updates p4a deps parsing [\#724](https://github.com/kivy/buildozer/pull/724) ([AndreMiras](https://github.com/AndreMiras)) +- Improved error handling if p4a setup.py can't be read [\#721](https://github.com/kivy/buildozer/pull/721) ([inclement](https://github.com/inclement)) +- Various spelling corrections [\#718](https://github.com/kivy/buildozer/pull/718) ([Zen-CODE](https://github.com/Zen-CODE)) +- Updates Python 3 install instructions, fixes \#710 [\#711](https://github.com/kivy/buildozer/pull/711) ([AndreMiras](https://github.com/AndreMiras)) +- Remove obsolete sh package dependency [\#705](https://github.com/kivy/buildozer/pull/705) ([Cheaterman](https://github.com/Cheaterman)) +- Changes how is\_gradle\_build is detected. [\#700](https://github.com/kivy/buildozer/pull/700) ([rammie](https://github.com/rammie)) +- Cleans installation docs [\#689](https://github.com/kivy/buildozer/pull/689) ([AndreMiras](https://github.com/AndreMiras)) +- Adds issue template with basic required info [\#688](https://github.com/kivy/buildozer/pull/688) ([AndreMiras](https://github.com/AndreMiras)) +- buildozer Dockerfile, fixes \#589 [\#681](https://github.com/kivy/buildozer/pull/681) ([AndreMiras](https://github.com/AndreMiras)) +- Removes few unused variables [\#680](https://github.com/kivy/buildozer/pull/680) ([AndreMiras](https://github.com/AndreMiras)) +- Fixed a typo pointed out by AndreMiras [\#664](https://github.com/kivy/buildozer/pull/664) ([inclement](https://github.com/inclement)) +- Updates installation.rst with Ubuntu 18.04 instructions [\#657](https://github.com/kivy/buildozer/pull/657) ([AndreMiras](https://github.com/AndreMiras)) +- fix prerelease version [\#653](https://github.com/kivy/buildozer/pull/653) ([marceloneil](https://github.com/marceloneil)) +- allow setting launchMode for the main activity in the manifest [\#650](https://github.com/kivy/buildozer/pull/650) ([SomberNight](https://github.com/SomberNight)) +- Fixes Invalid cross-device link [\#645](https://github.com/kivy/buildozer/pull/645) ([robertpro](https://github.com/robertpro)) +- Quote --storage-dir value [\#630](https://github.com/kivy/buildozer/pull/630) ([ghost](https://github.com/ghost)) +- Allow adding Java activities to the manifest [\#612](https://github.com/kivy/buildozer/pull/612) ([bauerj](https://github.com/bauerj)) +- add comment re p4a.port in default.spec [\#600](https://github.com/kivy/buildozer/pull/600) ([replabrobin](https://github.com/replabrobin)) +- Spelling [\#592](https://github.com/kivy/buildozer/pull/592) ([jsoref](https://github.com/jsoref)) + ## [0.34](https://github.com/kivy/buildozer/tree/0.34) (2017-12-15) [Full Changelog](https://github.com/kivy/buildozer/compare/0.33...0.34) @@ -619,4 +695,4 @@ ## [0.2](https://github.com/kivy/buildozer/tree/0.2) (2012-12-20) -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* From 0e1c1263fd5c2588e791a5f5afaf368bae6d89fb Mon Sep 17 00:00:00 2001 From: David Brooks Date: Tue, 30 Oct 2018 12:34:37 +1300 Subject: [PATCH 010/218] Allow for `install_reqs` line starting with whitespace. --- buildozer/targets/android.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 0f4090f..2ae8272 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -521,7 +521,7 @@ class TargetAndroid(Target): try: with open(join(self.pa_dir, "setup.py")) as fd: setup = fd.read() - deps = re.findall("^install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0] + deps = re.findall("^\*install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0] deps = ast.literal_eval(deps) except IOError: self.buildozer.error('Failed to read python-for-android setup.py at {}'.format( From 8abcf26fbb57cab629572b6297bdd678bc3b79cc Mon Sep 17 00:00:00 2001 From: David Brooks Date: Tue, 30 Oct 2018 12:41:23 +1300 Subject: [PATCH 011/218] Fix typo... --- buildozer/targets/android.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 2ae8272..088ad35 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -521,7 +521,7 @@ class TargetAndroid(Target): try: with open(join(self.pa_dir, "setup.py")) as fd: setup = fd.read() - deps = re.findall("^\*install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0] + deps = re.findall("^\s*install_reqs = (\[[^\]]*\])", setup, re.DOTALL | re.MULTILINE)[0] deps = ast.literal_eval(deps) except IOError: self.buildozer.error('Failed to read python-for-android setup.py at {}'.format( From 4f4d8eb4e50494d48eea4d276da58a210ade84e3 Mon Sep 17 00:00:00 2001 From: Gabriel Pettier Date: Tue, 6 Nov 2018 01:05:36 +0100 Subject: [PATCH 012/218] workaround for working in WSL --- buildozer/targets/android.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 088ad35..da51d55 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -11,6 +11,9 @@ import sys if sys.platform == 'win32': raise NotImplementedError('Windows platform not yet working for Android') +from platform import uname +WSL = 'Microsoft' in uname()[2] + ANDROID_API = '19' ANDROID_MINAPI = '9' ANDROID_SDK_VERSION = '20' @@ -22,6 +25,7 @@ import os import io import re import ast +import sh from pipes import quote from sys import platform, executable from buildozer import BuildozerException @@ -410,7 +414,36 @@ class TargetAndroid(Target): 'android.skip_update', False) if 'tools' in packages or 'platform-tools' in packages: if not skip_upd: + if WSL: + # WSL (Windows Subsystem for Linux) allows running + # linux from windows 10, but some windows + # limitations still apply, namely you can't rename a + # directory that a program was started from, which + # is what the tools updates cause, and we end up + # with an empty dir, so we need to run from a + # different place, and the updater is still looking + # for things in tools, and specifically renames the + # tool dir, hence, moving and making a symlink + # works. + sh.mv( + join(self.android_sdk_dir, 'tools'), + join(self.android_sdk_dir, 'tools.save') + ) + sh.ln( + '-s', + join(self.android_sdk_dir, 'tools.save'), + join(self.android_sdk_dir, 'tools') + ) + old_android_cmd = self.android_cmd + self.android_cmd = join( + self.android_sdk_dir, + 'tools.save', + self.android_cmd.split('/')[-1] + ) self._android_update_sdk('tools,platform-tools') + self.android_cmd = old_android_cmd + if WSL: + sh.rm('-rf', join(self.android_sdk_dir, 'tools.save')) else: self.buildozer.info('Skipping Android SDK update due to spec file setting') From 58bec60ecdb828530a7f1761f12f19b292b669c0 Mon Sep 17 00:00:00 2001 From: David Brooks Date: Sat, 10 Nov 2018 17:40:42 +1300 Subject: [PATCH 013/218] Correctly write out a sub-process's `stdout` when using Python 3. --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index aa4b440..ea2ca94 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -311,7 +311,7 @@ class Buildozer(object): ret_stdout.append(chunk) if show_output: if IS_PY3: - stdout.write(str(chunk)) + stderr.write(chunk.decode('utf-8')) else: stdout.write(chunk) if fd_stderr in readx: From 6e6a889479937e5e8e02e3b614b52d39834e71ae Mon Sep 17 00:00:00 2001 From: David Brooks Date: Sun, 11 Nov 2018 01:07:57 +1300 Subject: [PATCH 014/218] Fixes hardcoded pip version Uses default Python executable so correct version of pip gets picked up dynamically --- buildozer/targets/android.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 088ad35..a7f1ced 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -535,7 +535,7 @@ class TargetAndroid(Target): options = "--user" if "VIRTUAL_ENV" in os.environ or "CONDA_PREFIX" in os.environ: options = "" - cmd('pip install -q {} {}'.format(options, " ".join(pip_deps))) + cmd('{} -m pip install -q {} {}'.format(executable, options, " ".join(pip_deps))) def get_available_packages(self): available_modules = self.buildozer.cmd('./distribute.sh -l', @@ -726,7 +726,7 @@ class TargetAndroid(Target): 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: From c8093da21eb7ce2e8d4591d1c337a8c6562a3a02 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 17 Nov 2018 00:30:46 +0100 Subject: [PATCH 015/218] Update README.rst --- README.rst | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 259a371..29d709f 100644 --- a/README.rst +++ b/README.rst @@ -47,8 +47,23 @@ Installing Buildozer with target Python 2 (default): # edit the buildozer.spec, then buildozer android debug deploy run -Installing Buildozer with target Python 3 (CrystaX): ----------------------------------------------------- +Installing Buildozer with target Python 3 (native): +--------------------------------------------------- + +#. Follow the same installation and buildozer init as Python 2 + +#. Make sure the following lines are in your buildozer.spec file.:: + + # Require python3 + requirements = python3,kivy + +#. Finally, build, deploy and run the app on your phone:: + + buildozer android debug deploy run + + +Installing Buildozer with target Python 3 (CrystaX, deprecated): +---------------------------------------------------------------- After following the steps above to install buildozer and generate the default spec file, you need to setup Crystax NDK as described below. From 6447933ed353228561b297776e863daf78fabcef Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 17 Nov 2018 00:31:13 +0100 Subject: [PATCH 016/218] Update default.spec --- buildozer/default.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/default.spec b/buildozer/default.spec index a62d279..61153fe 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -36,7 +36,7 @@ version = 0.1 # (list) Application requirements # comma separated e.g. requirements = sqlite3,kivy -requirements = kivy +requirements = python3,kivy # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes From a6cd679c5c04dd3fd84b5741fb7721a4b24ef25b Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 17 Nov 2018 00:32:57 +0100 Subject: [PATCH 017/218] Update README.rst --- README.rst | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.rst b/README.rst index 29d709f..56a8e03 100644 --- a/README.rst +++ b/README.rst @@ -15,8 +15,10 @@ 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 `_. Please note that 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 target Python 3, use appropriate SDK/NDK as per the documentation, and ensure you +have `python3` in your requirements. +You can still use Crystax 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 `_. @@ -24,7 +26,7 @@ We provide a ready-to-use `Virtual Machine for Virtualbox `_. -Installing Buildozer with target Python 2 (default): +Installing Buildozer with target Python 3 (default): ---------------------------------------------------- #. Install buildozer:: @@ -47,15 +49,15 @@ Installing Buildozer with target Python 2 (default): # edit the buildozer.spec, then buildozer android debug deploy run -Installing Buildozer with target Python 3 (native): ---------------------------------------------------- +Installing Buildozer with target Python 2: +----------------------------------------- -#. Follow the same installation and buildozer init as Python 2 +#. Follow the same installation and buildozer init as Python 3 #. Make sure the following lines are in your buildozer.spec file.:: - # Require python3 - requirements = python3,kivy + # Changes python3 to python2 + requirements = python2,kivy #. Finally, build, deploy and run the app on your phone:: From 761727a9b2f89259318796aa67549fe288ac9908 Mon Sep 17 00:00:00 2001 From: Philipp Auersperg Date: Sat, 17 Nov 2018 14:50:21 +0100 Subject: [PATCH 018/218] fix ndk URLs --- buildozer/targets/android.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 9309a34..47a1d90 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -285,6 +285,13 @@ class TargetAndroid(Target): _version = re.search('(.+?)[a-z]', self.android_ndk_version).group(1) self.buildozer.info('Android NDK is missing, downloading') + # Welcome to the NDK URL hell! + # a list of all NDK URLs up to level 14 can be found here: + # https://gist.github.com/roscopecoltran/43861414fbf341adac3b6fa05e7fad08 + # it seems that from level 11 on the naming schema is consistent + # from 10e on the URLs can be looked up at + # https://developer.android.com/ndk/downloads/older_releases + if platform in ('win32', 'cygwin'): # Checking of 32/64 bits at Windows from: http://stackoverflow.com/a/1405971/798575 import struct @@ -292,14 +299,18 @@ class TargetAndroid(Target): is_64 = (8 * struct.calcsize("P") == 64) elif platform in ('darwin', ): - if int(_version) > 9: + if int(_version) >= '10e': + archive = 'android-ndk-r{0}-darwin-{1}.zip' + elif _version >= '10c': archive = 'android-ndk-r{0}-darwin-{1}.bin' else: archive = 'android-ndk-r{0}-darwin-{1}.tar.bz2' is_64 = (os.uname()[4] == 'x86_64') elif platform.startswith('linux'): - if int(_version) > 9: # if greater than 9, take it as .bin file + if _version >='10e': + archive = 'android-ndk-r{0}-linux-{1}.zip' + elif _version >= '10c': archive = 'android-ndk-r{0}-linux-{1}.bin' else: archive = 'android-ndk-r{0}-linux-{1}.tar.bz2' @@ -311,7 +322,12 @@ class TargetAndroid(Target): unpacked = 'android-ndk-r{0}' archive = archive.format(self.android_ndk_version, architecture) unpacked = unpacked.format(self.android_ndk_version) - url = 'http://dl.google.com/android/ndk/' + + if _version >= '10e': + url='https://dl.google.com/android/repository/' + else: + url = 'http://dl.google.com/android/ndk/' + self.buildozer.download(url, archive, cwd=self.buildozer.global_platform_dir) From 0c9fbb97835e30ed9c57599c0c627f200b280cb5 Mon Sep 17 00:00:00 2001 From: Peter Badida Date: Wed, 21 Nov 2018 20:42:02 +0100 Subject: [PATCH 019/218] Bump to 0.36 --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index ea2ca94..7fa1717 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -6,7 +6,7 @@ Generic Python packager for Android / iOS. Desktop later. ''' -__version__ = '0.36.dev0' +__version__ = '0.36' import os import re From c05c7d437c8a651f94f717da4ade4834d645779c Mon Sep 17 00:00:00 2001 From: Peter Badida Date: Wed, 21 Nov 2018 20:55:49 +0100 Subject: [PATCH 020/218] Bump to 0.37.dev0 --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 7fa1717..1f11b1e 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -6,7 +6,7 @@ Generic Python packager for Android / iOS. Desktop later. ''' -__version__ = '0.36' +__version__ = '0.37.dev0' import os import re From ecc499c23a702c2b560e81a725dd2a37e387ca2a Mon Sep 17 00:00:00 2001 From: Philipp Auersperg Date: Fri, 23 Nov 2018 09:41:44 +0100 Subject: [PATCH 021/218] follow links --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index ea2ca94..31107cd 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -744,7 +744,7 @@ class Buildozer(object): rmtree(self.app_dir) - for root, dirs, files in walk(source_dir): + for root, dirs, files in walk(source_dir, followlinks=True): # avoid hidden directory if True in [x.startswith('.') for x in root.split(sep)]: continue From 88eaa7f3323845321f30b716de8dcb4e4aa78c2a Mon Sep 17 00:00:00 2001 From: Gabriel Pettier Date: Sun, 25 Nov 2018 21:59:22 +0100 Subject: [PATCH 022/218] fix WSL compatibility change breaking normal build --- buildozer/targets/android.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 9309a34..f6268f9 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -434,15 +434,17 @@ class TargetAndroid(Target): join(self.android_sdk_dir, 'tools.save'), join(self.android_sdk_dir, 'tools') ) - old_android_cmd = self.android_cmd - self.android_cmd = join( - self.android_sdk_dir, - 'tools.save', - self.android_cmd.split('/')[-1] - ) + old_android_cmd = self.android_cmd + self.android_cmd = join( + self.android_sdk_dir, + 'tools.save', + self.android_cmd.split('/')[-1] + ) + self._android_update_sdk('tools,platform-tools') - self.android_cmd = old_android_cmd + if WSL: + self.android_cmd = old_android_cmd sh.rm('-rf', join(self.android_sdk_dir, 'tools.save')) else: self.buildozer.info('Skipping Android SDK update due to spec file setting') From d2550ee5c35643d3fe4ee03ca385bd7994576537 Mon Sep 17 00:00:00 2001 From: Gabriel Pettier Date: Sun, 25 Nov 2018 23:58:46 +0100 Subject: [PATCH 023/218] this allows to build with ndk 17c (and other recent-ish ones) --- buildozer/targets/android.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index f6268f9..62c8522 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -299,7 +299,9 @@ class TargetAndroid(Target): is_64 = (os.uname()[4] == 'x86_64') elif platform.startswith('linux'): - if int(_version) > 9: # if greater than 9, take it as .bin file + if int(_version) > 10: + archive = 'android-ndk-r{0}-linux-{1}.zip' + elif int(_version) > 9: # if greater than 9, take it as .bin file archive = 'android-ndk-r{0}-linux-{1}.bin' else: archive = 'android-ndk-r{0}-linux-{1}.tar.bz2' @@ -311,7 +313,7 @@ class TargetAndroid(Target): unpacked = 'android-ndk-r{0}' archive = archive.format(self.android_ndk_version, architecture) unpacked = unpacked.format(self.android_ndk_version) - url = 'http://dl.google.com/android/ndk/' + url = 'http://dl.google.com/android/repository/' self.buildozer.download(url, archive, cwd=self.buildozer.global_platform_dir) From e14207e3ed0f8a24c415403f9f7498a7effbaefd Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 26 Nov 2018 13:32:50 -0800 Subject: [PATCH 024/218] fix android sdk/ndk information link --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 56a8e03..ec6083b 100644 --- a/README.rst +++ b/README.rst @@ -12,8 +12,8 @@ Buildozer currently supports packaging for Android via the `python-for-android `_ 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 -`_. Please note that +For Android: please have a look at `Android-SDK-NDK-Information +`_. Please note that the default SDK/NDK coded in Buildozer works for target Python 2. For target Python 3, use appropriate SDK/NDK as per the documentation, and ensure you have `python3` in your requirements. From 70440b0d92759863f8d3e40628a5b0a6b488a345 Mon Sep 17 00:00:00 2001 From: Gabriel Pettier Date: Fri, 30 Nov 2018 00:09:11 +0100 Subject: [PATCH 025/218] bump to 0.37 --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 1f11b1e..660db05 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -6,7 +6,7 @@ Generic Python packager for Android / iOS. Desktop later. ''' -__version__ = '0.37.dev0' +__version__ = '0.37' import os import re From 50cc61681e1bf706e68e0d08e5b7ccc1d2ab6358 Mon Sep 17 00:00:00 2001 From: Gabriel Pettier Date: Fri, 30 Nov 2018 00:11:01 +0100 Subject: [PATCH 026/218] bump to 0.38.dev0 --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 660db05..ad16045 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -6,7 +6,7 @@ Generic Python packager for Android / iOS. Desktop later. ''' -__version__ = '0.37' +__version__ = '0.38.dev0' import os import re From 92291353a57848e9caecc40c45d84ff00c1e64e0 Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Fri, 30 Nov 2018 23:25:25 +0100 Subject: [PATCH 027/218] Update cython version from the docs `cython==0.28.6` seems to be doing just fine on p4a until now. https://github.com/kivy/python-for-android/blob/df60061/Dockerfile#L120 --- docs/source/installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/installation.rst b/docs/source/installation.rst index e72f171..94f2bca 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -22,7 +22,7 @@ Android on Ubuntu 18.04 (64bit) :: - sudo pip install --upgrade cython==0.21 + sudo pip install --upgrade cython==0.28.6 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 From 96bbbebf0b3e800664ef589f3894f7888935cbc5 Mon Sep 17 00:00:00 2001 From: Brent Picasso Date: Fri, 30 Nov 2018 17:07:02 -0800 Subject: [PATCH 028/218] allow specifying of Android NDK API. Resolves #758 --- buildozer/default.spec | 3 +++ buildozer/targets/android_new.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/buildozer/default.spec b/buildozer/default.spec index 61153fe..a75b167 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -99,6 +99,9 @@ fullscreen = 0 # (str) Android NDK version to use #android.ndk = 9c +# (int) Android NDK API to use (optional) +#android.ndk.api = 19 + # (bool) Use --private data storage (True) or --dir public storage (False) #android.private_storage = True diff --git a/buildozer/targets/android_new.py b/buildozer/targets/android_new.py index 58862a1..f1b9c56 100644 --- a/buildozer/targets/android_new.py +++ b/buildozer/targets/android_new.py @@ -29,6 +29,9 @@ class TargetAndroidNew(TargetAndroid): color = 'always' if USE_COLOR else 'never' self.extra_p4a_args = ' --color={} --storage-dir="{}"'.format( color, self._build_dir) + ndk_api = self.buildozer.config.getdefault('app', 'android.ndk.api', None) + if ndk_api is not None: + self.extra_p4a_args += ' --ndk-api={}'.format(ndk_api) hook = self.buildozer.config.getdefault("app", "p4a.hook", None) if hook is not None: self.extra_p4a_args += ' --hook={}'.format(realpath(hook)) From 98c2f36a1186b06bc86a8a46672f9df877a4a9f3 Mon Sep 17 00:00:00 2001 From: Brent Picasso Date: Sat, 1 Dec 2018 12:01:01 -0800 Subject: [PATCH 029/218] update docs per PR review --- buildozer/default.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildozer/default.spec b/buildozer/default.spec index a75b167..a6b322e 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -90,7 +90,7 @@ fullscreen = 0 # (int) Android API to use #android.api = 19 -# (int) Minimum API required +# (int) Minimum API required. You will need to set the android.ndk.api to be as low as this value. #android.minapi = 9 # (int) Android SDK version to use @@ -99,7 +99,7 @@ fullscreen = 0 # (str) Android NDK version to use #android.ndk = 9c -# (int) Android NDK API to use (optional) +# (int) Android NDK API to use (optional). This is the minimum API your API will support. #android.ndk.api = 19 # (bool) Use --private data storage (True) or --dir public storage (False) From 9bb9dd590c3e48637379b1c14afe8394823b3ce4 Mon Sep 17 00:00:00 2001 From: Brent Picasso Date: Sat, 1 Dec 2018 12:06:27 -0800 Subject: [PATCH 030/218] fix typo --- buildozer/default.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/default.spec b/buildozer/default.spec index a6b322e..d8c8405 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -99,7 +99,7 @@ fullscreen = 0 # (str) Android NDK version to use #android.ndk = 9c -# (int) Android NDK API to use (optional). This is the minimum API your API will support. +# (int) Android NDK API to use (optional). This is the minimum API your app will support. #android.ndk.api = 19 # (bool) Use --private data storage (True) or --dir public storage (False) From d77d9714ff731cc63193534f3224f5783ce4595f Mon Sep 17 00:00:00 2001 From: Brent Picasso Date: Sat, 1 Dec 2018 12:16:34 -0800 Subject: [PATCH 031/218] switch config key to use underscore --- buildozer/default.spec | 2 +- buildozer/targets/android_new.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildozer/default.spec b/buildozer/default.spec index d8c8405..e2d5ab7 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -100,7 +100,7 @@ fullscreen = 0 #android.ndk = 9c # (int) Android NDK API to use (optional). This is the minimum API your app will support. -#android.ndk.api = 19 +#android.ndk_api = 19 # (bool) Use --private data storage (True) or --dir public storage (False) #android.private_storage = True diff --git a/buildozer/targets/android_new.py b/buildozer/targets/android_new.py index f1b9c56..325b9d4 100644 --- a/buildozer/targets/android_new.py +++ b/buildozer/targets/android_new.py @@ -29,7 +29,7 @@ class TargetAndroidNew(TargetAndroid): color = 'always' if USE_COLOR else 'never' self.extra_p4a_args = ' --color={} --storage-dir="{}"'.format( color, self._build_dir) - ndk_api = self.buildozer.config.getdefault('app', 'android.ndk.api', None) + ndk_api = self.buildozer.config.getdefault('app', 'android.ndk_api', None) if ndk_api is not None: self.extra_p4a_args += ' --ndk-api={}'.format(ndk_api) hook = self.buildozer.config.getdefault("app", "p4a.hook", None) From c4c632f7da9d636803aefe32065d1565c2a92d07 Mon Sep 17 00:00:00 2001 From: Brent Picasso Date: Sat, 8 Dec 2018 09:27:18 -0800 Subject: [PATCH 032/218] support sensorLandscape mode. resolves #762 --- buildozer/__init__.py | 2 +- buildozer/default.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index ad16045..f53d62b 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -409,7 +409,7 @@ class Buildozer(object): ', required by "version.regex"') orientation = get('app', 'orientation', 'landscape') - if orientation not in ('landscape', 'portrait', 'all'): + if orientation not in ('landscape', 'portrait', 'all', 'sensorLandscape'): adderror('[app] "orientation" have an invalid value') if errors: diff --git a/buildozer/default.spec b/buildozer/default.spec index e2d5ab7..5e9692d 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -51,7 +51,7 @@ requirements = python3,kivy # (str) Icon of the application #icon.filename = %(source.dir)s/data/icon.png -# (str) Supported orientation (one of landscape, portrait or all) +# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all) orientation = portrait # (list) List of service to declare From 4296edc472649e05cb81d96cc41d69f03323309a Mon Sep 17 00:00:00 2001 From: WO Date: Wed, 12 Dec 2018 09:05:33 +0900 Subject: [PATCH 033/218] Fix output directory for gradle --- buildozer/targets/android.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 62c8522..dc13c1f 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -849,7 +849,7 @@ class TargetAndroid(Target): packagename = config.get('app', 'package.name') apk = u'{packagename}-{mode}.apk'.format( packagename=packagename, mode=mode) - apk_dir = join(dist_dir, "build", "outputs", "apk") + apk_dir = join(dist_dir, "build", "outputs", "apk", mode) apk_dest = u'{packagename}-{version}-{mode}.apk'.format( packagename=packagename, mode=mode, version=version) From 2be2d77ffa57f3576fe71a95eb810d69ce91dff3 Mon Sep 17 00:00:00 2001 From: maho Date: Fri, 28 Dec 2018 12:30:39 +0100 Subject: [PATCH 034/218] PR#775 - docker from current git --- Dockerfile | 15 +++++++++++++-- setup.py | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3bfb29b..36dacde 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,29 @@ # Dockerfile for providing buildozer # Build with: # docker build --tag=buildozer . +# +# if you want to use bleeding edge/current version from git, instead from pypi, then use +# docker build --tag=buildozer --build-arg git=true . +# # 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 +FROM ubuntu:18.04 +ARG git + +ENV BDOZER_REQ=${git:+"/src"} +ENV BDOZER_REQ=${BDOZER_REQ:-"buildozer"} ENV USER="user" ENV HOME_DIR="/home/${USER}" ENV WORK_DIR="${HOME_DIR}/hostcwd" \ PATH="${HOME_DIR}/.local/bin:${PATH}" +COPY . /src + # configures locale RUN apt update -qq > /dev/null && \ apt install -qq --yes --no-install-recommends \ @@ -44,7 +54,8 @@ USER ${USER} WORKDIR ${WORK_DIR} # installs buildozer and dependencies -RUN pip install --user Cython==0.25.2 buildozer +RUN pip install --user Cython==0.25.2 $BDOZER_REQ + # 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 - diff --git a/setup.py b/setup.py index 95ff689..f48f6f6 100644 --- a/setup.py +++ b/setup.py @@ -44,10 +44,10 @@ setup( license='MIT', packages=[ 'buildozer', 'buildozer.targets', 'buildozer.libs', 'buildozer.scripts' - ], + ], package_data={'buildozer': ['default.spec']}, include_package_data=True, - install_requires=['pexpect', 'virtualenv'], + install_requires=['pexpect', 'virtualenv', 'sh'], classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', 'Topic :: Software Development :: Build Tools', From 6b004f9778a312fed6908bceef605e4ef8c1efe9 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 7 Jan 2019 19:55:28 +0100 Subject: [PATCH 035/218] enforce p4a --ndk-api to respect minimum api set in buildozer.spec. Fixes #772 --- buildozer/targets/android.py | 2 ++ buildozer/targets/android_new.py | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 6f7dfb0..aa12e67 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -737,6 +737,8 @@ class TargetAndroid(Target): self.android_api)), ("--minsdk", config.getdefault('app', 'android.minapi', self.android_minapi)), + ("--ndk-api", config.getdefault('app', 'android.minapi', + self.android_minapi)), ] is_private_storage = config.getbooldefault( 'app', 'android.private_storage', True) diff --git a/buildozer/targets/android_new.py b/buildozer/targets/android_new.py index 325b9d4..e21f491 100644 --- a/buildozer/targets/android_new.py +++ b/buildozer/targets/android_new.py @@ -73,10 +73,14 @@ class TargetAndroidNew(TargetAndroid): if local_recipes: options.append('--local-recipes') options.append(local_recipes) - available_modules = self._p4a( - "create --dist_name={} --bootstrap={} --requirements={} --arch {} {}".format( + config = self.buildozer.config + self._p4a( + ("create --dist_name={} --bootstrap={} --requirements={} " + "--ndk-api {} " + "--arch {} {}").format( dist_name, self._p4a_bootstrap, requirements, - self.buildozer.config.getdefault('app', 'android.arch', "armeabi-v7a"), " ".join(options)), + config.getdefault('app', 'android.minapi', self.android_minapi), + config.getdefault('app', 'android.arch', "armeabi-v7a"), " ".join(options)), get_stdout=True)[0] def get_dist_dir(self, dist_name): From 532077e2a391e4959c909f5c8da840b1320968e0 Mon Sep 17 00:00:00 2001 From: Kjell Wooding Date: Wed, 9 Jan 2019 14:45:04 -0500 Subject: [PATCH 036/218] Add a mechanism to specify and override which git branch will be used for build dependencies --- buildozer/target.py | 116 +++++++++++++++++++++++++++++++++++++++ buildozer/targets/ios.py | 29 ++-------- 2 files changed, 121 insertions(+), 24 deletions(-) diff --git a/buildozer/target.py b/buildozer/target.py index f60666f..c02d072 100644 --- a/buildozer/target.py +++ b/buildozer/target.py @@ -147,3 +147,119 @@ class Target(object): def cmd_serve(self, *args): self.buildozer.cmd_serve() + + def path_or_git_url(self, repo, owner='kivy', branch='master', + url_format='https://github.com/{owner}/{repo}.git', + platform=None, + squash_hyphen=True): + """Get source location for a git checkout + + This method will check the `buildozer.spec` for the keys: + {repo}_dir + {repo}_url + {repo}_branch + + and use them to determine the source location for a git checkout. + + If a `platform` is specified, {platform}.{repo} will be used + as the base for the buildozer key + + `{repo}_dir` specifies a custom checkout location + (relative to `buildozer.root_dir`). If present, `path` will be + set to this value and `url`, `branch` will be set to None, + None. Otherwise, `{repo}_url` and `{repo}_branch` will be + examined. + + If no keys are present, the kwargs will be used to create + a sensible default URL and branch. + + :Parameters: + `repo`: str (required) + name of repository to fetch. Used both for buildozer + keys ({platform}.{repo}_dir|_url|_branch) and in building + default git URL + `branch`: str (default 'master') + Specific branch to retrieve if none specified in + buildozer.spec. + `owner`: str + owner of repo. + `platform`: str or None + platform prefix to use when retrieving `buildozer.spec` + keys. If specified, key names will be {platform}.{repo} + instead of just {repo} + `squash_hyphen`: boolean + if True, change '-' to '_' when looking for + keys in buildozer.spec. This lets us keep backwards + compatibility with old buildozer.spec files + `url_format`: format string + Used to construct default git URL. + can use {repo} {owner} and {branch} if needed. + + :Returns: + A Tuple (path, url, branch) where + `path` + Path to a custom git checkout. If specified, + both `url` and `branch` will be None + `url` + URL of git repository from where code should be + checked-out + `branch` + branch name (or tag) that should be used for the + check-out. + + """ + if squash_hyphen: + key = repo.replace('-', '_') + else: + key = repo + if platform: + key = "{}.{}".format(platform, key) + config = self.buildozer.config + path = config.getdefault('app', '{}_dir'.format(key), None) + + if path is not None: + path = join(self.buildozer.root_dir, path) + url = None + branch = None + else: + branch = config.getdefault('app', '{}_branch'.format(key), branch) + default_url = url_format.format(owner=owner, repo=repo, branch=branch) + url = config.getdefault('app', '{}_url'.format(key), default_url) + if branch != 'master': + url = "--branch {} {}".format(branch, url) + return path, url, branch + + def install_or_update_repo(self, repo, **kwargs): + """Install or update a git repository into the platform directory. + + This will clone the contents of a git repository to + `buildozer.platform_dir`. The location of this repo can be + speficied via URL and branch name, or via a custom (local) + directory name. + + :Parameters: + **kwargs: + Any valid arguments for :meth:`path_or_git_url` + + :Returns: + fully qualified path to updated git repo + """ + if platform is None: + raise Exception("platform is a required keyword argument") + cmd = self.buildozer.cmd + install_dir = join(self.buildozer.platform_dir, repo) + custom_dir, clone_url, clone_branch = self.path_or_git_url(repo, platform=platform, **kwargs) + if not self.buildozer.file_exists(install_dir): + if custom_dir: + cmd('mkdir -p "{}"'.format(install_dir)) + cmd('cp -a "{}"/* "{}"/'.format(custom_dir, install_dir)) + else: + cmd('git clone {}'.format(clone_url), + cwd=self.buildozer.platform_dir) + elif self.platform_update: + if custom_dir: + cmd('cp -a "{}"/* "{}"/'.format(custom_dir, install_dir)) + else: + cmd('git clean -dxf', cwd=install_dir) + cmd('git pull origin {}'.format(clone_branch), cwd=install_dir) + return install_dir diff --git a/buildozer/targets/ios.py b/buildozer/targets/ios.py index 3247278..2f411c3 100644 --- a/buildozer/targets/ios.py +++ b/buildozer/targets/ios.py @@ -91,30 +91,11 @@ class TargetIos(Target): self.buildozer.debug(' -> found {0}'.format(xcode)) def install_platform(self): - cmd = self.buildozer.cmd - self.ios_dir = ios_dir = join(self.buildozer.platform_dir, 'kivy-ios') - custom_kivy_ios = self.buildozer.config.getdefault('app', 'ios.kivy_ios_dir') - if custom_kivy_ios: - custom_kivy_ios = join(self.buildozer.root_dir, custom_kivy_ios) - if not self.buildozer.file_exists(ios_dir): - if custom_kivy_ios: - cmd('mkdir -p "{}"'.format(ios_dir)) - cmd('cp -a "{}"/* "{}"/'.format(custom_kivy_ios, ios_dir)) - else: - cmd('git clone https://github.com/kivy/kivy-ios', - cwd=self.buildozer.platform_dir) - elif self.platform_update: - if custom_kivy_ios: - cmd('cp -a "{}"/* "{}"/'.format(custom_kivy_ios, ios_dir)) - else: - cmd('git clean -dxf', cwd=ios_dir) - cmd('git pull origin master', cwd=ios_dir) - - self.ios_deploy_dir = ios_deploy_dir = join(self.buildozer.platform_dir, - 'ios-deploy') - if not self.buildozer.file_exists(ios_deploy_dir): - cmd('git clone --branch 1.7.0 https://github.com/phonegap/ios-deploy', - cwd=self.buildozer.platform_dir) + self.ios_dir = self.install_or_update_repo('kivy-ios', platform='ios') + self.ios_deploy_dir = self.install_or_update_repo('ios-deploy', + platform='ios', + branch='1.7.0', + owner='phonegap') def get_available_packages(self): available_modules = self.buildozer.cmd( From 44bbd13b47b6dd28a2ee4c4e2b227a0ed8489c6b Mon Sep 17 00:00:00 2001 From: Kjell Wooding Date: Wed, 9 Jan 2019 14:51:16 -0500 Subject: [PATCH 037/218] Whoops. Missed some references --- buildozer/target.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/buildozer/target.py b/buildozer/target.py index c02d072..fbdd5f1 100644 --- a/buildozer/target.py +++ b/buildozer/target.py @@ -1,6 +1,6 @@ from sys import exit import os - +from os.path import join def no_config(f): f.__no_config = True @@ -244,11 +244,9 @@ class Target(object): :Returns: fully qualified path to updated git repo """ - if platform is None: - raise Exception("platform is a required keyword argument") cmd = self.buildozer.cmd install_dir = join(self.buildozer.platform_dir, repo) - custom_dir, clone_url, clone_branch = self.path_or_git_url(repo, platform=platform, **kwargs) + custom_dir, clone_url, clone_branch = self.path_or_git_url(repo, **kwargs) if not self.buildozer.file_exists(install_dir): if custom_dir: cmd('mkdir -p "{}"'.format(install_dir)) From 152d5417b0037183c59c74673eb4336ecb8c5bb4 Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Sat, 12 Jan 2019 16:59:05 +0100 Subject: [PATCH 038/218] Fixes minor comment typo introduced in #759 --- buildozer/default.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/default.spec b/buildozer/default.spec index 5e9692d..99f5fc6 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -90,7 +90,7 @@ fullscreen = 0 # (int) Android API to use #android.api = 19 -# (int) Minimum API required. You will need to set the android.ndk.api to be as low as this value. +# (int) Minimum API required. You will need to set the android.ndk_api to be as low as this value. #android.minapi = 9 # (int) Android SDK version to use From 46cc8f715b7b5355b820744b787e8a470448596e Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Sun, 13 Jan 2019 11:56:33 +0200 Subject: [PATCH 039/218] Handle buildozer.spec with unicode chars --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 7141d56..30a0581 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -119,7 +119,7 @@ class Buildozer(object): self.config.getrawdefault = self._get_config_raw_default if exists(filename): - self.config.read(filename) + self.config.read(filename, "utf-8") self.check_configuration_tokens() # Check all section/tokens for env vars, and replace the From be52c21467ce9dd646e909f67e7316bc89dbb2c2 Mon Sep 17 00:00:00 2001 From: JonasT Date: Wed, 16 Jan 2019 21:55:15 +0100 Subject: [PATCH 040/218] Fix python 2 crash when reading config file --- buildozer/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 30a0581..e80bd5a 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -119,7 +119,10 @@ class Buildozer(object): self.config.getrawdefault = self._get_config_raw_default if exists(filename): - self.config.read(filename, "utf-8") + try: + self.config.read(filename, "utf-8") + except TypeError: # python 2 has no second arg here + self.config.read(filename) self.check_configuration_tokens() # Check all section/tokens for env vars, and replace the From 58faefa2436bd93409cdc33fd6636e67ba155e7b Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Wed, 16 Jan 2019 23:10:39 +0100 Subject: [PATCH 041/218] Introduces CI and tox testing, fixes #679 - run setup.py on both Python2 and Python3 - runs simple test case for both Python2 and Python3 - checks the PEP8 style - updates README.md adds Travis badge --- .travis.yml | 11 +++++++++++ README.rst | 3 +++ tests/__init__.py | 0 tests/test_buildozer.py | 12 ++++++++++++ tox.ini | 16 ++++++++++++++++ 5 files changed, 42 insertions(+) create mode 100644 .travis.yml create mode 100644 tests/__init__.py create mode 100644 tests/test_buildozer.py create mode 100644 tox.ini diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c6949b8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +sudo: false + +language: python + +python: + - "2.7" + - "3.6" + +install: pip install tox-travis + +script: tox diff --git a/README.rst b/README.rst index ec6083b..b8fa18b 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,9 @@ Buildozer ========= +.. image:: https://travis-ci.com/kivy/buildozer.svg?branch=master + :target: https://travis-ci.com/kivy/buildozer + Buildozer is a tool for creating application packages easily. The goal is to have one "buildozer.spec" file in your app directory, describing diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_buildozer.py b/tests/test_buildozer.py new file mode 100644 index 0000000..327e33e --- /dev/null +++ b/tests/test_buildozer.py @@ -0,0 +1,12 @@ +import unittest +from buildozer import Buildozer + + +class TestBuildozer(unittest.TestCase): + + def test_buildozer_base(self): + """ + Basic test making sure the Buildozer object can be instanciated. + """ + buildozer = Buildozer() + self.assertEqual(buildozer.specfilename, 'buildozer.spec') diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..27a8565 --- /dev/null +++ b/tox.ini @@ -0,0 +1,16 @@ +[tox] +envlist = pep8,py27,py36 + +[testenv] +commands = + python -m unittest discover --top-level-directory=. --start-directory=tests/ + +[testenv:pep8] +deps = flake8 +commands = flake8 buildozer/ + +[flake8] +ignore = + E121, E122, E123, E125, E126, E127, E128, E129, E131, E226, E231, E241, + E262, E265, E301, E302, E303, E305, E402, E501, E502, E722, E731, E741, + F401, F821, F841, W391, W504, W605 From bf6b88de3dd5de14abc3e025b685fc3d507a1ef1 Mon Sep 17 00:00:00 2001 From: Kjell Wooding Date: Thu, 17 Jan 2019 00:46:03 -0500 Subject: [PATCH 042/218] support the --add-frameworks flag in kivy-ios --- buildozer/targets/ios.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/buildozer/targets/ios.py b/buildozer/targets/ios.py index 3247278..a20ae54 100644 --- a/buildozer/targets/ios.py +++ b/buildozer/targets/ios.py @@ -180,15 +180,19 @@ class TargetIos(Target): app_name = self.buildozer.namify(self.buildozer.config.get('app', 'package.name')) + ios_frameworks = self.buildozer.config.getlist('app', 'ios.frameworks', '') + frameworks_cmd = '' + for framework in ios_frameworks: + frameworks_cmd += '--add-framework={} '.format(framework) + self.app_project_dir = join(self.ios_dir, '{0}-ios'.format(app_name.lower())) if not self.buildozer.file_exists(self.app_project_dir): - self.buildozer.cmd('./toolchain.py create {0} {1}'.format( - app_name, self.buildozer.app_dir), - cwd=self.ios_dir) + create_cmd = './toolchain.py create {0}{1} {2}'.format(frameworks_cmd, app_name, + self.buildozer.app_dir) + self.buildozer.cmd(create_cmd, cwd=self.ios_dir) else: - self.buildozer.cmd('./toolchain.py update {0}-ios'.format( - app_name), - cwd=self.ios_dir) + update_cmd = './toolchain.py update {0}{1}-ios'.format(frameworks_cmd, app_name) + self.buildozer.cmd(update_cmd, cwd=self.ios_dir) # fix the plist plist_fn = '{}-Info.plist'.format(app_name.lower()) From 27d888041110d24474a13cec3020e7f9aba6f8fb Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Mon, 21 Jan 2019 18:46:56 +0100 Subject: [PATCH 043/218] Unit tests read spec file, refs #793 --- tests/test_buildozer.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_buildozer.py b/tests/test_buildozer.py index 327e33e..b47711d 100644 --- a/tests/test_buildozer.py +++ b/tests/test_buildozer.py @@ -1,4 +1,6 @@ +import os import unittest +import buildozer as buildozer_module from buildozer import Buildozer @@ -10,3 +12,15 @@ class TestBuildozer(unittest.TestCase): """ buildozer = Buildozer() self.assertEqual(buildozer.specfilename, 'buildozer.spec') + # spec file doesn't have to exist + self.assertFalse(os.path.exists(buildozer.specfilename)) + + def test_buildozer_read_spec(self): + """ + Initializes Buildozer object from existing spec file. + """ + specfilepath = os.path.join( + os.path.dirname(buildozer_module.__file__), + 'default.spec') + buildozer = Buildozer(filename=specfilepath) + self.assertTrue(os.path.exists(buildozer.specfilename)) From 823018eb074e94af54490e1f83941929a872443d Mon Sep 17 00:00:00 2001 From: Kjell Wooding Date: Fri, 25 Jan 2019 20:26:11 -0500 Subject: [PATCH 044/218] Add examples of new url/branch logic to default.spec --- buildozer/default.spec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/buildozer/default.spec b/buildozer/default.spec index 5e9692d..1617c87 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -220,6 +220,16 @@ android.arch = armeabi-v7a # (str) Path to a custom kivy-ios folder #ios.kivy_ios_dir = ../kivy-ios +# Alternately, specify the URL and branch of a git checkout: +ios.kivy_ios_url = https://github.com/kivy/kivy-ios +ios.kivy_ios_branch = master + +# Another platform dependency: ios-deploy +# Uncomment to use a custom checkout +#ios.ios_deploy_dir = ../ios_deploy +# Or specify URL and branch +ios.ios_deploy_url = https://github.com/phonegap/ios-deploy +ios.ios_deploy_branch = 1.7.0 # (str) Name of the certificate to use for signing the debug version # Get a list of available identities: buildozer ios list_identities From da9d59f96ec269ae2849542b96adf98a206c4586 Mon Sep 17 00:00:00 2001 From: maho Date: Sun, 13 Jan 2019 16:29:35 +0100 Subject: [PATCH 045/218] - show environment to debug before run --- buildozer/__init__.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index e80bd5a..c7cc581 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -11,7 +11,6 @@ __version__ = '0.38.dev0' import os import re import sys -import zipfile import select import codecs import textwrap @@ -24,6 +23,9 @@ from os import environ, unlink, walk, sep, listdir, makedirs from copy import copy from shutil import copyfile, rmtree, copytree, move from fnmatch import fnmatch + +from pprint import pformat + try: from urllib.request import FancyURLopener from configparser import SafeConfigParser @@ -41,7 +43,7 @@ try: colorama.init() RESET_SEQ = colorama.Fore.RESET + colorama.Style.RESET_ALL - COLOR_SEQ = lambda x: x + COLOR_SEQ = lambda x: x # noqa: E731 BOLD_SEQ = '' if sys.platform == 'win32': BLACK = colorama.Fore.BLACK + colorama.Style.DIM @@ -54,7 +56,7 @@ try: except ImportError: if sys.platform != 'win32': RESET_SEQ = "\033[0m" - COLOR_SEQ = lambda x: "\033[1;{}m".format(30 + x) + COLOR_SEQ = lambda x: "\033[1;{}m".format(30 + x) # noqa: E731 BOLD_SEQ = "\033[1m" BLACK = 0 RED = 1 @@ -73,11 +75,13 @@ LOG_LEVELS_T = 'EID' SIMPLE_HTTP_SERVER_PORT = 8000 IS_PY3 = sys.version_info[0] >= 3 + class ChromeDownloader(FancyURLopener): version = ( 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 ' '(KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36') + urlretrieve = ChromeDownloader().retrieve @@ -132,7 +136,7 @@ class Buildozer(object): try: self.log_level = int(self.config.getdefault( 'buildozer', 'log_level', '1')) - except: + except Exception: pass build_dir = self.config.getdefault('buildozer', 'builddir', None) @@ -158,7 +162,7 @@ class Buildozer(object): target = self.translate_target(target) self.targetname = target m = __import__('buildozer.targets.{0}'.format(target), - fromlist=['buildozer']) + fromlist=['buildozer']) self.target = m.get_target(self) self.check_build_layout() self.check_configuration_tokens() @@ -233,6 +237,12 @@ class Buildozer(object): def debug(self, msg): self.log(2, msg) + def debug_env(self, env): + """dump env into debug logger in readable format""" + self.debug("ENVIRONMENT:") + for k, v in env.items(): + self.debug(" {} = {}".format(k, pformat(v))) + def info(self, msg): self.log(1, msg) @@ -282,6 +292,7 @@ class Buildozer(object): else: self.debug('Run {0!r} ...'.format(command.split()[0])) self.debug('Cwd {}'.format(kwargs.get('cwd'))) + self.debug_env(kwargs.get("env")) # open the process if sys.platform == 'win32': @@ -406,10 +417,10 @@ class Buildozer(object): adderror('[app] One of "version" or "version.regex" must be set') if version and version_regex: adderror('[app] Conflict between "version" and "version.regex"' - ', only one can be used.') + ', only one can be used.') if version_regex and not get('app', 'version.filename', ''): adderror('[app] "version.filename" is missing' - ', required by "version.regex"') + ', required by "version.regex"') orientation = get('app', 'orientation', 'landscape') if orientation not in ('landscape', 'portrait', 'all', 'sensorLandscape'): @@ -482,9 +493,9 @@ class Buildozer(object): return # remove all the requirements that the target can compile - onlyname = lambda x: x.split('==')[0] + onlyname = lambda x: x.split('==')[0] # noqa: E731 requirements = [x for x in requirements if onlyname(x) not in - target_available_packages] + target_available_packages] if requirements and hasattr(sys, 'real_prefix'): e = self.error @@ -496,7 +507,7 @@ class Buildozer(object): # did we already installed the libs ? if exists(self.applibs_dir) and \ - self.state.get('cache.applibs', '') == requirements: + self.state.get('cache.applibs', '') == requirements: self.debug('Application requirements already installed, pass') return From e8ad30e103852f5c9c152bcb1ca97544a2268d5d Mon Sep 17 00:00:00 2001 From: maho Date: Sun, 13 Jan 2019 19:31:07 +0100 Subject: [PATCH 046/218] - dump env also when cmd failed --- buildozer/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index c7cc581..c26651c 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -237,11 +237,11 @@ class Buildozer(object): def debug(self, msg): self.log(2, msg) - def debug_env(self, env): + def log_env(self, level, env): """dump env into debug logger in readable format""" - self.debug("ENVIRONMENT:") + self.log(level, "ENVIRONMENT:") for k, v in env.items(): - self.debug(" {} = {}".format(k, pformat(v))) + self.log(level, " {} = {}".format(k, pformat(v))) def info(self, msg): self.log(1, msg) @@ -292,7 +292,7 @@ class Buildozer(object): else: self.debug('Run {0!r} ...'.format(command.split()[0])) self.debug('Cwd {}'.format(kwargs.get('cwd'))) - self.debug_env(kwargs.get("env")) + self.log_env(2, kwargs.get("env")) # open the process if sys.platform == 'win32': @@ -346,6 +346,7 @@ class Buildozer(object): process.communicate() if process.returncode != 0 and break_on_error: self.error('Command failed: {0}'.format(command)) + self.log_env(1, kwargs['env']) self.error('') self.error('Buildozer failed to execute the last command') if self.log_level <= 1: From ee833cfe98e52c977103a4669065cd8d657e3e35 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Wed, 30 Jan 2019 12:45:02 +0000 Subject: [PATCH 047/218] Updated buildozer defaults to use, and work with, p4a master --- buildozer/default.spec | 14 +++++++------- buildozer/targets/android.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/buildozer/default.spec b/buildozer/default.spec index 99f5fc6..273bb70 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -87,20 +87,20 @@ fullscreen = 0 # (list) Permissions #android.permissions = INTERNET -# (int) Android API to use -#android.api = 19 +# (int) Target Android API, should be as high as possible. +#android.api = 27 -# (int) Minimum API required. You will need to set the android.ndk_api to be as low as this value. -#android.minapi = 9 +# (int) Minimum API your APK will support. +#android.minapi = 21 # (int) Android SDK version to use #android.sdk = 20 # (str) Android NDK version to use -#android.ndk = 9c +#android.ndk = 17c -# (int) Android NDK API to use (optional). This is the minimum API your app will support. -#android.ndk_api = 19 +# (int) Android NDK API to use. This is the minimum API your app will support, it should usually match android.minapi. +#android.ndk_api = 21 # (bool) Use --private data storage (True) or --dir public storage (False) #android.private_storage = True diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index aa12e67..f5c8b31 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -14,10 +14,10 @@ if sys.platform == 'win32': from platform import uname WSL = 'Microsoft' in uname()[2] -ANDROID_API = '19' -ANDROID_MINAPI = '9' +ANDROID_API = '27' +ANDROID_MINAPI = '21' ANDROID_SDK_VERSION = '20' -ANDROID_NDK_VERSION = '9c' +ANDROID_NDK_VERSION = '17c' APACHE_ANT_VERSION = '1.9.4' import traceback From c8e888dbbfee74c19527bbae5e88c0f10ac122b1 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Wed, 30 Jan 2019 12:50:22 +0000 Subject: [PATCH 048/218] Changed default python-for-android branch to master --- buildozer/default.spec | 4 ++-- buildozer/targets/android_new.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/buildozer/default.spec b/buildozer/default.spec index 273bb70..848510b 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -152,8 +152,8 @@ fullscreen = 0 # (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 +# (str) python-for-android branch to use, defaults to master +#p4a.branch = master # (str) OUYA Console category. Should be one of GAME or APP # If you leave this blank, OUYA support will not be enabled diff --git a/buildozer/targets/android_new.py b/buildozer/targets/android_new.py index e21f491..4e1e2cc 100644 --- a/buildozer/targets/android_new.py +++ b/buildozer/targets/android_new.py @@ -13,7 +13,7 @@ from os.path import join, expanduser, realpath class TargetAndroidNew(TargetAndroid): targetname = 'android' - p4a_branch = "stable" + p4a_branch = "master" p4a_directory = "python-for-android-new-toolchain" p4a_apk_cmd = "apk --debug --bootstrap=" extra_p4a_args = '' From 9bc08dc731b90ee1fb4aff80775d08069a1d3525 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Wed, 30 Jan 2019 15:00:55 +0000 Subject: [PATCH 049/218] Removed redundant --ndk-api argument and fixed default value --- buildozer/targets/android_new.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/buildozer/targets/android_new.py b/buildozer/targets/android_new.py index e21f491..2eefb08 100644 --- a/buildozer/targets/android_new.py +++ b/buildozer/targets/android_new.py @@ -29,9 +29,13 @@ class TargetAndroidNew(TargetAndroid): color = 'always' if USE_COLOR else 'never' self.extra_p4a_args = ' --color={} --storage-dir="{}"'.format( color, self._build_dir) - ndk_api = self.buildozer.config.getdefault('app', 'android.ndk_api', None) - if ndk_api is not None: - self.extra_p4a_args += ' --ndk-api={}'.format(ndk_api) + + # minapi should match ndk-api, so can use the same default if + # nothing is specified + ndk_api = self.buildozer.config.getdefault( + 'app', 'android.ndk_api', self.android_minapi) + self.extra_p4a_args += ' --ndk-api={}'.format(ndk_api) + hook = self.buildozer.config.getdefault("app", "p4a.hook", None) if hook is not None: self.extra_p4a_args += ' --hook={}'.format(realpath(hook)) @@ -76,10 +80,8 @@ class TargetAndroidNew(TargetAndroid): config = self.buildozer.config self._p4a( ("create --dist_name={} --bootstrap={} --requirements={} " - "--ndk-api {} " "--arch {} {}").format( dist_name, self._p4a_bootstrap, requirements, - config.getdefault('app', 'android.minapi', self.android_minapi), config.getdefault('app', 'android.arch', "armeabi-v7a"), " ".join(options)), get_stdout=True)[0] From 4936d31828cc64b06af197d0057c0272ce1a09f6 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Fri, 1 Feb 2019 13:04:06 +0000 Subject: [PATCH 050/218] Removed android_old target and began update to sdk install --- buildozer/__init__.py | 22 +- buildozer/targets/android.py | 448 ++++++++++++++++++------------- buildozer/targets/android_new.py | 217 --------------- 3 files changed, 267 insertions(+), 420 deletions(-) delete mode 100644 buildozer/targets/android_new.py diff --git a/buildozer/__init__.py b/buildozer/__init__.py index e80bd5a..2048a15 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -155,7 +155,6 @@ class Buildozer(object): def set_target(self, target): '''Set the target to use (one of buildozer.targets, such as "android") ''' - target = self.translate_target(target) self.targetname = target m = __import__('buildozer.targets.{0}'.format(target), fromlist=['buildozer']) @@ -919,23 +918,6 @@ class Buildozer(object): # command line invocation # - def translate_target(self, target, inverse=False): - # FIXME at some point, refactor to remove completely android old toolchain - if inverse: - if target == "android": - target = "android_old" - elif target == "android_new": - target = "android" - else: - if target == "android": - target = "android_new" - elif target == "android_new": - self.error("ERROR: The target android_new is now android") - exit(1) - elif target == "android_old": - target = "android" - return target - def targets(self): for fn in listdir(join(dirname(__file__), 'targets')): if fn.startswith('.') or fn.startswith('__'): @@ -946,7 +928,7 @@ class Buildozer(object): try: m = __import__('buildozer.targets.{0}'.format(target), fromlist=['buildozer']) - yield self.translate_target(target, inverse=True), m + yield target, m except NotImplementedError: pass except: @@ -1054,7 +1036,7 @@ class Buildozer(object): # maybe it's a target? targets = [x[0] for x in self.targets()] - if self.translate_target(command, inverse=True) not in targets: + if command not in targets: print('Unknown command/target {}'.format(self.translate_target(command, inverse=True))) exit(1) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index f5c8b31..dd9782f 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -28,8 +28,7 @@ import ast import sh from pipes import quote from sys import platform, executable -from buildozer import BuildozerException -from buildozer import IS_PY3 +from buildozer import BuildozerException, USE_COLOR, IS_PY3 from buildozer.target import Target from os import environ from os.path import exists, join, realpath, expanduser, basename, relpath @@ -42,10 +41,55 @@ from distutils.version import LooseVersion class TargetAndroid(Target): - targetname = 'android_old' + targetname = 'android' p4a_directory = "python-for-android" - p4a_branch = 'old_toolchain' - p4a_apk_cmd = "python build.py" + p4a_branch = 'master' + p4a_apk_cmd = "apk --debug --bootstrap=" + extra_p4a_args = '' + + def __init__(self, *args, **kwargs): + super(TargetAndroid, self).__init__(*args, **kwargs) + self._build_dir = join(self.buildozer.platform_dir, 'build') + executable = sys.executable or 'python' + self._p4a_cmd = '{} -m pythonforandroid.toolchain '.format(executable) + self._p4a_bootstrap = self.buildozer.config.getdefault( + '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( + color, self._build_dir) + + # minapi should match ndk-api, so can use the same default if + # nothing is specified + ndk_api = self.buildozer.config.getdefault( + 'app', 'android.ndk_api', self.android_minapi) + self.extra_p4a_args += ' --ndk-api={}'.format(ndk_api) + + hook = self.buildozer.config.getdefault("app", "p4a.hook", None) + if hook is not None: + self.extra_p4a_args += ' --hook={}'.format(realpath(hook)) + port = self.buildozer.config.getdefault('app', 'p4a.port', None) + if port is not None: + self.extra_p4a_args += ' --port={}'.format(port) + + def _p4a(self, cmd, **kwargs): + if not hasattr(self, "pa_dir"): + self.pa_dir = join(self.buildozer.platform_dir, self.p4a_directory) + kwargs.setdefault('cwd', self.pa_dir) + return self.buildozer.cmd(self._p4a_cmd + cmd + self.extra_p4a_args, **kwargs) + + def _sdkmanager(self, *args): + """Call the sdkmanager in our Android SDK with the given arguments.""" + sdkmanager_path = os.path.join(self.buildozer.global_platform_dir, + 'android-sdk', + 'tools', + 'bin', + 'sdkmanager') + assert os.path.isfile(sdkmanager_path) + + return self.buildozer.cmd(sdkmanager_path + ' ' + ' '.join(args), + get_stdout=True) + @property def android_sdk_version(self): @@ -73,10 +117,8 @@ class TargetAndroid(Target): 'app', 'android.sdk_path', '')) if directory: return realpath(directory) - version = self.buildozer.config.getdefault('app', 'android.sdk', - self.android_sdk_version) return join(self.buildozer.global_platform_dir, - 'android-sdk-{0}'.format(version)) + 'android-sdk') @property def android_ndk_dir(self): @@ -248,30 +290,31 @@ class TargetAndroid(Target): self.buildozer.info('Android SDK is missing, downloading') if platform in ('win32', 'cygwin'): - archive = 'android-sdk_r{0}-windows.zip' + archive = 'sdk-tools-windows-4333796.zip' unpacked = 'android-sdk-windows' elif platform in ('darwin', ): - archive = 'android-sdk_r{0}-macosx.zip' + archive = 'sdk-tools-darwin-4333796.zip' unpacked = 'android-sdk-macosx' elif platform.startswith('linux'): - archive = 'android-sdk_r{0}-linux.tgz' + archive = 'sdk-tools-linux-4333796.zip' unpacked = 'android-sdk-linux' else: raise SystemError('Unsupported platform: {0}'.format(platform)) + if not os.path.exists(sdk_dir): + os.makedirs(sdk_dir) + archive = archive.format(self.android_sdk_version) - url = 'http://dl.google.com/android/' + url = 'http://dl.google.com/android/repository/' self.buildozer.download(url, archive, - cwd=self.buildozer.global_platform_dir) + cwd=sdk_dir) self.buildozer.info('Unpacking Android SDK') self.buildozer.file_extract(archive, - cwd=self.buildozer.global_platform_dir) - self.buildozer.file_rename(unpacked, - sdk_dir, - cwd=self.buildozer.global_platform_dir) - self.buildozer.info('Android SDK installation done.') + cwd=sdk_dir) + + self.buildozer.info('Android SDK tools base installation done.') return sdk_dir @@ -341,21 +384,24 @@ class TargetAndroid(Target): self.buildozer.info('Android NDK installation done.') return ndk_dir - def _android_list_sdk(self, include_all=False): - cmd = '{} list sdk -u -e'.format(self.android_cmd) - if include_all: - cmd += ' -a' - available_packages = self.buildozer.cmd( - cmd, - cwd=self.buildozer.global_platform_dir, - get_stdout=True)[0] + def _android_list_build_tools_versions(self): + available_packages = self._sdkmanager('--list') - # get only the line like -> id: 5 or "build-tools-19.0.1" - # and extract the name part. - print(available_packages) - return [x.split('"')[1] - for x in available_packages.splitlines() - if x.startswith('id: ')] + lines = available_packages[0].split('\n') + + build_tools_versions = [] + + for line in lines: + if not line.strip().startswith('build-tools;'): + continue + package_name = line.strip().split(' ')[0] + assert package_name.count(';') == 1, ( + 'could not parse package "{}"'.format(package_name)) + version = package_name.split(';')[1] + + build_tools_versions.append(parse(version)) + + return build_tools_versions def _android_update_sdk(self, packages): from pexpect import EOF @@ -376,9 +422,6 @@ class TargetAndroid(Target): break child.sendline('y') - def _build_package_string(self, package_name, version): - return '{}-{}'.format(package_name, version) - def _read_version_subdir(self, *args): versions = [] if not os.path.exists(join(*args)): @@ -420,68 +463,38 @@ class TargetAndroid(Target): if self.buildozer.state.get(cache_key, None) == cache_value: return True - # 3 pass installation. - if not os.access(self.android_cmd, os.X_OK): - self.buildozer.cmd('chmod ug+x {}'.format(self.android_cmd)) - # 1. update the tool and platform-tools if needed - packages = self._android_list_sdk() - skip_upd = self.buildozer.config.getdefault('app', - 'android.skip_update', False) - if 'tools' in packages or 'platform-tools' in packages: - if not skip_upd: - if WSL: - # WSL (Windows Subsystem for Linux) allows running - # linux from windows 10, but some windows - # limitations still apply, namely you can't rename a - # directory that a program was started from, which - # is what the tools updates cause, and we end up - # with an empty dir, so we need to run from a - # different place, and the updater is still looking - # for things in tools, and specifically renames the - # tool dir, hence, moving and making a symlink - # works. - sh.mv( - join(self.android_sdk_dir, 'tools'), - join(self.android_sdk_dir, 'tools.save') - ) - sh.ln( - '-s', - join(self.android_sdk_dir, 'tools.save'), - join(self.android_sdk_dir, 'tools') - ) - old_android_cmd = self.android_cmd - self.android_cmd = join( - self.android_sdk_dir, - 'tools.save', - self.android_cmd.split('/')[-1] - ) - self._android_update_sdk('tools,platform-tools') + skip_upd = self.buildozer.config.getdefault( + 'app', 'android.skip_update', False) - if WSL: - self.android_cmd = old_android_cmd - sh.rm('-rf', join(self.android_sdk_dir, 'tools.save')) - else: - self.buildozer.info('Skipping Android SDK update due to spec file setting') + if not skip_upd: + # just calling sdkmanager with the items will install them if necessary + self._sdkmanager('tools', 'platform-tools') + self._sdkmanager('--update') + else: + self.buildozer.info('Skipping Android SDK update due to spec file setting') + self.buildozer.info('Note: this also prevents installing missing ' + 'SDK components') # 2. install the latest build tool - v_build_tools = self._read_version_subdir(self.android_sdk_dir, + installed_v_build_tools = self._read_version_subdir(self.android_sdk_dir, 'build-tools') - packages = self._android_list_sdk(include_all=True) - ver = self._find_latest_package(packages, 'build-tools-') - if ver and ver > v_build_tools and not skip_upd: - self._android_update_sdk(self._build_package_string('build-tools', ver)) + available_v_build_tools = self._android_list_build_tools_versions() + if not available_v_build_tools: + self.buildozer.warning('Did not find any build tools available to download') + + latest_v_build_tools = sorted(available_v_build_tools)[-1] + if latest_v_build_tools > installed_v_build_tools and not skip_upd: + self._sdkmanager('"build-tools;{}"'.format(latest_v_build_tools)) + # 2. check aidl can be run self._check_aidl(v_build_tools) # 3. finally, install the android for the current api android_platform = join(self.android_sdk_dir, 'platforms', 'android-{0}'.format(self.android_api)) - if not self.buildozer.file_exists(android_platform): - packages = self._android_list_sdk() - android_package = 'android-{}'.format(self.android_api) - if android_package in packages and not skip_upd: - self._android_update_sdk(android_package) + if not self.buildozer.file_exists(android_platform) and not skip_upd: + self._sdkmanager('"platforms;android-{}"'.format(self.android_api)) self.buildozer.info('Android packages installation done.') @@ -586,81 +599,190 @@ class TargetAndroid(Target): options = "--user" if "VIRTUAL_ENV" in os.environ or "CONDA_PREFIX" in os.environ: options = "" + print('pa dir', self.pa_dir) + print('pip_deps', pip_deps) cmd('{} -m pip install -q {} {}'.format(executable, options, " ".join(pip_deps))) - def get_available_packages(self): - available_modules = self.buildozer.cmd('./distribute.sh -l', - cwd=self.pa_dir, - get_stdout=True)[0] - if not available_modules.startswith('Available modules:'): - self.buildozer.error('Python-for-android invalid output for -l') - return available_modules[19:].splitlines()[0].split() - def compile_platform(self): - # for android, the compilation depends really on the app requirements. - # compile the distribution only if the requirements changed. - last_requirements = self.buildozer.state.get('android.requirements', - '') - app_requirements = self.buildozer.config.getlist('app', 'requirements', - '') - - # we need to extract the requirements that python-for-android knows - # about - available_modules = self.get_available_packages() - onlyname = lambda x: x.split('==')[0] - android_requirements = [x - for x in app_requirements - if onlyname(x) in available_modules] - - need_compile = 0 - if last_requirements != android_requirements: - need_compile = 1 - + app_requirements = self.buildozer.config.getlist( + 'app', 'requirements', '') dist_name = self.buildozer.config.get('app', 'package.name') - dist_dir = join(self.pa_dir, 'dist', dist_name) - dist_file = join(dist_dir, 'private', 'include', 'python2.7', - 'pyconfig.h') - if not exists(dist_file): - need_compile = 1 + local_recipes = self.get_local_recipes_dir() + requirements = ','.join(app_requirements) + options = [] - # len('requirements.source.') == 20, so use name[20:] source_dirs = { 'P4A_{}_DIR'.format(name[20:]): realpath(expanduser(value)) for name, value in self.buildozer.config.items('app') if name.startswith('requirements.source.') - } + } if source_dirs: self.buildozer.environ.update(source_dirs) self.buildozer.info('Using custom source dirs:\n {}'.format( '\n '.join(['{} = {}'.format(k, v) for k, v in source_dirs.items()]))) - last_source_requirements = self.buildozer.state.get( - 'android.requirements.source', {}) - if source_dirs != last_source_requirements: - need_compile = 1 + if self.buildozer.config.getbooldefault('app', 'android.copy_libs', True): + options.append("--copy-libs") + # support for recipes in a local directory within the project + if local_recipes: + options.append('--local-recipes') + options.append(local_recipes) + config = self.buildozer.config + self._p4a( + ("create --dist_name={} --bootstrap={} --requirements={} " + "--arch {} {}").format( + dist_name, self._p4a_bootstrap, requirements, + config.getdefault('app', 'android.arch', "armeabi-v7a"), " ".join(options)), + get_stdout=True)[0] - if not need_compile: - self.buildozer.info('Distribution already compiled, pass.') - return + def get_available_packages(self): + return True - modules_str = ' '.join(android_requirements) - cmd = self.buildozer.cmd - self.buildozer.debug('Clean and build python-for-android') - self.buildozer.rmdir(dist_dir) # Delete existing distribution to stop - # p4a complaining - cmd('./distribute.sh -m "{0}" -d "{1}"'.format(modules_str, dist_name), - cwd=self.pa_dir) - self.buildozer.debug('Remove temporary build files') - self.buildozer.rmdir(join(self.pa_dir, 'build')) - self.buildozer.rmdir(join(self.pa_dir, '.packages')) - self.buildozer.rmdir(join(self.pa_dir, 'src', 'jni', 'obj', 'local')) - self.buildozer.info('Distribution compiled.') + def get_dist_dir(self, dist_name): + return join(self._build_dir, 'dists', dist_name) - # ensure we will not compile again - self.buildozer.state['android.requirements'] = android_requirements - self.buildozer.state['android.requirements.source'] = source_dirs - self.buildozer.state.sync() + def get_local_recipes_dir(self): + local_recipes = self.buildozer.config.getdefault('app', 'p4a.local_recipes') + return realpath(expanduser(local_recipes)) if local_recipes else None + + def execute_build_package(self, build_cmd): + # wrapper from previous old_toolchain to new toolchain + dist_name = self.buildozer.config.get('app', 'package.name') + local_recipes = self.get_local_recipes_dir() + cmd = [self.p4a_apk_cmd, "--dist_name", dist_name] + for args in build_cmd: + option, values = args[0], args[1:] + if option == "debug": + continue + elif option == "release": + cmd.append("--release") + if self.check_p4a_sign_env(True): + cmd.append("--sign") + continue + if option == "--window": + cmd.append("--window") + elif option == "--sdk": + cmd.append("--android_api") + cmd.extend(values) + else: + cmd.extend(args) + + # support for presplash background color + presplash_color = self.buildozer.config.getdefault('app', 'android.presplash_color', None) + if presplash_color: + cmd.append('--presplash-color') + cmd.append("'{}'".format(presplash_color)) + + # support for services + services = self.buildozer.config.getlist('app', 'services', []) + for service in services: + cmd.append("--service") + cmd.append(service) + + # support for copy-libs + if self.buildozer.config.getbooldefault('app', 'android.copy_libs', True): + cmd.append("--copy-libs") + + # support for recipes in a local directory within the project + if local_recipes: + cmd.append('--local-recipes') + cmd.append(local_recipes) + + # support for blacklist/whitelist filename + whitelist_src = self.buildozer.config.getdefault('app', 'android.whitelist_src', None) + blacklist_src = self.buildozer.config.getdefault('app', 'android.blacklist_src', None) + if whitelist_src: + cmd.append('--whitelist') + cmd.append(realpath(whitelist_src)) + if blacklist_src: + cmd.append('--blacklist') + cmd.append(realpath(blacklist_src)) + + # support for aars + aars = self.buildozer.config.getlist('app', 'android.add_aars', []) + for aar in aars: + cmd.append('--add-aar') + cmd.append(realpath(aar)) + + # support for gradle dependencies + gradle_dependencies = self.buildozer.config.getlist('app', 'android.gradle_dependencies', []) + for gradle_dependency in gradle_dependencies: + cmd.append('--depend') + cmd.append(gradle_dependency) + + cmd.append('--arch') + cmd.append(self.buildozer.config.getdefault('app', 'android.arch', "armeabi-v7a")) + + cmd = " ".join(cmd) + self._p4a(cmd) + + def get_release_mode(self): + if self.check_p4a_sign_env(): + return "release" + return "release-unsigned" + + def check_p4a_sign_env(self, error=False): + keys = ["KEYALIAS", "KEYSTORE_PASSWD", "KEYSTORE", "KEYALIAS_PASSWD"] + check = True + for key in keys: + key = "P4A_RELEASE_{}".format(key) + if key not in os.environ: + if error: + self.buildozer.error( + ("Asking for release but {} is missing" + "--sign will not be passed").format(key)) + check = False + return check + + def cmd_run(self, *args): + entrypoint = self.buildozer.config.getdefault( + 'app', 'android.entrypoint') + if not entrypoint: + self.buildozer.config.set('app', 'android.entrypoint', 'org.kivy.android.PythonActivity') + + super(TargetAndroid, self).cmd_run(*args) + + entrypoint = self.buildozer.config.getdefault( + 'app', 'android.entrypoint', 'org.renpy.android.PythonActivity') + package = self._get_package() + + # push on the device + for serial in self.serials: + self.buildozer.environ['ANDROID_SERIAL'] = serial + self.buildozer.info('Run on {}'.format(serial)) + self.buildozer.cmd( + '{adb} shell am start -n {package}/{entry} -a {entry}'.format( + adb=self.adb_cmd, + package=package, + entry=entrypoint), + cwd=self.buildozer.global_platform_dir) + self.buildozer.environ.pop('ANDROID_SERIAL', None) + + self.buildozer.info('Application started.') + + def cmd_p4a(self, *args): + ''' + Run p4a commands. Args must come after --, or + use --alias to make an alias + ''' + self.check_requirements() + self.install_platform() + args = args[0] + if args and args[0] == '--alias': + print('To set up p4a in this shell session, execute:') + print(' alias p4a=$(buildozer {} p4a --alias 2>&1 >/dev/null)' + .format(self.targetname)) + sys.stderr.write('PYTHONPATH={} {}\n'.format(self.pa_dir, self._p4a_cmd)) + else: + self._p4a(' '.join(args) if args else '') + + def cmd_clean(self, *args): + ''' + Clean the build and distribution + ''' + self._p4a("clean_builds") + self._p4a("clean_dists") def _get_package(self): config = self.buildozer.config @@ -678,22 +800,6 @@ class TargetAndroid(Target): for wl in p4a_whitelist: fd.write(wl + '\n') - 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] - for args in build_cmd: - cmd.append(" ".join(args)) - cmd = " ".join(cmd) - self.buildozer.cmd(cmd, cwd=self.get_dist_dir(dist_name)) - def build_package(self): dist_name = self.buildozer.config.get('app', 'package.name') dist_dir = self.get_dist_dir(dist_name) @@ -892,9 +998,6 @@ class TargetAndroid(Target): self.buildozer.state['android:latestapk'] = apk_dest self.buildozer.state['android:latestmode'] = self.build_mode - def get_release_mode(self): - return "release-unsigned" - def _update_libraries_references(self, dist_dir): # ensure the project.properties exist project_fn = join(dist_dir, 'project.properties') @@ -1029,27 +1132,6 @@ class TargetAndroid(Target): self.buildozer.info('Application pushed.') - def cmd_run(self, *args): - super(TargetAndroid, self).cmd_run(*args) - - entrypoint = self.buildozer.config.getdefault( - 'app', 'android.entrypoint', 'org.renpy.android.PythonActivity') - package = self._get_package() - - # push on the device - for serial in self.serials: - self.buildozer.environ['ANDROID_SERIAL'] = serial - self.buildozer.info('Run on {}'.format(serial)) - self.buildozer.cmd( - '{adb} shell am start -n {package}/{entry} -a {entry}'.format( - adb=self.adb_cmd, - package=package, - entry=entrypoint), - cwd=self.buildozer.global_platform_dir) - self.buildozer.environ.pop('ANDROID_SERIAL', None) - - self.buildozer.info('Application started.') - def cmd_logcat(self, *args): '''Show the log from the device ''' diff --git a/buildozer/targets/android_new.py b/buildozer/targets/android_new.py deleted file mode 100644 index 1fcc296..0000000 --- a/buildozer/targets/android_new.py +++ /dev/null @@ -1,217 +0,0 @@ -# coding=utf-8 -''' -Android target, based on python-for-android project -''' - -import sys -import os - -from buildozer import USE_COLOR -from buildozer.targets.android import TargetAndroid -from os.path import join, expanduser, realpath - - -class TargetAndroidNew(TargetAndroid): - targetname = 'android' - p4a_branch = "master" - p4a_directory = "python-for-android-new-toolchain" - p4a_apk_cmd = "apk --debug --bootstrap=" - extra_p4a_args = '' - - def __init__(self, *args, **kwargs): - super(TargetAndroidNew, self).__init__(*args, **kwargs) - self._build_dir = join(self.buildozer.platform_dir, 'build') - executable = sys.executable or 'python' - self._p4a_cmd = '{} -m pythonforandroid.toolchain '.format(executable) - self._p4a_bootstrap = self.buildozer.config.getdefault( - '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( - color, self._build_dir) - - # minapi should match ndk-api, so can use the same default if - # nothing is specified - ndk_api = self.buildozer.config.getdefault( - 'app', 'android.ndk_api', self.android_minapi) - self.extra_p4a_args += ' --ndk-api={}'.format(ndk_api) - - hook = self.buildozer.config.getdefault("app", "p4a.hook", None) - if hook is not None: - self.extra_p4a_args += ' --hook={}'.format(realpath(hook)) - port = self.buildozer.config.getdefault('app', 'p4a.port', None) - if port is not None: - self.extra_p4a_args += ' --port={}'.format(port) - - def _p4a(self, cmd, **kwargs): - if not hasattr(self, "pa_dir"): - self.pa_dir = join(self.buildozer.platform_dir, self.p4a_directory) - kwargs.setdefault('cwd', self.pa_dir) - return self.buildozer.cmd(self._p4a_cmd + cmd + self.extra_p4a_args, **kwargs) - - def get_available_packages(self): - return True - - def compile_platform(self): - app_requirements = self.buildozer.config.getlist( - 'app', 'requirements', '') - dist_name = self.buildozer.config.get('app', 'package.name') - local_recipes = self.get_local_recipes_dir() - requirements = ','.join(app_requirements) - options = [] - - source_dirs = { - 'P4A_{}_DIR'.format(name[20:]): realpath(expanduser(value)) - for name, value in self.buildozer.config.items('app') - if name.startswith('requirements.source.') - } - if source_dirs: - self.buildozer.environ.update(source_dirs) - self.buildozer.info('Using custom source dirs:\n {}'.format( - '\n '.join(['{} = {}'.format(k, v) - for k, v in source_dirs.items()]))) - - if self.buildozer.config.getbooldefault('app', 'android.copy_libs', True): - options.append("--copy-libs") - # support for recipes in a local directory within the project - if local_recipes: - options.append('--local-recipes') - options.append(local_recipes) - config = self.buildozer.config - self._p4a( - ("create --dist_name={} --bootstrap={} --requirements={} " - "--arch {} {}").format( - dist_name, self._p4a_bootstrap, requirements, - config.getdefault('app', 'android.arch', "armeabi-v7a"), " ".join(options)), - get_stdout=True)[0] - - def get_dist_dir(self, dist_name): - return join(self._build_dir, 'dists', dist_name) - - def get_local_recipes_dir(self): - local_recipes = self.buildozer.config.getdefault('app', 'p4a.local_recipes') - return realpath(expanduser(local_recipes)) if local_recipes else None - - def execute_build_package(self, build_cmd): - # wrapper from previous old_toolchain to new toolchain - dist_name = self.buildozer.config.get('app', 'package.name') - local_recipes = self.get_local_recipes_dir() - cmd = [self.p4a_apk_cmd, "--dist_name", dist_name] - for args in build_cmd: - option, values = args[0], args[1:] - if option == "debug": - continue - elif option == "release": - cmd.append("--release") - if self.check_p4a_sign_env(True): - cmd.append("--sign") - continue - if option == "--window": - cmd.append("--window") - elif option == "--sdk": - cmd.append("--android_api") - cmd.extend(values) - else: - cmd.extend(args) - - # support for presplash background color - presplash_color = self.buildozer.config.getdefault('app', 'android.presplash_color', None) - if presplash_color: - cmd.append('--presplash-color') - cmd.append("'{}'".format(presplash_color)) - - # support for services - services = self.buildozer.config.getlist('app', 'services', []) - for service in services: - cmd.append("--service") - cmd.append(service) - - # support for copy-libs - if self.buildozer.config.getbooldefault('app', 'android.copy_libs', True): - cmd.append("--copy-libs") - - # support for recipes in a local directory within the project - if local_recipes: - cmd.append('--local-recipes') - cmd.append(local_recipes) - - # support for blacklist/whitelist filename - whitelist_src = self.buildozer.config.getdefault('app', 'android.whitelist_src', None) - blacklist_src = self.buildozer.config.getdefault('app', 'android.blacklist_src', None) - if whitelist_src: - cmd.append('--whitelist') - cmd.append(realpath(whitelist_src)) - if blacklist_src: - cmd.append('--blacklist') - cmd.append(realpath(blacklist_src)) - - # support for aars - aars = self.buildozer.config.getlist('app', 'android.add_aars', []) - for aar in aars: - cmd.append('--add-aar') - cmd.append(realpath(aar)) - - # support for gradle dependencies - gradle_dependencies = self.buildozer.config.getlist('app', 'android.gradle_dependencies', []) - for gradle_dependency in gradle_dependencies: - cmd.append('--depend') - cmd.append(gradle_dependency) - - cmd.append('--arch') - cmd.append(self.buildozer.config.getdefault('app', 'android.arch', "armeabi-v7a")) - - cmd = " ".join(cmd) - self._p4a(cmd) - - def get_release_mode(self): - if self.check_p4a_sign_env(): - return "release" - return "release-unsigned" - - def check_p4a_sign_env(self, error=False): - keys = ["KEYALIAS", "KEYSTORE_PASSWD", "KEYSTORE", "KEYALIAS_PASSWD"] - check = True - for key in keys: - key = "P4A_RELEASE_{}".format(key) - if key not in os.environ: - if error: - self.buildozer.error( - ("Asking for release but {} is missing" - "--sign will not be passed").format(key)) - check = False - return check - - def cmd_run(self, *args): - entrypoint = self.buildozer.config.getdefault( - 'app', 'android.entrypoint') - if not entrypoint: - self.buildozer.config.set('app', 'android.entrypoint', 'org.kivy.android.PythonActivity') - return super(TargetAndroidNew, self).cmd_run(*args) - - def cmd_p4a(self, *args): - ''' - Run p4a commands. Args must come after --, or - use --alias to make an alias - ''' - self.check_requirements() - self.install_platform() - args = args[0] - if args and args[0] == '--alias': - print('To set up p4a in this shell session, execute:') - print(' alias p4a=$(buildozer {} p4a --alias 2>&1 >/dev/null)' - .format(self.targetname)) - sys.stderr.write('PYTHONPATH={} {}\n'.format(self.pa_dir, self._p4a_cmd)) - else: - self._p4a(' '.join(args) if args else '') - - def cmd_clean(self, *args): - ''' - Clean the build and distribution - ''' - self._p4a("clean_builds") - self._p4a("clean_dists") - - -def get_target(buildozer): - buildozer.targetname = "android" - return TargetAndroidNew(buildozer) From 165dde84b130eff7b9d82297c28e08db98202c12 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Fri, 1 Feb 2019 15:16:49 +0000 Subject: [PATCH 051/218] Added license message parsing --- buildozer/targets/android.py | 78 ++++++++++++++++++++++++------------ 1 file changed, 52 insertions(+), 26 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index dd9782f..7176536 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -78,8 +78,13 @@ class TargetAndroid(Target): kwargs.setdefault('cwd', self.pa_dir) return self.buildozer.cmd(self._p4a_cmd + cmd + self.extra_p4a_args, **kwargs) - def _sdkmanager(self, *args): + def _sdkmanager(self, *args, **kwargs): """Call the sdkmanager in our Android SDK with the given arguments.""" + # Use the android-sdk dir as cwd by default + kwargs['cwd'] = kwargs.get( + 'cwd', os.path.join(self.buildozer.global_platform_dir, + 'android-sdk')) + sdkmanager_path = os.path.join(self.buildozer.global_platform_dir, 'android-sdk', 'tools', @@ -87,8 +92,14 @@ class TargetAndroid(Target): 'sdkmanager') assert os.path.isfile(sdkmanager_path) - return self.buildozer.cmd(sdkmanager_path + ' ' + ' '.join(args), - get_stdout=True) + command = sdkmanager_path + ' ' + ' '.join(args) + + return_child = kwargs.pop('return_child', False) + if return_child: + return self.buildozer.cmd_expect(command, **kwargs) + else: + kwargs['get_stdout'] = kwargs.get('get_stdout', True) + return self.buildozer.cmd(command, **kwargs) @property @@ -148,19 +159,15 @@ class TargetAndroid(Target): self._set_win32_java_home() except: traceback.print_exc() - self.android_cmd = join(self.android_sdk_dir, 'tools', - 'android.bat') self.adb_cmd = join(self.android_sdk_dir, 'platform-tools', 'adb.exe') self.javac_cmd = self._locate_java('javac.exe') self.keytool_cmd = self._locate_java('keytool.exe') elif platform in ('darwin', ): - self.android_cmd = join(self.android_sdk_dir, 'tools', 'android') self.adb_cmd = join(self.android_sdk_dir, 'platform-tools', 'adb') self.javac_cmd = self._locate_java('javac') self.keytool_cmd = self._locate_java('keytool') else: - self.android_cmd = join(self.android_sdk_dir, 'tools', 'android') self.adb_cmd = join(self.android_sdk_dir, 'platform-tools', 'adb') self.javac_cmd = self._locate_java('javac') self.keytool_cmd = self._locate_java('keytool') @@ -403,21 +410,22 @@ class TargetAndroid(Target): return build_tools_versions - def _android_update_sdk(self, packages): + def _android_update_sdk(self, *sdkmanager_commands): + """Update the tools and package-tools if possible""" from pexpect import EOF java_tool_options = environ.get('JAVA_TOOL_OPTIONS', '') - child = self.buildozer.cmd_expect( - '{} update sdk -u -a -t {}'.format( - self.android_cmd, - packages, - cwd=self.buildozer.global_platform_dir), + env = os.environ.copy() + env.update({ + 'JAVA_TOOL_OPTIONS': java_tool_options + + ' -Dfile.encoding=UTF-8' + }) + child = self._sdkmanager( + *sdkmanager_commands, timeout=None, - env={ - 'JAVA_TOOL_OPTIONS': java_tool_options + - ' -Dfile.encoding=UTF-8' - }) + return_child=True, + env=env) while True: - index = child.expect([EOF, u'[y/n]: ']) + index = child.expect([EOF, u'\(y/N\): ']) if index == 0: break child.sendline('y') @@ -468,15 +476,19 @@ class TargetAndroid(Target): skip_upd = self.buildozer.config.getdefault( 'app', 'android.skip_update', False) + print('Got this far') if not skip_upd: # just calling sdkmanager with the items will install them if necessary - self._sdkmanager('tools', 'platform-tools') - self._sdkmanager('--update') + self._android_update_sdk('tools', 'platform-tools') + self._android_update_sdk('--update') else: self.buildozer.info('Skipping Android SDK update due to spec file setting') self.buildozer.info('Note: this also prevents installing missing ' 'SDK components') + # print('Exiting') + # exit(1) + # 2. install the latest build tool installed_v_build_tools = self._read_version_subdir(self.android_sdk_dir, 'build-tools') @@ -485,16 +497,30 @@ class TargetAndroid(Target): self.buildozer.warning('Did not find any build tools available to download') latest_v_build_tools = sorted(available_v_build_tools)[-1] - if latest_v_build_tools > installed_v_build_tools and not skip_upd: - self._sdkmanager('"build-tools;{}"'.format(latest_v_build_tools)) + if latest_v_build_tools > installed_v_build_tools: + if not skip_upd: + self._android_update_sdk( + '"build-tools;{}"'.format(latest_v_build_tools)) + installed_v_build_tools = latest_v_build_tools + else: + self.buildozer.info( + 'Skipping update to build tools {} due to spec setting'.format( + latest_v_build_tools)) + + exit(1) # 2. check aidl can be run - self._check_aidl(v_build_tools) + self._check_aidl(installed_v_build_tools) # 3. finally, install the android for the current api - android_platform = join(self.android_sdk_dir, 'platforms', 'android-{0}'.format(self.android_api)) - if not self.buildozer.file_exists(android_platform) and not skip_upd: - self._sdkmanager('"platforms;android-{}"'.format(self.android_api)) + android_platform = join(self.android_sdk_dir, 'platforms', 'android-{}'.format(self.android_api)) + if not self.buildozer.file_exists(android_platform): + if not skip_upd: + self._sdkmanager('"platforms;android-{}"'.format(self.android_api)) + else: + self.buildozer.info( + 'Skipping install API {} platform tools due to spec setting'.format( + self.android_api)) self.buildozer.info('Android packages installation done.') From 07c8b9ec8ead50a2d2e7696185db52bb62086d9e Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Fri, 1 Feb 2019 15:30:23 +0000 Subject: [PATCH 052/218] Added auto_accept_license option --- buildozer/default.spec | 6 ++++++ buildozer/targets/android.py | 40 +++++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 16 deletions(-) diff --git a/buildozer/default.spec b/buildozer/default.spec index 90c7eb5..428abab 100644 --- a/buildozer/default.spec +++ b/buildozer/default.spec @@ -119,6 +119,12 @@ fullscreen = 0 # when an update is due and you just want to test/build your package # android.skip_update = False +# (bool) If True, then automatically accept SDK license +# agreements. This is intended for automation only. If set to False, +# the default, you will be shown the license when first running +# buildozer. +# android.accept_sdk_license = False + # (str) Android entry point, default is ok for Kivy-based app #android.entrypoint = org.renpy.android.PythonActivity diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 7176536..fe12211 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -413,22 +413,30 @@ class TargetAndroid(Target): def _android_update_sdk(self, *sdkmanager_commands): """Update the tools and package-tools if possible""" from pexpect import EOF - java_tool_options = environ.get('JAVA_TOOL_OPTIONS', '') - env = os.environ.copy() - env.update({ - 'JAVA_TOOL_OPTIONS': java_tool_options + - ' -Dfile.encoding=UTF-8' - }) - child = self._sdkmanager( - *sdkmanager_commands, - timeout=None, - return_child=True, - env=env) - while True: - index = child.expect([EOF, u'\(y/N\): ']) - if index == 0: - break - child.sendline('y') + + auto_accept_license = self.buildozer.config.getdefault( + 'app', 'android.accept_sdk_license', False) + + if auto_accept_license: + java_tool_options = environ.get('JAVA_TOOL_OPTIONS', '') + env = os.environ.copy() + env.update({ + 'JAVA_TOOL_OPTIONS': java_tool_options + + ' -Dfile.encoding=UTF-8' + }) + child = self._sdkmanager( + *sdkmanager_commands, + timeout=None, + return_child=True, + env=env) + while True: + index = child.expect([EOF, u'\(y/N\): ']) + if index == 0: + break + child.sendline('y') + else: + # the user will be prompted to read and accept the license + self._sdkmanager(*sdkmanager_commands) def _read_version_subdir(self, *args): versions = [] From 31b1eaeb43276cbc5673817facf03394994fd0f4 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Fri, 1 Feb 2019 16:56:55 +0000 Subject: [PATCH 053/218] Removed references to android SDK version token --- buildozer/targets/android.py | 58 ++++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index fe12211..4f54a65 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -90,7 +90,10 @@ class TargetAndroid(Target): 'tools', 'bin', 'sdkmanager') - assert os.path.isfile(sdkmanager_path) + if not os.path.isfile(sdkmanager_path): + raise BuildozerException( + ('sdkmanager path "{}" does not exist, sdkmanager is not' + 'installed'.format(sdkmanager_path))) command = sdkmanager_path + ' ' + ' '.join(args) @@ -221,9 +224,11 @@ class TargetAndroid(Target): key = 'android:available_permissions' key_sdk = 'android:available_permissions_sdk' + current_platform_tools = self._android_get_installed_platform_tools_version() + refresh_permissions = False sdk = self.buildozer.state.get(key_sdk, None) - if not sdk or sdk != self.android_sdk_version: + if not sdk or sdk != current_platform_tools: refresh_permissions = True if key not in self.buildozer.state: refresh_permissions = True @@ -243,7 +248,7 @@ class TargetAndroid(Target): available_permissions = [x.attrib['name'] for x in fields] self.buildozer.state[key] = available_permissions - self.buildozer.state[key_sdk] = self.android_sdk_version + self.buildozer.state[key_sdk] = current_platform_tools return available_permissions except: return None @@ -311,7 +316,6 @@ class TargetAndroid(Target): if not os.path.exists(sdk_dir): os.makedirs(sdk_dir) - archive = archive.format(self.android_sdk_version) url = 'http://dl.google.com/android/repository/' self.buildozer.download(url, archive, @@ -410,6 +414,39 @@ class TargetAndroid(Target): return build_tools_versions + def _android_get_installed_platform_tools_version(self): + """ + Crudely parse out the installed platform-tools version + """ + + platform_tools_dir = os.path.join( + self.android_sdk_dir, + 'platform-tools') + + if not os.path.exists(platform_tools_dir): + return None + + data_file = os.path.join(platform_tools_dir, 'source.properties') + if not os.path.exists(data_file): + return None + + with open(data_file, 'r') as fileh: + lines = fileh.readlines() + + for line in lines: + if line.startswith('Pkg.Revision='): + break + else: + self.buildozer.error('Read {} but found no Pkg.Revision'.format(data_file)) + # Don't actually exit, in case the build env is + # okay. Something else will fault if it's important. + return None + + revision = line.split('=')[1].strip() + + return revision + + def _android_update_sdk(self, *sdkmanager_commands): """Update the tools and package-tools if possible""" from pexpect import EOF @@ -484,8 +521,9 @@ class TargetAndroid(Target): skip_upd = self.buildozer.config.getdefault( 'app', 'android.skip_update', False) - print('Got this far') if not skip_upd: + self.buildozer.info('Installing/updating SDK platform tools if necessary') + # just calling sdkmanager with the items will install them if necessary self._android_update_sdk('tools', 'platform-tools') self._android_update_sdk('--update') @@ -494,15 +532,13 @@ class TargetAndroid(Target): self.buildozer.info('Note: this also prevents installing missing ' 'SDK components') - # print('Exiting') - # exit(1) - # 2. install the latest build tool + self.buildozer.info('Updating SDK build tools if necessary') installed_v_build_tools = self._read_version_subdir(self.android_sdk_dir, 'build-tools') available_v_build_tools = self._android_list_build_tools_versions() if not available_v_build_tools: - self.buildozer.warning('Did not find any build tools available to download') + self.buildozer.error('Did not find any build tools available to download') latest_v_build_tools = sorted(available_v_build_tools)[-1] if latest_v_build_tools > installed_v_build_tools: @@ -515,12 +551,11 @@ class TargetAndroid(Target): 'Skipping update to build tools {} due to spec setting'.format( latest_v_build_tools)) - exit(1) - # 2. check aidl can be run self._check_aidl(installed_v_build_tools) # 3. finally, install the android for the current api + self.buildozer.info('Downloading platform api target if necessary') android_platform = join(self.android_sdk_dir, 'platforms', 'android-{}'.format(self.android_api)) if not self.buildozer.file_exists(android_platform): if not skip_upd: @@ -578,7 +613,6 @@ class TargetAndroid(Target): 'ANDROIDNDK': self.android_ndk_dir, 'ANDROIDAPI': self.android_api, 'ANDROIDMINAPI': self.android_minapi, - 'ANDROIDNDKVER': 'r{}'.format(self.android_ndk_version) }) def _install_p4a(self): From 632731cc98bba63346e7a69f340f6cdf4b9ba063 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Fri, 1 Feb 2019 17:07:19 +0000 Subject: [PATCH 054/218] Completely removed android_sdk_version token --- buildozer/targets/android.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 4f54a65..d9b4961 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -16,7 +16,6 @@ WSL = 'Microsoft' in uname()[2] ANDROID_API = '27' ANDROID_MINAPI = '21' -ANDROID_SDK_VERSION = '20' ANDROID_NDK_VERSION = '17c' APACHE_ANT_VERSION = '1.9.4' @@ -39,6 +38,7 @@ from glob import glob from buildozer.libs.version import parse from distutils.version import LooseVersion +DEPRECATED_TOKENS = (('app', 'android.sdk'), ) class TargetAndroid(Target): targetname = 'android' @@ -72,6 +72,16 @@ class TargetAndroid(Target): if port is not None: self.extra_p4a_args += ' --port={}'.format(port) + self.warn_on_deprecated_tokens() + + def warn_on_deprecated_tokens(self): + for section, token in DEPRECATED_TOKENS: + value = self.buildozer.config.getdefault(section, token, None) + if value is not None: + error = ('WARNING: Config token {} {} is deprecated and ignored, ' + 'but you set value {}').format(section, token, value) + self.buildozer.error(error) + def _p4a(self, cmd, **kwargs): if not hasattr(self, "pa_dir"): self.pa_dir = join(self.buildozer.platform_dir, self.p4a_directory) @@ -104,12 +114,6 @@ class TargetAndroid(Target): kwargs['get_stdout'] = kwargs.get('get_stdout', True) return self.buildozer.cmd(command, **kwargs) - - @property - def android_sdk_version(self): - return self.buildozer.config.getdefault('app', 'android.sdk', - ANDROID_SDK_VERSION) - @property def android_ndk_version(self): return self.buildozer.config.getdefault('app', 'android.ndk', From 965204910cbf92874a9be46f7483f9749623c7d5 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Fri, 1 Feb 2019 17:29:35 +0000 Subject: [PATCH 055/218] Improved doc around sdk download url --- buildozer/targets/android.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index d9b4961..1f3fc63 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -38,8 +38,15 @@ from glob import glob from buildozer.libs.version import parse from distutils.version import LooseVersion +# buildozer.spec tokens that used to exist but are now ignored DEPRECATED_TOKENS = (('app', 'android.sdk'), ) +# Default SDK tag to download. This is not a configurable option +# because it doesn't seem to matter much, it is normally correct to +# download once then update all the components as buildozer already +# does. +DEFAULT_SDK_TAG = '4333796' + class TargetAndroid(Target): targetname = 'android' p4a_directory = "python-for-android" @@ -306,13 +313,13 @@ class TargetAndroid(Target): self.buildozer.info('Android SDK is missing, downloading') if platform in ('win32', 'cygwin'): - archive = 'sdk-tools-windows-4333796.zip' + archive = 'sdk-tools-windows-{}.zip'.format(DEFAULT_SDK_TAG) unpacked = 'android-sdk-windows' elif platform in ('darwin', ): - archive = 'sdk-tools-darwin-4333796.zip' + archive = 'sdk-tools-darwin-{}.zip'.format(DEFAULT_SDK_TAG) unpacked = 'android-sdk-macosx' elif platform.startswith('linux'): - archive = 'sdk-tools-linux-4333796.zip' + archive = 'sdk-tools-linux-{}.zip'.format(DEFAULT_SDK_TAG) unpacked = 'android-sdk-linux' else: raise SystemError('Unsupported platform: {0}'.format(platform)) From 6d1d5e9b0d78e2780df9a5ca90299298a538e005 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Fri, 1 Feb 2019 18:06:10 +0000 Subject: [PATCH 056/218] Removed debug print statements --- buildozer/targets/android.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index 1f3fc63..e0c43b3 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -678,8 +678,6 @@ class TargetAndroid(Target): options = "--user" if "VIRTUAL_ENV" in os.environ or "CONDA_PREFIX" in os.environ: options = "" - print('pa dir', self.pa_dir) - print('pip_deps', pip_deps) cmd('{} -m pip install -q {} {}'.format(executable, options, " ".join(pip_deps))) def compile_platform(self): From 100bf932e7b0b417f2749ebdf181fa6e748906d0 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Fri, 1 Feb 2019 18:08:10 +0000 Subject: [PATCH 057/218] Removed android_old references --- README.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.rst b/README.rst index b8fa18b..e819ae8 100644 --- a/README.rst +++ b/README.rst @@ -134,7 +134,6 @@ Usage Available targets: android Android target, based on python-for-android project ios iOS target, based on kivy-ios project - android_old Android target, based on python-for-android project (old toolchain) Global commands (without target): distclean Clean the whole Buildozer environment. @@ -153,11 +152,6 @@ Usage run Run the application on the device serve Serve the bin directory via SimpleHTTPServer - Target "android_old" commands: - adb Run adb from the Android SDK. Args must come after --, or - use --alias to make an alias - logcat Show the log from the device - Target "ios" commands: list_identities List the available identities to use for signing. xcode Open the xcode project. From a780cc470a9a999d90aa02e9e597b5337183618a Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Sat, 2 Feb 2019 14:18:45 +0000 Subject: [PATCH 058/218] Made buildozer respect user sdk dir when accessing sdkmanager --- buildozer/targets/android.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index e0c43b3..3ae5f14 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -98,12 +98,9 @@ class TargetAndroid(Target): def _sdkmanager(self, *args, **kwargs): """Call the sdkmanager in our Android SDK with the given arguments.""" # Use the android-sdk dir as cwd by default - kwargs['cwd'] = kwargs.get( - 'cwd', os.path.join(self.buildozer.global_platform_dir, - 'android-sdk')) + kwargs['cwd'] = kwargs.get('cwd', self.android_sdk_dir) - sdkmanager_path = os.path.join(self.buildozer.global_platform_dir, - 'android-sdk', + sdkmanager_path = os.path.join(self.android_sdk_dir, 'tools', 'bin', 'sdkmanager') @@ -120,7 +117,7 @@ class TargetAndroid(Target): else: kwargs['get_stdout'] = kwargs.get('get_stdout', True) return self.buildozer.cmd(command, **kwargs) - + @property def android_ndk_version(self): return self.buildozer.config.getdefault('app', 'android.ndk', @@ -422,7 +419,7 @@ class TargetAndroid(Target): version = package_name.split(';')[1] build_tools_versions.append(parse(version)) - + return build_tools_versions def _android_get_installed_platform_tools_version(self): @@ -456,7 +453,7 @@ class TargetAndroid(Target): revision = line.split('=')[1].strip() return revision - + def _android_update_sdk(self, *sdkmanager_commands): """Update the tools and package-tools if possible""" @@ -464,7 +461,7 @@ class TargetAndroid(Target): auto_accept_license = self.buildozer.config.getdefault( 'app', 'android.accept_sdk_license', False) - + if auto_accept_license: java_tool_options = environ.get('JAVA_TOOL_OPTIONS', '') env = os.environ.copy() @@ -484,7 +481,7 @@ class TargetAndroid(Target): child.sendline('y') else: # the user will be prompted to read and accept the license - self._sdkmanager(*sdkmanager_commands) + self._sdkmanager(*sdkmanager_commands) def _read_version_subdir(self, *args): versions = [] From 7c9239dd59c30e6bcfdffdbbc666629f4e91fe9c Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sun, 3 Feb 2019 12:28:11 +0100 Subject: [PATCH 059/218] update README.md to add opencollective --- README.md | 272 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 3 +- 2 files changed, 274 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..58d9386 --- /dev/null +++ b/README.md @@ -0,0 +1,272 @@ +Buildozer +========= + +[![travis](https://travis-ci.com/kivy/buildozer.svg?branch=master)](https://travis-ci.com/kivy/buildozer) +[![Backers on Open Collective](https://opencollective.com/kivy/backers/badge.svg)](#backers) +[![Sponsors on Open Collective](https://opencollective.com/kivy/sponsors/badge.svg)](#sponsors) + +Buildozer is a tool for creating application packages easily. + +The goal is to have one "buildozer.spec" file in your app directory, describing +your application requirements and settings such as title, icon, included modules +etc. Buildozer will use that spec to create a package for Android, iOS, Windows, +OSX and/or Linux. + +Buildozer currently supports packaging for Android via the [python-for-android](http://github.com/kivy/python-for-android/) +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-Information](https://github.com/kivy/kivy/wiki/Android-SDK-NDK-Information). Please note that +the default SDK/NDK coded in Buildozer works for target Python 2. +For target Python 3, use appropriate SDK/NDK as per the documentation, and ensure you +have `python3` in your requirements. +You can still use Crystax 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 target Python 3 (default): + +- Install buildozer: + + # via pip (latest stable, recommended) + sudo pip install buildozer + + # latest dev version + sudo pip install https://github.com/kivy/buildozer/archive/master.zip + + # git clone, for working on buildozer + git clone https://github.com/kivy/buildozer + cd buildozer + python setup.py build + sudo pip install -e . + +- Go into your application directory and run: + + buildozer init + # edit the buildozer.spec, then + buildozer android debug deploy run + +## Installing Buildozer with target Python 2 + +- Follow the same installation and buildozer init as Python 3 + +- Make sure the following lines are in your buildozer.spec file.: + + # Changes python3 to python2 + requirements = python2,kivy + +- Finally, build, deploy and run the app on your phone:: + + buildozer android debug deploy run + + +## Installing Buildozer with target Python 3 (CrystaX, deprecated): + +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 + +- Make sure the following lines are in your buildozer.spec file.: + + # Require python3crystax: + requirements = python3crystax,kivy + + # Point to the directory where you extracted the crystax-ndk: + android.ndk_path = + +- Finally, build, deploy and run the app on your phone:: + + buildozer android debug deploy run + + +## 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 + +``` +# buildozer target command +buildozer android clean +buildozer android update +buildozer android deploy +buildozer android debug +buildozer android release + +# or all in one (compile in debug, deploy on device) +buildozer android debug deploy + +# set the default command if nothing set +buildozer setdefault android debug deploy run +``` + + +## Usage + +``` +Usage: + buildozer [--profile ] [--verbose] [target] ... + buildozer --version + +Available targets: + android Android target, based on python-for-android project + ios iOS target, based on kivy-ios project + +Global commands (without target): + distclean Clean the whole Buildozer environment. + help Show the Buildozer help. + init Create a initial buildozer.spec in the current directory + serve Serve the bin directory via SimpleHTTPServer + setdefault Set the default command to run when no arguments are given + version Show the Buildozer version + +Target commands: + clean Clean the target environment + update Update the target dependencies + debug Build the application in debug mode + release Build the application in release mode + deploy Deploy the application on the device + run Run the application on the device + serve Serve the bin directory via SimpleHTTPServer + +Target "ios" commands: + list_identities List the available identities to use for signing. + xcode Open the xcode project. + +Target "android" commands: + adb Run adb from the Android SDK. Args must come after --, or + use --alias to make an alias + logcat Show the log from the device + p4a Run p4a commands. Args must come after --, or use --alias + to make an alias +``` + + +## `buildozer.spec` + +See [buildozer/default.spec](https://raw.github.com/kivy/buildozer/master/buildozer/default.spec) for an up-to-date spec file. + + +## Default config + +You can override the value of *any* `buildozer.spec` config token by +setting an appropriate environment variable. These are all of the +form ``$SECTION_TOKEN``, where SECTION is the config file section and +TOKEN is the config token to override. Dots are replaced by +underscores. + +For example, here are some config tokens from the [app] section of the +config, along with the environment variables that would override them. + +- ``title`` -> ``$APP_TITLE`` +- ``package.name`` -> ``$APP_PACKAGE_NAME`` +- ``p4a.source_dir`` -> ``$APP_P4A_SOURCE_DIR`` + + +## Buildozer Virtual Machine + +The current virtual machine (available via https://kivy.org/downloads/) allow +you to have a ready to use vm for building android application. + +### Using shared folders + +If the Virtualbox Guest tools are outdated, install the latest one: + +- in the Virtualbox: `Devices` -> `Install Guest Additions CD images` +- in the guest/linux: Go to the cdrom and run the installer +- reboot the vm + +VirtualBox filesystem doesn't support symlink anymore (don't +try the setextradata solution, it doesn't work.). So you must +do the build outside the shared folder. One solution: + +- `sudo mkdir /build` +- `sudo chown kivy /build` +- In your buildozer.spec, section `[buildozer]`, set `build_dir = /build/buildozer-myapp` + + +### Using your devices via the VM + +There is a little icon on the bottom left that represent an USB plug. +Select it, and select your android device on it. Then you can check: + + buildozer android adb -- devices + +If it doesn't, use Google. They are so many differents way / issues +depending your phone that Google will be your only source of +information, not us :) + + +## Support + +If you need assistance, you can ask for help on our mailing list: + +* User Group : https://groups.google.com/group/kivy-users +* Email : kivy-users@googlegroups.com + +We also have an IRC channel: + +* Server : irc.freenode.net +* Port : 6667, 6697 (SSL only) +* Channel : #kivy + + +## Contributing + +We love pull requests and discussing novel ideas. Check out our +[contribution guide](http://kivy.org/docs/contribute.html) and +feel free to improve buildozer. + +The following mailing list and IRC channel are used exclusively for +discussions about developing the Kivy framework and its sister projects: + +* Dev Group : https://groups.google.com/group/kivy-dev +* Email : kivy-dev@googlegroups.com + +We also have a Discord channel: + +* Server : https://chat.kivy.org +* Channel : #support + + +## License + +Buildozer is released under the terms of the MIT License. Please refer to the +LICENSE file. + + +## Backers + +Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/kivy#backer)] + + + + +## Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/kivy#sponsor)] + + + + + + + + + + + \ No newline at end of file diff --git a/setup.py b/setup.py index f48f6f6..38d7675 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ def find_version(*file_paths): curdir = dirname(__file__) -with io.open(join(curdir, "README.rst"), encoding="utf-8") as fd: +with io.open(join(curdir, "README.md"), encoding="utf-8") as fd: readme = fd.read() with io.open(join(curdir, "CHANGELOG.md"), encoding="utf-8") as fd: changelog = fd.read() @@ -38,6 +38,7 @@ setup( version=find_version('buildozer', '__init__.py'), description='Generic Python packager for Android / iOS and Desktop', long_description=readme + "\n\n" + changelog, + long_description_content_type='text/markdown', author='Mathieu Virbel', author_email='mat@kivy.org', url='http://github.com/kivy/buildozer', From e24e571ba67c16aead99332ecb08d20015168117 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sun, 3 Feb 2019 17:22:05 +0100 Subject: [PATCH 060/218] remove .rst and add .md in MANIFEST (trying to fix travis here) --- MANIFEST.in | 1 + README.rst | 262 ---------------------------------------------------- 2 files changed, 1 insertion(+), 262 deletions(-) delete mode 100644 README.rst diff --git a/MANIFEST.in b/MANIFEST.in index 240ed96..dcdd740 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ include *COPYING include *CHANGELOG.md +include *README.md recursive-include buildozer *.spec diff --git a/README.rst b/README.rst deleted file mode 100644 index e819ae8..0000000 --- a/README.rst +++ /dev/null @@ -1,262 +0,0 @@ -Buildozer -========= - -.. image:: https://travis-ci.com/kivy/buildozer.svg?branch=master - :target: https://travis-ci.com/kivy/buildozer - -Buildozer is a tool for creating application packages easily. - -The goal is to have one "buildozer.spec" file in your app directory, describing -your application requirements and settings such as title, icon, included modules -etc. Buildozer will use that spec to create a package for Android, iOS, Windows, -OSX and/or Linux. - -Buildozer currently supports packaging for Android via the `python-for-android -`_ -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-Information -`_. Please note that -the default SDK/NDK coded in Buildozer works for target Python 2. -For target Python 3, use appropriate SDK/NDK as per the documentation, and ensure you -have `python3` in your requirements. -You can still use Crystax 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 `_. - -Note that this tool has nothing to do with the eponymous online build service -`buildozer.io `_. - -Installing Buildozer with target Python 3 (default): ----------------------------------------------------- - -#. Install buildozer:: - - # via pip (latest stable, recommended) - sudo pip install buildozer - - # latest dev version - sudo pip install https://github.com/kivy/buildozer/archive/master.zip - - # git clone, for working on buildozer - git clone https://github.com/kivy/buildozer - cd buildozer - python setup.py build - sudo pip install -e . - -#. Go into your application directory and run:: - - buildozer init - # edit the buildozer.spec, then - buildozer android debug deploy run - -Installing Buildozer with target Python 2: ------------------------------------------ - -#. Follow the same installation and buildozer init as Python 3 - -#. Make sure the following lines are in your buildozer.spec file.:: - - # Changes python3 to python2 - requirements = python2,kivy - -#. Finally, build, deploy and run the app on your phone:: - - buildozer android debug deploy run - - -Installing Buildozer with target Python 3 (CrystaX, deprecated): ----------------------------------------------------------------- - -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 - -#. Make sure the following lines are in your buildozer.spec file.:: - - # Require python3crystax: - requirements = python3crystax,kivy - - # Point to the directory where you extracted the crystax-ndk: - android.ndk_path = - -#. Finally, build, deploy and run the app on your phone:: - - buildozer android debug deploy run - - - -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: --------------------------------- - -:: - - # buildozer target command - buildozer android clean - buildozer android update - buildozer android deploy - buildozer android debug - buildozer android release - - # or all in one (compile in debug, deploy on device) - buildozer android debug deploy - - # set the default command if nothing set - buildozer setdefault android debug deploy run - - -Usage ------ - -:: - - Usage: - buildozer [--profile ] [--verbose] [target] ... - buildozer --version - - Available targets: - android Android target, based on python-for-android project - ios iOS target, based on kivy-ios project - - Global commands (without target): - distclean Clean the whole Buildozer environment. - help Show the Buildozer help. - init Create a initial buildozer.spec in the current directory - serve Serve the bin directory via SimpleHTTPServer - setdefault Set the default command to run when no arguments are given - version Show the Buildozer version - - Target commands: - clean Clean the target environment - update Update the target dependencies - debug Build the application in debug mode - release Build the application in release mode - deploy Deploy the application on the device - run Run the application on the device - serve Serve the bin directory via SimpleHTTPServer - - Target "ios" commands: - list_identities List the available identities to use for signing. - xcode Open the xcode project. - - Target "android" commands: - adb Run adb from the Android SDK. Args must come after --, or - use --alias to make an alias - logcat Show the log from the device - p4a Run p4a commands. Args must come after --, or use --alias - to make an alias - - - -buildozer.spec --------------- - -See `buildozer/default.spec `_ for an up-to-date spec file. - - -Default config --------------- - -You can override the value of *any* buildozer.spec config token by -setting an appropriate environment variable. These are all of the -form ``$SECTION_TOKEN``, where SECTION is the config file section and -TOKEN is the config token to override. Dots are replaced by -underscores. - -For example, here are some config tokens from the [app] section of the -config, along with the environment variables that would override them. - -- ``title`` -> ``$APP_TITLE`` -- ``package.name`` -> ``$APP_PACKAGE_NAME`` -- ``p4a.source_dir`` -> ``$APP_P4A_SOURCE_DIR`` - -Buildozer Virtual Machine -------------------------- - -The current virtual machine (available via https://kivy.org/downloads/) allow -you to have a ready to use vm for building android application. - -Using shared folders -++++++++++++++++++++ - -If the Virtualbox Guest tools are outdated, install the latest one: - -- in the Virtualbox: `Devices` -> `Install Guest Additions CD images` -- in the guest/linux: Go to the cdrom and run the installer -- reboot the vm - -VirtualBox filesystem doesn't support symlink anymore (don't -try the setextradata solution, it doesn't work.). So you must -do the build outside the shared folder. One solution: - -- `sudo mkdir /build` -- `sudo chown kivy /build` -- In your buildozer.spec, section `[buildozer]`, set `build_dir = /build/buildozer-myapp` - -Using your devices via the VM -+++++++++++++++++++++++++++++ - -There is a little icon on the bottom left that represent an USB plug. -Select it, and select your android device on it. Then you can check: - -- `buildozer android adb -- devices` - -If it doesn't, use Google. They are so many differents way / issues -depending your phone that Google will be your only source of -information, not us :) - -Support -------- - -If you need assistance, you can ask for help on our mailing list: - -* User Group : https://groups.google.com/group/kivy-users -* Email : kivy-users@googlegroups.com - -We also have an IRC channel: - -* Server : irc.freenode.net -* Port : 6667, 6697 (SSL only) -* Channel : #kivy - -Contributing ------------- - -We love pull requests and discussing novel ideas. Check out our -`contribution guide `_ and -feel free to improve buildozer. - -The following mailing list and IRC channel are used exclusively for -discussions about developing the Kivy framework and its sister projects: - -* Dev Group : https://groups.google.com/group/kivy-dev -* Email : kivy-dev@googlegroups.com - -IRC channel: - -* Server : irc.freenode.net -* Port : 6667, 6697 (SSL only) -* Channel : #kivy-dev - -License -------- - -Buildozer is released under the terms of the MIT License. Please refer to the -LICENSE file. From 0efcf452d6e9bf1b32fa85d7794cdb51295a3d55 Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Sun, 3 Feb 2019 16:36:30 +0000 Subject: [PATCH 061/218] Updated README for python 3 --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 58d9386..0e00919 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,12 @@ OSX and/or Linux. Buildozer currently supports packaging for Android via the [python-for-android](http://github.com/kivy/python-for-android/) 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-Information](https://github.com/kivy/kivy/wiki/Android-SDK-NDK-Information). Please note that -the default SDK/NDK coded in Buildozer works for target Python 2. -For target Python 3, use appropriate SDK/NDK as per the documentation, and ensure you -have `python3` in your requirements. -You can still use Crystax 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. +For Android, buildozer will automatically download and prepare the +build dependencies. For more information, see +[Android-SDK-NDK-Information](https://github.com/kivy/kivy/wiki/Android-SDK-NDK-Information). We +recommend targeting Python 3 on Android, but you can target both +Python 3 and Python 2 regardless of which version you use with +buildozer on the desktop. We provide a ready-to-use [Virtual Machine for Virtualbox](https://kivy.org/#download). @@ -269,4 +268,4 @@ Support this project by becoming a sponsor. Your logo will show up here with a l - \ No newline at end of file + From 756d6e624323d615775d94605bd90c8973b800cf Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 4 Feb 2019 00:54:02 +0100 Subject: [PATCH 062/218] Bump to 0.38 --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 2048a15..736aa01 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -6,7 +6,7 @@ Generic Python packager for Android / iOS. Desktop later. ''' -__version__ = '0.38.dev0' +__version__ = '0.38' import os import re From c0849ba2b24fce0f6ccde2bada2ea10e7a473775 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 4 Feb 2019 00:54:05 +0100 Subject: [PATCH 063/218] Bump to 0.39.dev0 --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 736aa01..3908f89 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -6,7 +6,7 @@ Generic Python packager for Android / iOS. Desktop later. ''' -__version__ = '0.38' +__version__ = '0.39.dev0' import os import re From 742491d9d027ac5d0d2d28f95e6934c5ea4572be Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 4 Feb 2019 00:54:54 +0100 Subject: [PATCH 064/218] update changelog --- CHANGELOG.md | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 193 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a53f46e..bfbdf01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,197 @@ # Change Log +## [Unreleased](https://github.com/kivy/buildozer/tree/HEAD) + +[Full Changelog](https://github.com/kivy/buildozer/compare/0.36...HEAD) + +**Fixed bugs:** + +- TypeError: read\(\) takes exactly 2 arguments \(3 given\) [\#793](https://github.com/kivy/buildozer/issues/793) +- TypeError: read\(\) takes exactly 2 arguments \(3 given\) [\#792](https://github.com/kivy/buildozer/issues/792) +- AttributeError: 'str' object has no attribute 'decode' [\#756](https://github.com/kivy/buildozer/issues/756) + +**Closed issues:** + +- Openssl compilation fails, '\_\_atomic' undefined [\#800](https://github.com/kivy/buildozer/issues/800) +- --ndk-api appears twice [\#798](https://github.com/kivy/buildozer/issues/798) +- Error in toolchain.py and argument --ndk-api 9 [\#797](https://github.com/kivy/buildozer/issues/797) +- Target ndk-api is 19, but the \*\*python3 recipe supports only 21\*\* [\#796](https://github.com/kivy/buildozer/issues/796) +- Add support for --frameworks on iOS [\#790](https://github.com/kivy/buildozer/issues/790) +- Hello World impossible: checking whether the C compiler works... no [\#785](https://github.com/kivy/buildozer/issues/785) +- Buildozer 0.37 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 [\#782](https://github.com/kivy/buildozer/issues/782) +- APK Crashes on start with no obvious cause [\#779](https://github.com/kivy/buildozer/issues/779) +- Outdated Android NDK download URL in Kivy Virtual Machine [\#778](https://github.com/kivy/buildozer/issues/778) +- Buildozer "gradlew failed!" [\#777](https://github.com/kivy/buildozer/issues/777) +- Conflicting documentation Python2 versus Python3 [\#774](https://github.com/kivy/buildozer/issues/774) +- No valid --ndk-api received, using the default of 0 = min\(android-api=0, default ndk-api=21\) [\#772](https://github.com/kivy/buildozer/issues/772) +- `default.spec` specifies `python3` but also incompatible NDK and API settings [\#770](https://github.com/kivy/buildozer/issues/770) +- Error: minsdk argument does not match the api that is compiled against [\#768](https://github.com/kivy/buildozer/issues/768) +- Need to support sensorLandscape [\#762](https://github.com/kivy/buildozer/issues/762) +- minsdk argument does not match the api that is compiled against [\#761](https://github.com/kivy/buildozer/issues/761) +- Need to be able to specify the NDK API target [\#758](https://github.com/kivy/buildozer/issues/758) +- Buildozer cannot import name pythran\_is\_numpy\_func\_supported [\#753](https://github.com/kivy/buildozer/issues/753) +- Python3 recipe not building, error with self.ctx.python\_recipe [\#752](https://github.com/kivy/buildozer/issues/752) +- compile error [\#744](https://github.com/kivy/buildozer/issues/744) +- APK build failed "ndk\_platform doesn't exist" \(Python3.6; android.api = 27\) [\#742](https://github.com/kivy/buildozer/issues/742) +- Logo Design Proposal [\#734](https://github.com/kivy/buildozer/issues/734) +- `android clean` not working \(FileNotFoundError: \[Errno 2\] No such file or directory\) [\#732](https://github.com/kivy/buildozer/issues/732) +- Can't Make an APK via Buildozer [\#712](https://github.com/kivy/buildozer/issues/712) +- App build Failed [\#707](https://github.com/kivy/buildozer/issues/707) +- ERROR: /home/kivy/.buildozer/android/platform/apache-ant-1.9.4/bin/ant failed! [\#706](https://github.com/kivy/buildozer/issues/706) +- APK using txt file in main.py issue. [\#704](https://github.com/kivy/buildozer/issues/704) +- "Copying APK" fails because of wrong path used [\#699](https://github.com/kivy/buildozer/issues/699) +- Cannot build [\#697](https://github.com/kivy/buildozer/issues/697) +- Fail on build [\#692](https://github.com/kivy/buildozer/issues/692) +- Cannot build "Hello World" APK [\#687](https://github.com/kivy/buildozer/issues/687) +- Error when building an android APK using Kivy [\#684](https://github.com/kivy/buildozer/issues/684) +- can't get audio stream from a server [\#683](https://github.com/kivy/buildozer/issues/683) +- Continuous integration testing [\#679](https://github.com/kivy/buildozer/issues/679) +- Post build fails because copying built apk fails [\#671](https://github.com/kivy/buildozer/issues/671) +- Buildozer can't compile for Android on Manjaro Linux [\#670](https://github.com/kivy/buildozer/issues/670) +- Icon/Logo Proposal [\#669](https://github.com/kivy/buildozer/issues/669) +- Buildozer cant compile platform Ubuntu 16.04 [\#668](https://github.com/kivy/buildozer/issues/668) +- Buildozer gets stuck at unpacking kivy [\#667](https://github.com/kivy/buildozer/issues/667) +- Kivy window [\#666](https://github.com/kivy/buildozer/issues/666) +- Failed building wheel for pyaudio [\#665](https://github.com/kivy/buildozer/issues/665) +- Buildozer compilation gets stuck [\#663](https://github.com/kivy/buildozer/issues/663) +- IOError: \[Errno 2\] No such file or directory: u'/home/samurai-girl/python2/.buildozer/android/platform/build/dists/test/build/outputs/apk/test-debug.apk' [\#662](https://github.com/kivy/buildozer/issues/662) +- Unable to build \_ctypes.so [\#660](https://github.com/kivy/buildozer/issues/660) +- error while packaging for android on macOS [\#659](https://github.com/kivy/buildozer/issues/659) +- Command failed: /usr/bin/python2 -m pythonforandroid.toolchain [\#658](https://github.com/kivy/buildozer/issues/658) +- Cannot build apk with buildozer android debug [\#656](https://github.com/kivy/buildozer/issues/656) +- How to correctly build an APK package with Python 3? [\#655](https://github.com/kivy/buildozer/issues/655) +- SDK does not have any Build Tools installed. [\#652](https://github.com/kivy/buildozer/issues/652) +- Error building Kivy app with opencv\(and numpy\) - raise CommandNotFoundError\(path\) [\#651](https://github.com/kivy/buildozer/issues/651) +- FileNotFoundError: \[Errno 2\] [\#649](https://github.com/kivy/buildozer/issues/649) +- The python3crystax recipe can only be built when using the CrystaX NDK. Exiting. [\#648](https://github.com/kivy/buildozer/issues/648) +- build apk : error can not find the build/output folder [\#647](https://github.com/kivy/buildozer/issues/647) +- help me building cryptography [\#646](https://github.com/kivy/buildozer/issues/646) +- sslv3 alert handshake failure on Addroid [\#643](https://github.com/kivy/buildozer/issues/643) +- Opening Android SDK Manager to download "Google Repository" and "Google Play services" [\#642](https://github.com/kivy/buildozer/issues/642) +- kivy python host failed [\#641](https://github.com/kivy/buildozer/issues/641) +- python.host failed [\#640](https://github.com/kivy/buildozer/issues/640) +- Kivy Crashing [\#638](https://github.com/kivy/buildozer/issues/638) +- .so lib files missing debug symbols [\#637](https://github.com/kivy/buildozer/issues/637) +- Kivy app doesn't run [\#634](https://github.com/kivy/buildozer/issues/634) +- "\* daemon not running. starting it now on port 5037 \* \* daemon started successfully \*" [\#633](https://github.com/kivy/buildozer/issues/633) +- FileNotFoundError: \[Errno 2\] No such file or directory: '/home/alex/Documents/pengame/.buildozer/android/platform/build/dists/helloworldapp/build/outputs/apk/helloworldapp-debug.apk' [\#632](https://github.com/kivy/buildozer/issues/632) +- Compiling Kivy app to apk fails with a pip error [\#631](https://github.com/kivy/buildozer/issues/631) +- ERROR: /home/ubuntu/.buildozer/android/platform/apache-ant-1.9.4/bin/ant failed! [\#625](https://github.com/kivy/buildozer/issues/625) +- Build error when building Kivy app [\#624](https://github.com/kivy/buildozer/issues/624) +- buildozer debug is not running this error is showing [\#622](https://github.com/kivy/buildozer/issues/622) +- unexpected e\_machine: 3 [\#621](https://github.com/kivy/buildozer/issues/621) +- buildozer matplotlib [\#617](https://github.com/kivy/buildozer/issues/617) +- IOError: \[Errno 2\] No such file or directory: u'/Users/gauravgupta/kivy/.buildozer/android/platform/build/dists/myellipse/build/outputs/apk/myellipse-debug.apk' [\#613](https://github.com/kivy/buildozer/issues/613) +- Build failing in final ANT stage [\#610](https://github.com/kivy/buildozer/issues/610) +- Cannot build apk [\#606](https://github.com/kivy/buildozer/issues/606) +- Installing buildozer for Python 3 failed [\#604](https://github.com/kivy/buildozer/issues/604) +- FileNotFoundError at end of build when copying APK file. [\#602](https://github.com/kivy/buildozer/issues/602) +- BUILD FAILED [\#601](https://github.com/kivy/buildozer/issues/601) +- Error with buildozer [\#591](https://github.com/kivy/buildozer/issues/591) +- ImportError: No module named Cython.Distutils While running buildozer android debug [\#587](https://github.com/kivy/buildozer/issues/587) +- python 2.7 compile with NDK 15c [\#584](https://github.com/kivy/buildozer/issues/584) +- Problem upgrade to newest version [\#583](https://github.com/kivy/buildozer/issues/583) +- Simple Kivy test app can't compile to android apk [\#581](https://github.com/kivy/buildozer/issues/581) +- Apple Watch Support [\#574](https://github.com/kivy/buildozer/issues/574) +- Skip error or better error message: requirements with extra comma [\#562](https://github.com/kivy/buildozer/issues/562) +- failed to build numpy on Mac [\#557](https://github.com/kivy/buildozer/issues/557) +- p4a.source\_dir set and android clean --\> crash [\#556](https://github.com/kivy/buildozer/issues/556) +- Kivy python android build error? [\#555](https://github.com/kivy/buildozer/issues/555) +- python3 import networkx needs lib2to3 but cannot be imported [\#554](https://github.com/kivy/buildozer/issues/554) +- buildozer android debug deploy run ERROR [\#550](https://github.com/kivy/buildozer/issues/550) +- App Crashes [\#541](https://github.com/kivy/buildozer/issues/541) +- Requirements: Requests, Ssl [\#539](https://github.com/kivy/buildozer/issues/539) +- Error: Aidl cannot be executed [\#532](https://github.com/kivy/buildozer/issues/532) +- Kivy and Beautifulsoup with Buildozer fail on Python 3. [\#529](https://github.com/kivy/buildozer/issues/529) +- I'm having similar problem [\#528](https://github.com/kivy/buildozer/issues/528) +- Awkward error while building apk [\#526](https://github.com/kivy/buildozer/issues/526) +- The "android" command is deprecated [\#519](https://github.com/kivy/buildozer/issues/519) +- Kivy: Permission denied \(when running buildozer android on Mac OS X\) [\#517](https://github.com/kivy/buildozer/issues/517) +- Extraction of "Kivy2.7z" failed [\#516](https://github.com/kivy/buildozer/issues/516) +- buildozer still download ndk from wrong path [\#506](https://github.com/kivy/buildozer/issues/506) +- android-new landscape error on restart [\#482](https://github.com/kivy/buildozer/issues/482) +- Add possibility to choose pip version for modules in the requirements section [\#475](https://github.com/kivy/buildozer/issues/475) +- Bulldozer android\_new fails when ffmpeg is added to the requirements: No C Compiler found! [\#463](https://github.com/kivy/buildozer/issues/463) +- CalledProcessError: Command '\['python', 'package\_app.py', '--displayname=Music Favorites'\]' returned non-zero exit status 1 [\#448](https://github.com/kivy/buildozer/issues/448) +- \[Errno 13\] Permission denied; Buildozer on Flask Server [\#445](https://github.com/kivy/buildozer/issues/445) +- Error while compiling a kivy app for android \(undefined reference to 'SDL\_main' collect2: error: ld returned 1 exit status\) [\#438](https://github.com/kivy/buildozer/issues/438) +- AsyncImage not loading in .apk [\#433](https://github.com/kivy/buildozer/issues/433) +- Big Bug, ORMs cant find sqlite3.so [\#426](https://github.com/kivy/buildozer/issues/426) +- cp: cannot stat '~/.buildozer/android/platform/python-for-android/src/libs/armeabi/\*.so': No such file or directory [\#422](https://github.com/kivy/buildozer/issues/422) +- using android\_new causes missing packages errors [\#420](https://github.com/kivy/buildozer/issues/420) +- Buildozer fails with "Command '\['ant', 'debug'\]' returned non-zero exit status 1" [\#419](https://github.com/kivy/buildozer/issues/419) +- Buildozer fails to build when ffmpeg is added [\#418](https://github.com/kivy/buildozer/issues/418) +- Build on arm64 android [\#412](https://github.com/kivy/buildozer/issues/412) +- Building with "android\_new" target fails due to missing architecture on pythonforandroid.toolchain apk [\#407](https://github.com/kivy/buildozer/issues/407) +- Command '\['ant', 'debug'\]' returned non-zero exit status 1 when building PIL library [\#406](https://github.com/kivy/buildozer/issues/406) +- Android, Pygame backend: buildozer android debug deploy run tries to launch wrong Activity [\#401](https://github.com/kivy/buildozer/issues/401) +- AttributeError: 'NoneType' object has no attribute 'splitlines' [\#400](https://github.com/kivy/buildozer/issues/400) +- Pyzmq import fails on Android with python2 / kivy 1.9 / cython 0.23 [\#397](https://github.com/kivy/buildozer/issues/397) +- Python 3: \# Aidl cannot be executed AttributeError: 'module' object has no attribute 'maxint' [\#392](https://github.com/kivy/buildozer/issues/392) +- subprocess.CalledProcessError [\#391](https://github.com/kivy/buildozer/issues/391) +- python.host could not find platform independent libraries [\#390](https://github.com/kivy/buildozer/issues/390) +- Buildozer android\_new fails [\#388](https://github.com/kivy/buildozer/issues/388) +- toolchain.py: error: argument --private is required [\#384](https://github.com/kivy/buildozer/issues/384) +- Android fails on running Kivy apk [\#381](https://github.com/kivy/buildozer/issues/381) +- ImportError: No module named plyer with android\_new as a target [\#379](https://github.com/kivy/buildozer/issues/379) +- buildozer -v android debug runs into problem [\#376](https://github.com/kivy/buildozer/issues/376) +- subprocess.CalledProcessError [\#372](https://github.com/kivy/buildozer/issues/372) +- Can't install Pillow , return errors [\#371](https://github.com/kivy/buildozer/issues/371) +- failed to load ctypes as android app built on OSX [\#368](https://github.com/kivy/buildozer/issues/368) +- old\_toolchain not shows images [\#367](https://github.com/kivy/buildozer/issues/367) +- Buildozer deployment dlopen failed libSDL2.so has unexpected e\_machine: 40 [\#365](https://github.com/kivy/buildozer/issues/365) +- Rebuild only selected packages [\#226](https://github.com/kivy/buildozer/issues/226) + +**Merged pull requests:** + +- Updated README for Python 3 [\#809](https://github.com/kivy/buildozer/pull/809) ([inclement](https://github.com/inclement)) +- Update README.md to add opencollective [\#808](https://github.com/kivy/buildozer/pull/808) ([tito](https://github.com/tito)) +- Made buildozer respect user sdk dir when accessing sdkmanager [\#807](https://github.com/kivy/buildozer/pull/807) ([inclement](https://github.com/inclement)) +- Removed android\_old and updated SDK management to work with current SDK [\#806](https://github.com/kivy/buildozer/pull/806) ([inclement](https://github.com/inclement)) +- Removed redundant --ndk-api argument and fixed default value [\#805](https://github.com/kivy/buildozer/pull/805) ([inclement](https://github.com/inclement)) +- Update for p4a master [\#803](https://github.com/kivy/buildozer/pull/803) ([inclement](https://github.com/inclement)) +- Unit tests read spec file, refs \#793 [\#799](https://github.com/kivy/buildozer/pull/799) ([AndreMiras](https://github.com/AndreMiras)) +- Support the --add-frameworks flag in kivy-ios [\#795](https://github.com/kivy/buildozer/pull/795) ([hackalog](https://github.com/hackalog)) +- Introduces CI and tox testing, fixes \#679 [\#794](https://github.com/kivy/buildozer/pull/794) ([AndreMiras](https://github.com/AndreMiras)) +- Fix python 2 crash when reading config file [\#791](https://github.com/kivy/buildozer/pull/791) ([JonasT](https://github.com/JonasT)) +- Handle buildozer.spec with unicode chars [\#789](https://github.com/kivy/buildozer/pull/789) ([guysoft](https://github.com/guysoft)) +- Specify GitHub branches in buildozer.spec [\#787](https://github.com/kivy/buildozer/pull/787) ([hackalog](https://github.com/hackalog)) +- Fixes minor comment typo introduced in \#759 [\#786](https://github.com/kivy/buildozer/pull/786) ([AndreMiras](https://github.com/AndreMiras)) +- Docker from current git [\#775](https://github.com/kivy/buildozer/pull/775) ([mahomahomaho](https://github.com/mahomahomaho)) +- Fix output directory for gradle [\#766](https://github.com/kivy/buildozer/pull/766) ([wo01](https://github.com/wo01)) +- support sensorLandscape mode. resolves \#762 [\#763](https://github.com/kivy/buildozer/pull/763) ([brentpicasso](https://github.com/brentpicasso)) +- allow specifying of Android NDK API. Resolves \#758 [\#759](https://github.com/kivy/buildozer/pull/759) ([brentpicasso](https://github.com/brentpicasso)) +- Update cython version from the docs [\#757](https://github.com/kivy/buildozer/pull/757) ([AndreMiras](https://github.com/AndreMiras)) +- fix android sdk/ndk information link [\#755](https://github.com/kivy/buildozer/pull/755) ([avere001](https://github.com/avere001)) +- this allows to build with ndk 17c \(and other recent-ish ones\) [\#754](https://github.com/kivy/buildozer/pull/754) ([tshirtman](https://github.com/tshirtman)) +- fix ndk URLs [\#747](https://github.com/kivy/buildozer/pull/747) ([zworkb](https://github.com/zworkb)) + +## [0.36](https://github.com/kivy/buildozer/tree/0.36) (2018-11-21) +[Full Changelog](https://github.com/kivy/buildozer/compare/0.35...0.36) + +**Fixed bugs:** + +- Error in debug, install platform, Indexerror. [\#731](https://github.com/kivy/buildozer/issues/731) + +**Closed issues:** + +- Buildozer looking for nonexistent script [\#749](https://github.com/kivy/buildozer/issues/749) +- Can not build APK file with buildozer. UnicodeDecodeError [\#746](https://github.com/kivy/buildozer/issues/746) +- CrystaX no longer the preferred NDK for Python3 [\#745](https://github.com/kivy/buildozer/issues/745) +- AKP build fails \(android.py line 524\) [\#738](https://github.com/kivy/buildozer/issues/738) +- Buildozer 0.35 with IndexError: list index out of range on Mac OS [\#737](https://github.com/kivy/buildozer/issues/737) +- cannot build pyjnius for armeabi-v7a [\#735](https://github.com/kivy/buildozer/issues/735) +- I can't package my app the way i always did. [\#733](https://github.com/kivy/buildozer/issues/733) +- OSError: \[Errno 18\] Invalid cross-device link [\#644](https://github.com/kivy/buildozer/issues/644) + +**Merged pull requests:** + +- Correctly write out a sub-process's `stdout` when using Python 3. [\#743](https://github.com/kivy/buildozer/pull/743) ([dbrnz](https://github.com/dbrnz)) +- Explicitly run `pip3` when using Python 3 [\#741](https://github.com/kivy/buildozer/pull/741) ([dbrnz](https://github.com/dbrnz)) +- workaround for working in WSL [\#740](https://github.com/kivy/buildozer/pull/740) ([tshirtman](https://github.com/tshirtman)) +- Allow for `install\_reqs` line having whitespace at start. [\#736](https://github.com/kivy/buildozer/pull/736) ([dbrnz](https://github.com/dbrnz)) +- Fix Support config file name [\#730](https://github.com/kivy/buildozer/pull/730) ([dessant](https://github.com/dessant)) + ## [0.35](https://github.com/kivy/buildozer/tree/0.35) (2018-10-24) [Full Changelog](https://github.com/kivy/buildozer/compare/0.34...0.35) @@ -695,4 +887,4 @@ ## [0.2](https://github.com/kivy/buildozer/tree/0.2) (2012-12-20) -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file From 3263983d6b9d5a6ce9cfeefb9adeb59f13bbc976 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 4 Feb 2019 01:08:32 +0100 Subject: [PATCH 065/218] Bump to 0.39 --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 3908f89..004f41f 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -6,7 +6,7 @@ Generic Python packager for Android / iOS. Desktop later. ''' -__version__ = '0.39.dev0' +__version__ = '0.39' import os import re From 91ba12d4375294aaa893db5d58893733f4a6cde1 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 4 Feb 2019 01:08:35 +0100 Subject: [PATCH 066/218] Bump to 0.40.dev0 --- buildozer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildozer/__init__.py b/buildozer/__init__.py index 004f41f..f5fd14d 100644 --- a/buildozer/__init__.py +++ b/buildozer/__init__.py @@ -6,7 +6,7 @@ Generic Python packager for Android / iOS. Desktop later. ''' -__version__ = '0.39' +__version__ = '0.40.dev0' import os import re From e0d29f993b039d267839504039f0179f4dc32cad Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Mon, 4 Feb 2019 01:09:25 +0100 Subject: [PATCH 067/218] update changelog --- CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bfbdf01..0c39114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,10 @@ # Change Log -## [Unreleased](https://github.com/kivy/buildozer/tree/HEAD) +## [0.39](https://github.com/kivy/buildozer/tree/0.39) (2019-02-04) +[Full Changelog](https://github.com/kivy/buildozer/compare/0.38...0.39) -[Full Changelog](https://github.com/kivy/buildozer/compare/0.36...HEAD) +## [0.38](https://github.com/kivy/buildozer/tree/0.38) (2019-02-03) +[Full Changelog](https://github.com/kivy/buildozer/compare/0.36...0.38) **Fixed bugs:** From 4983e8f08df657fc3bf5018a25c6d5e04c68920a Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Mon, 4 Feb 2019 10:12:09 +0100 Subject: [PATCH 068/218] Update the issue template Removed Kivy and Cython version info as not really relevant for a buildozer bug report. Added buildozer version information. Updated support question description. --- .github/ISSUE_TEMPLATE.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index b5d6ce4..477285a 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,7 +1,6 @@