Skip to content

Commit ce9b571

Browse files
authored
Merge pull request kivy#1909 from kivy/release-2019.07.08
Release 2019.07.08
2 parents 0415720 + 745dc67 commit ce9b571

37 files changed

+1883
-467
lines changed

.travis.yml

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,8 @@ services:
1212
- docker
1313

1414
before_install:
15-
- travis_retry sudo apt update -qq
16-
# to successfully send the coveralls reports we need pyOpenSSL
17-
- travis_retry sudo apt install -qq --no-install-recommends
18-
python2.7 python3 python3-venv python3-virtualenv python3-pip
19-
python3-setuptools python3-openssl
20-
# (venv/virtualenv are both used by tests/test_pythonpackage.py)
21-
- sudo pip install tox>=2.0
22-
- sudo pip3 install coveralls
2315
# https://github.com/travis-ci/travis-ci/issues/6069#issuecomment-266546552
24-
- git remote set-branches --add origin master
16+
- git remote set-branches --add origin develop
2517
- git fetch
2618

2719
env:
@@ -31,13 +23,36 @@ env:
3123

3224
jobs:
3325
include:
34-
- stage: lint
35-
name: "Tox tests and coverage"
26+
- &linting
27+
stage: lint
28+
language: python
29+
python: 3.7
30+
before_script:
31+
# We need to escape virtualenv for `test_pythonpackage_basic.test_virtualenv`
32+
# See also: https://github.com/travis-ci/travis-ci/issues/8589
33+
- type -t deactivate && deactivate || true
34+
- export PATH=/opt/python/3.7/bin:$PATH
35+
# Install tox & virtualenv
36+
# Note: venv/virtualenv are both used by tests/test_pythonpackage.py
37+
- pip3.7 install -U virtualenv
38+
- pip3.7 install tox>=2.0
39+
# Install coveralls & dependencies
40+
# Note: pyOpenSSL needed to send the coveralls reports
41+
- pip3.7 install pyOpenSSL
42+
- pip3.7 install coveralls
3643
script:
3744
# we want to fail fast on tox errors without having to `docker build` first
3845
- tox -- tests/ --ignore tests/test_pythonpackage.py
3946
# (we ignore test_pythonpackage.py since these run way too long!!
4047
# test_pythonpackage_basic.py will still be run.)
48+
name: "Tox Pep8"
49+
env: TOXENV=pep8
50+
- <<: *linting
51+
name: "Tox Python 2"
52+
env: TOXENV=py27
53+
- <<: *linting
54+
name: "Tox Python 3 & Coverage"
55+
env: TOXENV=py3
4156
after_success:
4257
- coveralls
4358

@@ -54,16 +69,16 @@ jobs:
5469
after_script:
5570
# kill the background process started before run docker
5671
- kill %1
57-
name: Python 3 basic
72+
name: Python 3 armeabi-v7a
5873
# overrides requirements to skip `peewee` pure python module, see:
5974
# https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054
60-
env: COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements libffi,sdl2,pyjnius,kivy,python3,openssl,requests,sqlite3,setuptools'
75+
env: COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements libffi,sdl2,pyjnius,kivy,python3,openssl,requests,sqlite3,setuptools' --arch=armeabi-v7a
6176
- <<: *testing
62-
name: Python 2 basic
63-
env: COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3,setuptools'
77+
name: Python 3 arm64-v8a
78+
env: COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements libffi,sdl2,pyjnius,kivy,python3,openssl,requests,sqlite3,setuptools' --arch=arm64-v8a
6479
- <<: *testing
65-
name: Python 2 numpy
66-
env: COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --bootstrap sdl2 --requirements python2,numpy'
80+
name: Python 2 basic
81+
env: COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3,setuptools,numpy'
6782
- <<: *testing
6883
name: Rebuild updated recipes
6984
env: COMMAND='. venv/bin/activate && ./ci/rebuild_updated_recipes.py'

README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ python-for-android
66
[![Backers on Open Collective](https://opencollective.com/kivy/backers/badge.svg)](#backers)
77
[![Sponsors on Open Collective](https://opencollective.com/kivy/sponsors/badge.svg)](#sponsors)
88

9-
python-for-android is a packager for Python apps on Android. You can
9+
python-for-android is a packaging tool for Python apps on Android. You can
1010
create your own Python distribution including the modules and
1111
dependencies you want, and bundle it in an APK along with your own code.
1212

@@ -33,29 +33,27 @@ Follow the [quickstart
3333
instructions](<https://python-for-android.readthedocs.org/en/latest/quickstart/>)
3434
to install and begin creating APKs.
3535

36-
Quick instructions to start would be:
36+
**Quick instructions**: install python-for-android with:
3737

3838
pip install python-for-android
3939

40-
or to test the master branch:
40+
(for the develop branch: `pip install git+https://github.com/kivy/python-for-android.git`)
4141

42-
pip install git+https://github.com/kivy/python-for-android.git
42+
Test that the install works with:
4343

44-
The executable is called ``python-for-android`` or ``p4a`` (both are
45-
equivalent). To test that the installation worked, try::
44+
p4a --version
4645

47-
python-for-android recipes
46+
To build any actual apps, **set up the Android SDK and NDK**
47+
as described in the [quickstart](
48+
<https://python-for-android.readthedocs.org/en/latest/quickstart/#installing-android-sdk>).
49+
**Use the SDK/NDK API level & NDK version as in the quickstart,**
50+
other API levels may not work.
4851

49-
This should return a list of recipes available to be built.
52+
With everything installed, build an APK with SDL2 with e.g.:
5053

51-
To build any distributions, you need to set up the Android SDK and NDK
52-
as described in the documentation linked above.
54+
p4a apk --requirements=kivy --private /home/username/devel/planewave_frozen/ --package=net.inclem.planewavessdl2 --name="planewavessdl2" --version=0.5 --bootstrap=sdl2
5355

54-
If you did this, to build an APK with SDL2 you can try e.g.:
55-
56-
p4a apk --requirements=kivy --private /home/asandy/devel/planewave_frozen/ --package=net.inclem.planewavessdl2 --name="planewavessdl2" --version=0.5 --bootstrap=sdl2
57-
58-
For full instructions and parameter options, see [the
56+
**For full instructions and parameter options,** see [the
5957
documentation](https://python-for-android.readthedocs.io/en/latest/quickstart/#usage).
6058

6159
## Support

ci/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class TargetPython(Enum):
5656
'websocket-client',
5757
'zeroconf',
5858
'zope',
59+
'matplotlib', # https://github.com/kivy/python-for-android/issues/1900
5960
])
6061
BROKEN_RECIPES_PYTHON3 = set([
6162
'brokenrecipe',
@@ -77,6 +78,7 @@ class TargetPython(Enum):
7778
# mpmath package with a version >= 0.19 required
7879
'sympy',
7980
'vlc',
81+
'matplotlib', # https://github.com/kivy/python-for-android/issues/1900
8082
])
8183

8284
BROKEN_RECIPES = {

doc/source/contribute.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ and we'll deal with the rest.
1414
Development model
1515
-----------------
1616

17-
python-for-android is developed using the following model::
17+
python-for-android is developed using the following model:
1818

1919
- The ``master`` branch always represents the latest stable release.
2020
- The ``develop`` branch is the most up to date with new contributions.
@@ -44,20 +44,24 @@ Creating a new release
4444

4545
New releases follow these steps:
4646

47-
- Create a new branch ``release/YYYY.MM.DD`` based on the ``develop`` branch.
48-
- ``git checkout -b release/YYYY.MM.DD develop``
49-
- Create a Github pull request to merge ``release/YYYY.MM.DD`` into ``master``.
47+
- Create a new branch ``release-YYYY.MM.DD`` based on the ``develop`` branch.
48+
- ``git checkout -b release-YYYY.MM.DD develop``
49+
- Create a Github pull request to merge ``release-YYYY.MM.DD`` into ``master``.
5050
- Complete all steps in the `release checklist <release_checklist_>`_,
5151
and document this in the pull request (copy the checklist into the PR text)
5252

5353
At this point, wait for reviewer approval and conclude any discussion that arises. To complete the release:
5454

5555
- Merge the release branch to the ``master`` branch.
5656
- Also merge the release branch to the ``develop`` branch.
57-
- Tag the release commit in ``master``. Include a short summary of the changes.
58-
- Create the release distributions: ``python3 setup.py sdist``
57+
- Tag the release commit in ``master``, with tag ``vYYYY.MM.DD``. Include a short summary of the changes.
58+
- Create the release distributions: ``python3 setup.py sdist bdist_wheel``
5959
- Upload the release to pypi: ``python3 -m twine upload``.
60-
- Upload the release ``.tar.gz`` to the Github tag.
60+
- Add to the Github release page (see e.g. `this example <https://github.com/kivy/python-for-android/releases/tag/v2019.06.06>`__):
61+
- The python-for-android README summary
62+
- A short list of major changes in this release, if any
63+
- A changelog summarising merge commits since the last release
64+
- The release sdist and wheel(s)
6165

6266
.. _release_checklist:
6367

doc/source/quickstart.rst

Lines changed: 53 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,37 @@ for android as p4a in this documentation.
99
Concepts
1010
--------
1111

12-
- requirements: For p4a, your applications dependencies are
13-
requirements similar to the standard `requirements.txt`, but with
14-
one difference: p4a will search for a recipe first instead of
15-
installing requirements with pip.
12+
*Basic:*
1613

17-
- recipe: A recipe is a file that defines how to compile a
18-
requirement. Any libraries that have a Python extension *must* have
19-
a recipe in p4a, or compilation will fail. If there is no recipe for
20-
a requirement, it will be downloaded using pip.
14+
- **requirements:** For p4a, all your app's dependencies must be specified
15+
via ``--requirements`` similar to the standard `requirements.txt`.
16+
(Unless you specify them via a `setup.py`/`install_requires`)
17+
All dependencies will be mapped to "recipes" if any exist, so that
18+
many common libraries will just work. See "recipe" below for details.
2119

22-
- build: A build refers to a compiled recipe.
20+
- **distribution:** A distribution is the final "build" of your
21+
compiled project + requirements, as an Android project assembled by
22+
p4a that can be turned directly into an APK. p4a can contain multiple
23+
distributions with different sets of requirements.
2324

24-
- distribution: A distribution is the final "build" of all your
25-
compiled requirements, as an Android project that can be turned
26-
directly into an APK. p4a can contain multiple distributions with
27-
different sets of requirements.
25+
- **build:** A build refers to a compiled recipe or distribution.
2826

29-
- bootstrap: A bootstrap is the app backend that will start your
30-
application. Your application could use SDL2 as a base,
31-
or a web backend like Flask with a WebView bootstrap. Different
32-
bootstraps can have different build options.
27+
- **bootstrap:** A bootstrap is the app backend that will start your
28+
application. The default for graphical applications is SDL2.
29+
You can also use e.g. the webview for web apps, or service_only for
30+
background services. Different bootstraps have different additional
31+
build options.
32+
33+
*Advanced:*
34+
35+
- **recipe:**
36+
A recipe is a file telling p4a how to install a requirement
37+
that isn't by default fully Android compatible.
38+
This is often necessary for Cython or C/C++-using python extensions.
39+
p4a has recipes for many common libraries already included, and any
40+
dependency you specified will be automatically mapped to its recipe.
41+
If a dependency doesn't work and has no recipe included in p4a,
42+
then it may need one to work.
3343

3444

3545
Installation
@@ -75,14 +85,20 @@ install most of these with::
7585
On Arch Linux (64 bit) you should be able to run the following to
7686
install most of the dependencies (note: this list may not be
7787
complete). gcc-multilib will conflict with (and replace) gcc if not
78-
already installed. If your installation is already 32-bit, install the
79-
same packages but without ``lib32-`` or ``-multilib``::
88+
already installed::
8089

8190
sudo pacman -S jdk7-openjdk python2 python2-pip python2-kivy mesa-libgl lib32-mesa-libgl lib32-sdl2 lib32-sdl2_image lib32-sdl2_mixer sdl2_ttf unzip gcc-multilib gcc-libs-multilib
8291

8392
Installing Android SDK
8493
~~~~~~~~~~~~~~~~~~~~~~
8594

95+
.. warning::
96+
python-for-android is often picky about the **SDK/NDK versions.**
97+
Pick the recommended ones from below to avoid problems.
98+
99+
Basic SDK install
100+
`````````````````
101+
86102
You need to download and unpack the Android SDK and NDK to a directory (let's say $HOME/Documents/):
87103

88104
- `Android SDK <https://developer.android.com/studio/index.html>`_
@@ -94,31 +110,22 @@ named ``tools``, and you will need to run extra commands to install
94110
the SDK packages needed.
95111

96112
For Android NDK, note that modern releases will only work on a 64-bit
97-
operating system. The minimal, and recommended, NDK version to use is r17c:
113+
operating system. **The minimal, and recommended, NDK version to use is r17c:**
98114

99115
- `Go to ndk downloads page <https://developer.android.com/ndk/downloads/>`_
100116
- Windows users should create a virtual machine with an GNU Linux os
101117
installed, and then you can follow the described instructions from within
102118
your virtual machine.
103119

104-
If you are using a 32-bit distribution (or hardware),
105-
the latest usable NDK version is r10e, which can be downloaded here:
106120

107-
- `Legacy 32-bit Linux NDK r10e <http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86.bin>`_
121+
Platform and build tools
122+
````````````````````````
108123

109-
.. warning::
110-
**32-bit distributions**
111-
112-
Since the python2 recipe updated to version 2.7.15, the build system has
113-
been changed and you should use an old release of python-for-android, which
114-
contains the legacy python recipe (v2.7.2). The last python-for-android
115-
release with the legacy version of python is version
116-
`0.6.0 <https://github.com/kivy/python-for-android/archive/0.6.0.zip>`_.
117-
118-
First, install an API platform to target. You can replace ``27`` with
119-
a different platform number, but keep in mind **other API versions
120-
are less well-tested**, and older devices are still supported
121-
(down to the specified *minimum* API/NDK API level):
124+
First, install an API platform to target. **The recommended *target* API
125+
level is 27**, you can replace it with a different number but
126+
keep in mind other API versions are less well-tested and older devices
127+
are still supported down to the **recommended specified *minimum*
128+
API/NDK API level 21**:
122129

123130
$SDK_DIR/tools/bin/sdkmanager "platforms;android-27"
124131

@@ -128,13 +135,17 @@ possibilities, but 26.0.2 is the latest version at the time of writing::
128135

129136
$SDK_DIR/tools/bin/sdkmanager "build-tools;26.0.2"
130137

131-
Then, you can edit your ``~/.bashrc`` or other favorite shell to include new environment variables necessary for building on android::
138+
Configure p4a to use your SDK/NDK
139+
`````````````````````````````````
140+
141+
Then, you can edit your ``~/.bashrc`` or other favorite shell to include new environment
142+
variables necessary for building on android::
132143

133144
# Adjust the paths!
134145
export ANDROIDSDK="$HOME/Documents/android-sdk-27"
135146
export ANDROIDNDK="$HOME/Documents/android-ndk-r17c"
136-
export ANDROIDAPI="26" # Target API version of your application
137-
export NDKAPI="19" # Minimum supported API version of your application
147+
export ANDROIDAPI="27" # Target API version of your application
148+
export NDKAPI="21" # Minimum supported API version of your application
138149
export ANDROIDNDKVER="r10e" # Version of the NDK you installed
139150

140151
You have the possibility to configure on any command the PATH to the SDK, NDK and Android API using:
@@ -158,9 +169,9 @@ and the requirements::
158169

159170
p4a apk --private $HOME/code/myapp --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python3,kivy
160171

161-
**Note on `--requirements`: you must add all
172+
**Note on** ``--requirements``: **you must add all
162173
libraries/dependencies your app needs to run.**
163-
Example: `--requirements=python3,kivy,vispy`. For an SDL2 app,
174+
Example: ``--requirements=python3,kivy,vispy``. For an SDL2 app,
164175
`kivy` is not needed, but you need to add any wrappers you might
165176
use (e.g. `pysdl2`).
166177

@@ -175,8 +186,6 @@ an `.apk` file.
175186
it will possibly no longer receive patches by the python creators
176187
themselves in 2020. Migration to Python 3 is recommended!
177188

178-
- You can also use ``--bootstrap=pygame``, but this bootstrap
179-
is deprecated and not well-tested.
180189

181190
Build a WebView application
182191
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -188,7 +197,7 @@ well as the requirements::
188197
p4a apk --private $HOME/code/myapp --package=org.example.myapp --name "My WebView Application" --version 0.1 --bootstrap=webview --requirements=flask --port=5000
189198

190199
**Please note as with kivy/SDL2, you need to specify all your
191-
additional requirements/depenencies.**
200+
additional requirements/dependencies.**
192201

193202
You can also replace flask with another web framework.
194203

doc/source/troubleshooting.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,15 @@ This will reveal all the Python-related files::
101101
$ ls
102102
android_runnable.pyo include interpreter_subprocess main.kv pipinterface.kv settings.pyo
103103
assets __init__.pyo interpreterwrapper.pyo main.pyo pipinterface.pyo utils.pyo
104-
editor.kv interpreter.kv lib menu.kv private.mp3 widgets.pyo
104+
editor.kv interpreter.kv _python_bundle menu.kv private.mp3 widgets.pyo
105105
editor.pyo interpreter.pyo libpymodules.so menu.pyo settings.kv
106106

107107
Most of these files have been included by the user (in this case, they
108108
come from one of my own apps), the rest relate to the python
109109
distribution.
110110

111-
With Python 2, the Python installation can mostly be found in the
112-
``lib`` folder. With Python 3 (using the ``python3crystax`` recipe),
113-
the Python installation can be found in a folder named
114-
``crystax_python``.
111+
The python installation, along with all side-packages, is mostly contained
112+
inside the `_python_bundle` folder.
115113

116114

117115
Common errors

pythonforandroid/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
2-
__version__ = '2019.06.06.post0'
1+
__version__ = '2019.07.08'

pythonforandroid/archs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,12 @@ def get_env(self, with_flags_in_cc=True, clang=False):
167167
'host' + self.ctx.python_recipe.name, self.ctx)
168168
env['BUILDLIB_PATH'] = join(
169169
hostpython_recipe.get_build_dir(self.arch),
170-
'build', 'lib.{}-{}'.format(
171-
build_platform, self.ctx.python_recipe.major_minor_version_string)
170+
'native-build',
171+
'build',
172+
'lib.{}-{}'.format(
173+
build_platform,
174+
self.ctx.python_recipe.major_minor_version_string,
175+
),
172176
)
173177

174178
env['PATH'] = environ['PATH']

0 commit comments

Comments
 (0)