Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2019.08.09 #1955

Merged
merged 61 commits into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
f5e78b7
[docs] Add documentation: testing a pull request
opacam Jun 30, 2019
98cfb8a
Make test_get_bootstraps_from_recipes() deterministic and better
Jun 26, 2019
108d49c
Merge pull request #1887 from JonasT/fix_unpredictable_listbootstraps
AndreMiras Jul 9, 2019
1d50533
[docker] Update android's sdk tools to `28.0.2`
opacam Jul 9, 2019
6d6ab20
[bootstrap] Fix crash when guessing Bootstrap (expand_dependencies)
opacam Jul 10, 2019
21004a7
Merge pull request #1914 from opacam/hotfix-fix-bootstrap-py-deps
AndreMiras Jul 10, 2019
1b7e009
Merge pull request #1912 from opacam/feature-update-sk-build-tools
AndreMiras Jul 10, 2019
b5d9b61
Feature gitignore additions (#1911)
opacam Jul 10, 2019
a948a99
[gitignore] Remove `nosetests.xml` from gitignore
opacam Jul 10, 2019
7338ae4
Fixes ffmpeg and libx264 recipes for arm64-v8 (#1916)
misl6 Jul 11, 2019
e3f2d81
[crystax] Drop CrystaX support and code base
opacam Jul 9, 2019
21f93d2
[crystax] Text corrections for doc files
opacam Jul 10, 2019
aad2730
[crystax] Fix doc string typo for `PythonRecipe`
opacam Jul 11, 2019
dc589c4
[crystax] Fix the dependencies resolution
opacam Jul 11, 2019
7c1223e
[crystax] Add hostpython recipes to CORE_RECIPES
opacam Jul 11, 2019
ac8df83
[crystax] Detect removed recipes for rebuild_updated_recipes
opacam Jul 11, 2019
185936e
[crystax] Remove hardcoded sdl2 bootstrap in rebuild_updated_recipes
opacam Jul 11, 2019
5ad8ad7
[crystax] Improve docs and inline comments
opacam Jul 14, 2019
859f099
Merge branch 'release-2019.07.08' into develop
inclement Jul 14, 2019
11b4a97
Updated release number for develop branch
inclement Jul 14, 2019
aa31c5c
Merge pull request #1921 from inclement/release-2019.07.08-merge-develop
inclement Jul 14, 2019
fba37de
Merge pull request #1913 from opacam/feature-remove-crystax
inclement Jul 14, 2019
c58278e
Merge pull request #1915 from opacam/hotfix-gitignore-no-nose
inclement Jul 14, 2019
8122126
feat: Allows registering the onRequestPermissionsResult callback.
gbm001 May 9, 2019
a0fbab6
feat: Update Android permissions to allow passing a callback with eac…
gbm001 Jul 15, 2019
fba062a
fix: A bit of renaming, and removed a redundant GC-preventing attribute.
gbm001 Jul 16, 2019
0d889bd
style: Revert mistaken name change...
gbm001 Jul 16, 2019
3e26bee
fix: Convert Android permission int values to True/False
gbm001 Jul 17, 2019
f6f6f19
Merge pull request #1901 from opacam/feature-docs-test-pr
AndreMiras Jul 18, 2019
736c639
[ndk] Make it raise an error if an old ndk is used
opacam Jun 22, 2019
19972b4
[test] Add unittest for `pythonforandroid.recommendations`
opacam Jul 19, 2019
cbfb51f
[texts] Capitalise NDK to be consistent
opacam Jul 19, 2019
6a8b3cb
[texts] Rewrite log messages to be more direct
opacam Jul 19, 2019
6688562
[recommendations] Refactor important log messages
opacam Jul 19, 2019
bf2e723
libzmq: fix compilation under arch-arm64
tito Jul 25, 2019
56fdbd0
Merge pull request #1930 from kivy/fix-pyzmq
tito Jul 26, 2019
312b522
Basic toolchain.py unit tests
AndreMiras Jul 23, 2019
e102f59
Merge pull request #1928 from AndreMiras/feature/test_toolchain
AndreMiras Jul 26, 2019
13c3b51
Merge pull request #1883 from opacam/feature-ndk-check
inclement Jul 26, 2019
47b472b
Increases toolchain.py test coverage
AndreMiras Jul 27, 2019
901f9e4
Add a document describing how p4a interacts with pip & python packages
Jul 25, 2019
df687c5
Merge pull request #1933 from AndreMiras/feature/test_toolchain
AndreMiras Jul 27, 2019
8cf23aa
Merge pull request #1931 from JonasT/packaging-dev-doc
Jul 27, 2019
55e3cdd
Bumps to Kivy==1.11.1
AndreMiras Jul 28, 2019
db6e735
Fix foreground notification being mandatory and more. Details:
Jun 25, 2019
7d5fdee
Add functions for obtaining the default storage paths
Jan 17, 2019
308df31
Merge pull request #1888 from JonasT/fix_forced_service_foreground2
Jul 28, 2019
ea38331
Added setuptools to Kivy recipe requirements
inclement Jul 28, 2019
d965d54
Merge pull request #1935 from AndreMiras/feature/bump_to_kivy_1.11.1
inclement Jul 28, 2019
0e8e945
Merge pull request #1938 from inclement/kivy_setuptools_dependency
inclement Jul 28, 2019
c63588d
Update storage.py fixes runtime errors
AndreMiras Jul 28, 2019
e21cd8b
Merge pull request #1598 from JonasT/storage_android
AndreMiras Jul 28, 2019
76b947c
fix: Call request_permissions callback immediately for SDK_INT < 23
gbm001 Jul 29, 2019
721e7c5
Unit tests Recipe download feature
AndreMiras Jul 30, 2019
3dabded
Merge pull request #1946 from AndreMiras/feature/unit_test_recipe_dow…
AndreMiras Jul 31, 2019
542684e
Call Cython via `python -m Cython` rather than system-wide binary
Jul 28, 2019
c261db5
Merge pull request #1937 from JonasT/fix-cython-calls
Aug 4, 2019
40b1164
Drop Python 2 support (#1918)
inclement Aug 4, 2019
588d65d
Merge pull request #1818 from gbm001/gbm_permissions_callback
AndreMiras Aug 4, 2019
5abb0ec
Unit tests Recipe.download_file() partly (#1952)
AndreMiras Aug 5, 2019
b1517a3
Updated version number to 2019.08.09
inclement Aug 9, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,19 @@ __pycache__/

#idea/pycharm
.idea/
.tox

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
coverage.xml
*.cover
.pytest_cache/

# testapp's build folder
testapps/build/

# Dolphin (the KDE file manager autogenerates the file `.directory`)
.directory
17 changes: 7 additions & 10 deletions Dockerfile.py2
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ RUN ${RETRY} curl --location --progress-bar --insecure \
ENV ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"

# get the latest version from https://developer.android.com/studio/index.html
ENV ANDROID_SDK_TOOLS_VERSION="3859397"
ENV ANDROID_SDK_BUILD_TOOLS_VERSION="26.0.2"
ENV ANDROID_SDK_TOOLS_VERSION="4333796"
ENV ANDROID_SDK_BUILD_TOOLS_VERSION="28.0.2"
ENV ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"

Expand All @@ -76,16 +76,14 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
&& echo '### User Sources for Android SDK Manager' \
> "${ANDROID_SDK_HOME}/.android/repositories.cfg"

# accept Android licenses (JDK necessary!)
# Download and accept Android licenses (JDK necessary!)
RUN ${RETRY} apt -y install -qq --no-install-recommends openjdk-8-jdk \
&& apt -y autoremove
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-27" > /dev/null

# download platforms, API, build tools
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19" && \
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-27" && \
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" && \
chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"
# Set avdmanager permissions (executable)
RUN chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"


ENV USER="user"
Expand Down Expand Up @@ -124,8 +122,6 @@ RUN usermod -append --groups sudo ${USER}
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers


RUN pip install --upgrade cython==0.28.6

WORKDIR ${WORK_DIR}
COPY --chown=user:user . ${WORK_DIR}
RUN chown --recursive ${USER} ${ANDROID_SDK_HOME}
Expand All @@ -134,4 +130,5 @@ USER ${USER}
# install python-for-android from current branch
RUN virtualenv --python=python venv \
&& . venv/bin/activate \
&& pip install --upgrade cython==0.28.6 \
&& pip install -e .
21 changes: 10 additions & 11 deletions Dockerfile.py3
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ RUN ${RETRY} curl --location --progress-bar --insecure \
ENV ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"

# get the latest version from https://developer.android.com/studio/index.html
ENV ANDROID_SDK_TOOLS_VERSION="3859397"
ENV ANDROID_SDK_BUILD_TOOLS_VERSION="26.0.2"
ENV ANDROID_SDK_TOOLS_VERSION="4333796"
ENV ANDROID_SDK_BUILD_TOOLS_VERSION="28.0.2"
ENV ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"

Expand All @@ -76,16 +76,14 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
&& echo '### User Sources for Android SDK Manager' \
> "${ANDROID_SDK_HOME}/.android/repositories.cfg"

# accept Android licenses (JDK necessary!)
# Download and accept Android licenses (JDK necessary!)
RUN ${RETRY} apt -y install -qq --no-install-recommends openjdk-8-jdk \
&& apt -y autoremove
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-27" > /dev/null

# download platforms, API, build tools
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19" && \
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-27" && \
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" && \
chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"
# Set avdmanager permissions (executable)
RUN chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"


ENV USER="user"
Expand All @@ -96,7 +94,7 @@ ENV WORK_DIR="${HOME_DIR}" \
# install system dependencies
RUN ${RETRY} apt -y install -qq --no-install-recommends \
python3 virtualenv python3-pip python3-venv \
wget lbzip2 patch sudo \
wget lbzip2 patch sudo python python-pip \
&& apt -y autoremove

# build dependencies
Expand Down Expand Up @@ -124,8 +122,8 @@ RUN useradd --create-home --shell /bin/bash ${USER}
RUN usermod -append --groups sudo ${USER}
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers


RUN pip3 install --upgrade cython==0.28.6
# install cython for python 2 (for python 3 it's inside the venv)
RUN pip2 install --upgrade Cython==0.28.6

WORKDIR ${WORK_DIR}
COPY --chown=user:user . ${WORK_DIR}
Expand All @@ -135,4 +133,5 @@ USER ${USER}
# install python-for-android from current branch
RUN virtualenv --python=python3 venv \
&& . venv/bin/activate \
&& pip3 install --upgrade Cython==0.28.6 \
&& pip3 install -e .
4 changes: 1 addition & 3 deletions ci/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

class TargetPython(Enum):
python2 = 0
python3crystax = 1
python3 = 2


Expand All @@ -22,7 +21,6 @@ class TargetPython(Enum):
'ffpyplayer',
'flask',
'groestlcoin_hash',
'hostpython3crystax',
# https://github.com/kivy/python-for-android/issues/1354
'kiwisolver',
'libmysqlclient',
Expand Down Expand Up @@ -88,5 +86,5 @@ class TargetPython(Enum):
# recipes that were already built will be skipped
CORE_RECIPES = set([
'pyjnius', 'kivy', 'openssl', 'requests', 'sqlite3', 'setuptools',
'numpy', 'android', 'python2', 'python3',
'numpy', 'android', 'hostpython2', 'hostpython3', 'python2', 'python3',
])
15 changes: 14 additions & 1 deletion ci/rebuild_updated_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from pythonforandroid.graph import get_recipe_order_and_bootstrap
from pythonforandroid.toolchain import current_directory
from pythonforandroid.util import BuildInterruptingException
from pythonforandroid.recipe import Recipe
from ci.constants import TargetPython, CORE_RECIPES, BROKEN_RECIPES


Expand Down Expand Up @@ -66,7 +67,7 @@ def build(target_python, requirements):
# iterates to stream the output
for line in sh.python(
testapp, 'apk', '--sdk-dir', android_sdk_home,
'--ndk-dir', android_ndk_home, '--bootstrap', 'sdl2', '--requirements',
'--ndk-dir', android_ndk_home, '--requirements',
requirements, _err_to_out=True, _iter=True):
print(line)

Expand All @@ -78,6 +79,18 @@ def main():
recipes -= CORE_RECIPES
logger.info('recipes to build: {}'.format(recipes))
context = Context()

# removing the deleted recipes for the given target (if any)
for recipe_name in recipes.copy():
try:
Recipe.get_recipe(recipe_name, context)
except ValueError:
# recipe doesn't exist, so probably we remove it
recipes.remove(recipe_name)
logger.warning(
'removed {} from recipes because deleted'.format(recipe_name)
)

# forces the default target
recipes_and_target = recipes | set([target_python.name])
try:
Expand Down
54 changes: 54 additions & 0 deletions doc/source/apis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,60 @@ Working on Android
This page gives details on accessing Android APIs and managing other
interactions on Android.

Storage paths
-------------

If you want to store and retrieve data, you shouldn't just save to
the current directory, and not hardcode `/sdcard/` or some other
path either - it might differ per device.

Instead, the `android` module which you can add to your `--requirements`
allows you to query the most commonly required paths::

from android.storage import app_storage_path
settings_path = app_storage_path()

from android.storage import primary_external_storage_path
primary_ext_storage = primary_external_storage_path()

from android.storage import secondary_external_storage_path
secondary_ext_storage = secondary_external_storage_path()

`app_storage_path()` gives you Android's so-called "internal storage"
which is specific to your app and cannot seen by others or the user.
It compares best to the AppData directory on Windows.

`primary_external_storage_path()` returns Android's so-called
"primary external storage", often found at `/sdcard/` and potentially
accessible to any other app.
It compares best to the Documents directory on Windows.
Requires `Permission.WRITE_EXTERNAL_STORAGE` to read and write to.

`secondary_external_storage_path()` returns Android's so-called
"secondary external storage", often found at `/storage/External_SD/`.
It compares best to an external disk plugged to a Desktop PC, and can
after a device restart become inaccessible if removed.
Requires `Permission.WRITE_EXTERNAL_STORAGE` to read and write to.

.. warning::
Even if `secondary_external_storage_path` returns a path
the external sd card may still not be present.
Only non-empty contents or a successful write indicate that it is.

Read more on all the different storage types and what to use them for
in the Android documentation:

https://developer.android.com/training/data-storage/files

A note on permissions
~~~~~~~~~~~~~~~~~~~~~

Only the internal storage is always accessible with no additional
permissions. For both primary and secondary external storage, you need
to obtain `Permission.WRITE_EXTERNAL_STORAGE` **and the user may deny it.**
Also, if you get it, both forms of external storage may only allow
your app to write to the common pre-existing folders like "Music",
"Documents", and so on. (see the Android Docs linked above for details)

Runtime permissions
-------------------
Expand Down
23 changes: 6 additions & 17 deletions doc/source/buildoptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,14 @@ e.g. ``--requirements=python3``.


CrystaX python3
###############
~~~~~~~~~~~~~~~

.. warning:: python-for-android originally supported Python 3 using the CrystaX
NDK. This support is now being phased out as CrystaX is no longer
actively developed.
python-for-android no longer supports building for Python 3 using the CrystaX
NDK. Instead, use the python3 recipe, which can be built using the normal
Google NDK.

.. note:: You must manually download the `CrystaX NDK
<https://www.crystax.net/android/ndk>`__ and tell
python-for-android to use it with ``--ndk-dir /path/to/NDK``.

Select this by adding the ``python3crystax`` recipe to your
requirements, e.g. ``--requirements=python3crystax``.

This uses the prebuilt Python from the `CrystaX NDK
<https://www.crystax.net/android/ndk>`__, a drop-in replacement for
Google's official NDK which includes many improvements. You
*must* use the CrystaX NDK 10.3.0 or higher when building with
python3. You can get it `here
<https://www.crystax.net/en/download>`__.
.. note:: The last python-for-android version supporting CrystaX was `0.7.0.
<https://github.com/kivy/python-for-android/archive/0.7.0.zip>`__

.. _bootstrap_build_options:

Expand Down
Loading