Skip to content

Commit 3f0ec5a

Browse files
committed
Merge remote-tracking branch 'upstream/master'
# Conflicts: # pythonforandroid/bootstraps/sdl2/build/jni/src/start.c
2 parents 8c1b86a + ad9a6d0 commit 3f0ec5a

118 files changed

Lines changed: 4398 additions & 880 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
venv/
2+
.buildozer/
3+
**/.pytest_cache/
4+
.tox/
5+
bin/
6+
*.pyc
7+
**/__pycache__
8+
*.egg-info/

.github/ISSUE_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!--
22
The issue tracker is a tool to address bugs.
3-
Please use the #kivy IRC channel on freenode or Stack Overflow for
4-
support questions, more information at https://github.com/kivy/python-for-android#support
3+
Please use the Disord community or Stack Overflow for support questions,
4+
more information at https://github.com/kivy/python-for-android#support
55
66
Before opening a new issue, make sure you do the following:
77
* check that your issue isn't already filed: https://github.com/kivy/python-for-android/issues

.travis.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,25 @@ services:
66
- docker
77

88
before_install:
9-
- sudo apt-get update -qq
10-
- sudo apt-get install -qq python-tox
9+
- sudo apt update -qq
10+
- sudo apt install -qq --no-install-recommends python2.7 python3
11+
- sudo pip install tox>=2.0
12+
# https://github.com/travis-ci/travis-ci/issues/6069#issuecomment-266546552
13+
- git remote set-branches --add origin master
14+
- git fetch
1115

1216
env:
13-
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk'
14-
# overrides requirements to skip `peewee` pure python module, see:
15-
# https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054
16-
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3,setuptools'
17-
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk --bootstrap sdl2 --requirements python2,numpy'
18-
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/crystax-ndk'
19-
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/crystax-ndk --requirements python3crystax,setuptools,android'
17+
global:
18+
- ANDROID_SDK_HOME=/opt/android/android-sdk
19+
- ANDROID_NDK_HOME=/opt/android/android-ndk
20+
matrix:
21+
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python3'
22+
# overrides requirements to skip `peewee` pure python module, see:
23+
# https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054
24+
- 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'
25+
- 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'
26+
# builds only the recipes that moved
27+
- COMMAND='. venv/bin/activate && ./ci/rebuild_updated_recipes.py'
2028

2129
before_script:
2230
# we want to fail fast on tox errors without having to `docker build` first

Dockerfile

Lines changed: 110 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,132 @@
11
# Dockerfile with:
2-
# - Android build environment
3-
# - python-for-android dependencies
2+
# - Android build environment
3+
# - python-for-android dependencies
4+
#
45
# Build with:
5-
# docker build --tag=p4a .
6+
# docker build --tag=p4a .
7+
#
68
# Run with:
7-
# docker run p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
9+
# docker run -it --rm p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
10+
#
811
# Or for interactive shell:
9-
# docker run -it --rm p4a
12+
# docker run -it --rm p4a
1013
#
11-
# TODO:
12-
# - delete archives to keep small the container small
13-
# - setup caching (for apt, pip, ndk, sdk and p4a recipes downloads)
14+
# Note:
15+
# Use 'docker run' without '--rm' flag for keeping the container and use
16+
# 'docker commit <container hash> <new image>' to extend the original image
17+
1418
FROM ubuntu:18.04
1519

20+
ENV ANDROID_HOME="/opt/android"
1621

17-
# get the latest version from https://developer.android.com/ndk/downloads/index.html
22+
RUN apt -y update -qq \
23+
&& apt -y install -qq --no-install-recommends curl unzip \
24+
&& apt -y autoremove \
25+
&& apt -y clean
26+
27+
28+
ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
1829
ENV ANDROID_NDK_VERSION="16b"
19-
# get the latest version from https://www.crystax.net/en/download
20-
ENV CRYSTAX_NDK_VERSION="10.3.2"
30+
ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}"
31+
32+
# get the latest version from https://developer.android.com/ndk/downloads/index.html
33+
ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip"
34+
ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"
35+
36+
# download and install Android NDK
37+
RUN curl --location --progress-bar --insecure \
38+
"${ANDROID_NDK_DL_URL}" \
39+
--output "${ANDROID_NDK_ARCHIVE}" \
40+
&& mkdir --parents "${ANDROID_NDK_HOME_V}" \
41+
&& unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}" \
42+
&& ln -sfn "${ANDROID_NDK_HOME_V}" "${ANDROID_NDK_HOME}" \
43+
&& rm -rf "${ANDROID_NDK_ARCHIVE}"
44+
45+
46+
ENV ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"
47+
2148
# get the latest version from https://developer.android.com/studio/index.html
2249
ENV ANDROID_SDK_TOOLS_VERSION="3859397"
50+
ENV ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
51+
ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
2352

24-
ENV ANDROID_HOME="/opt/android"
25-
ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk" \
26-
CRYSTAX_NDK_HOME="${ANDROID_HOME}/crystax-ndk" \
27-
ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"
28-
ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}" \
29-
CRYSTAX_NDK_HOME_V="${CRYSTAX_NDK_HOME}-${CRYSTAX_NDK_VERSION}"
30-
ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip" \
31-
CRYSTAX_NDK_ARCHIVE="crystax-ndk-${CRYSTAX_NDK_VERSION}-linux-x86.tar.xz" \
32-
ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
33-
ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}" \
34-
CRYSTAX_NDK_DL_URL="https://eu.crystax.net/download/${CRYSTAX_NDK_ARCHIVE}" \
35-
ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
53+
# download and install Android SDK
54+
RUN curl --location --progress-bar --insecure \
55+
"${ANDROID_SDK_TOOLS_DL_URL}" \
56+
--output "${ANDROID_SDK_TOOLS_ARCHIVE}" \
57+
&& mkdir --parents "${ANDROID_SDK_HOME}" \
58+
&& unzip -q "${ANDROID_SDK_TOOLS_ARCHIVE}" -d "${ANDROID_SDK_HOME}" \
59+
&& rm -rf "${ANDROID_SDK_TOOLS_ARCHIVE}"
60+
61+
# update Android SDK, install Android API, Build Tools...
62+
RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
63+
&& echo '### User Sources for Android SDK Manager' \
64+
> "${ANDROID_SDK_HOME}/.android/repositories.cfg"
65+
66+
# accept Android licenses (JDK necessary!)
67+
RUN apt -y update -qq \
68+
&& apt -y install -qq --no-install-recommends openjdk-8-jdk \
69+
&& apt -y autoremove \
70+
&& apt -y clean
71+
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" --licenses > /dev/null
72+
73+
# download platforms, API, build tools
74+
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19" && \
75+
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-27" && \
76+
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;26.0.2" && \
77+
chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"
78+
79+
80+
ENV USER="user"
81+
ENV HOME_DIR="/home/${USER}"
82+
ENV WORK_DIR="${HOME_DIR}" \
83+
PATH="${HOME_DIR}/.local/bin:${PATH}"
3684

3785
# install system dependencies
38-
RUN apt update -qq && apt install -qq --yes --no-install-recommends \
39-
python virtualenv python-pip wget curl lbzip2 patch bsdtar && \
40-
rm -rf /var/lib/apt/lists/*
86+
RUN apt -y update -qq \
87+
&& apt -y install -qq --no-install-recommends \
88+
python virtualenv python-pip wget lbzip2 patch sudo \
89+
&& apt -y autoremove \
90+
&& apt -y clean
4191

4292
# build dependencies
4393
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
44-
RUN dpkg --add-architecture i386 && apt update -qq && apt install -qq --yes --no-install-recommends \
45-
build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
46-
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev \
47-
openjdk-8-jdk unzip zlib1g-dev zlib1g:i386 && \
48-
rm -rf /var/lib/apt/lists/*
49-
RUN pip install --quiet --upgrade cython==0.21
94+
RUN dpkg --add-architecture i386 \
95+
&& apt -y update -qq \
96+
&& apt -y install -qq --no-install-recommends \
97+
build-essential ccache git python2.7 python2.7-dev \
98+
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
99+
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
100+
zip zlib1g-dev zlib1g:i386 \
101+
&& apt -y autoremove \
102+
&& apt -y clean
50103

51-
# download and install Android NDK
52-
RUN curl --location --progress-bar "${ANDROID_NDK_DL_URL}" --output "${ANDROID_NDK_ARCHIVE}" && \
53-
mkdir --parents "${ANDROID_NDK_HOME_V}" && \
54-
unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}" && \
55-
ln -sfn "${ANDROID_NDK_HOME_V}" "${ANDROID_NDK_HOME}" && \
56-
rm -rf "${ANDROID_NDK_ARCHIVE}"
57-
58-
# download and install CrystaX NDK
59-
# added `gnutls_handshake` flag to workaround random `gnutls_handshake()` issues
60-
RUN curl --location --progress-bar "${CRYSTAX_NDK_DL_URL}" --output "${CRYSTAX_NDK_ARCHIVE}" --insecure && \
61-
bsdtar -xf "${CRYSTAX_NDK_ARCHIVE}" --directory "${ANDROID_HOME}" \
62-
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/docs \
63-
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/samples \
64-
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/tests \
65-
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/renderscript \
66-
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/x86_64-* \
67-
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/llvm-* \
68-
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/aarch64-* \
69-
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/mips64el-* && \
70-
ln -sfn "${CRYSTAX_NDK_HOME_V}" "${CRYSTAX_NDK_HOME}" && \
71-
rm -rf "${CRYSTAX_NDK_ARCHIVE}"
104+
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
105+
RUN apt -y update -qq \
106+
&& apt -y install -qq --no-install-recommends \
107+
autoconf automake cmake gettext libltdl-dev libtool pkg-config \
108+
&& apt -y autoremove \
109+
&& apt -y clean
72110

73-
# download and install Android SDK
74-
RUN curl --location --progress-bar "${ANDROID_SDK_TOOLS_DL_URL}" --output "${ANDROID_SDK_TOOLS_ARCHIVE}" && \
75-
mkdir --parents "${ANDROID_SDK_HOME}" && \
76-
unzip -q "${ANDROID_SDK_TOOLS_ARCHIVE}" -d "${ANDROID_SDK_HOME}" && \
77-
rm -rf "${ANDROID_SDK_TOOLS_ARCHIVE}"
78111

79-
# update Android SDK, install Android API, Build Tools...
80-
RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" && \
81-
echo '### User Sources for Android SDK Manager' > "${ANDROID_SDK_HOME}/.android/repositories.cfg"
82-
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" --licenses
83-
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19"
84-
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;26.0.2"
112+
# prepare non root env
113+
RUN useradd --create-home --shell /bin/bash ${USER}
114+
115+
# with sudo access and no password
116+
RUN usermod -append --groups sudo ${USER}
117+
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
118+
119+
120+
RUN pip install --upgrade cython==0.28.6
121+
122+
WORKDIR ${WORK_DIR}
123+
COPY . ${WORK_DIR}
124+
125+
# user needs ownership/write access to these directories
126+
RUN chown --recursive ${USER} ${WORK_DIR} ${ANDROID_SDK_HOME}
127+
USER ${USER}
85128

86129
# install python-for-android from current branch
87-
WORKDIR /app
88-
COPY . /app
89-
RUN virtualenv --python=python venv && . venv/bin/activate && pip install --quiet -e .
130+
RUN virtualenv --python=python venv \
131+
&& . venv/bin/activate \
132+
&& pip install -e .

README.rst

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,7 @@ If you need assistance, you can ask for help on our mailing list:
8787
- User Group: https://groups.google.com/group/kivy-users
8888
8989

90-
We also have an IRC channel:
91-
92-
- Server: irc.freenode.net
93-
- Port: 6667, 6697 (SSL only)
94-
- Channel: #kivy
90+
We also have `#support Discord channel <https://chat.kivy.org/>`_.
9591

9692
Contributing
9793
============
@@ -106,11 +102,7 @@ discussions about developing the Kivy framework and its sister projects:
106102
- Dev Group: https://groups.google.com/group/kivy-dev
107103
108104

109-
IRC channel:
110-
111-
- Server: irc.freenode.net
112-
- Port: 6667, 6697 (SSL only)
113-
- Channel: #kivy or #kivy-dev
105+
We also have `#dev Discord channel <https://chat.kivy.org/>`_.
114106

115107
License
116108
=======

ci/__init__.py

Whitespace-only changes.

ci/constants.py

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
from enum import Enum
2+
3+
4+
class TargetPython(Enum):
5+
python2 = 0
6+
python3crystax = 1
7+
8+
9+
# recipes that currently break the build
10+
# a recipe could be broken for a target Python and not for the other,
11+
# hence we're maintaining one list per Python target
12+
BROKEN_RECIPES_PYTHON2 = set([
13+
# pythonhelpers.h:12:18: fatal error: string: No such file or directory
14+
'atom',
15+
# https://github.com/kivy/python-for-android/issues/550
16+
'audiostream',
17+
'brokenrecipe',
18+
# https://github.com/kivy/python-for-android/issues/1409
19+
'enaml',
20+
'evdev',
21+
# distutils.errors.DistutilsError
22+
# Could not find suitable distribution for Requirement.parse('cython')
23+
'ffpyplayer',
24+
'flask',
25+
'groestlcoin_hash',
26+
'hostpython3crystax',
27+
# https://github.com/kivy/python-for-android/issues/1398
28+
'ifaddrs',
29+
# https://github.com/kivy/python-for-android/issues/1354
30+
'kivent_core', 'kivent_cymunk', 'kivent_particles', 'kivent_polygen',
31+
'kiwisolver',
32+
# https://github.com/kivy/python-for-android/issues/1399
33+
'libglob',
34+
'libmysqlclient',
35+
'libsecp256k1',
36+
'libtribler',
37+
'ndghttpsclient',
38+
'm2crypto',
39+
'netifaces',
40+
'Pillow',
41+
# depends on cffi that still seems to have compilation issues
42+
'protobuf_cpp',
43+
'xeddsa',
44+
'x3dh',
45+
'pynacl',
46+
'doubleratchet',
47+
'omemo',
48+
'cryptography',
49+
# https://github.com/kivy/python-for-android/issues/1405
50+
'psycopg2',
51+
'pygame',
52+
# most likely some setup in the Docker container, because it works in host
53+
'pyjnius', 'pyopenal',
54+
'pyproj',
55+
'pysdl2',
56+
'pyzmq',
57+
'secp256k1',
58+
'shapely',
59+
'twisted',
60+
'vlc',
61+
'websocket-client',
62+
'zeroconf',
63+
'zope',
64+
])
65+
BROKEN_RECIPES_PYTHON3_CRYSTAX = set([
66+
'brokenrecipe',
67+
# enum34 is not compatible with Python 3.6 standard library
68+
# https://stackoverflow.com/a/45716067/185510
69+
'enum34',
70+
# https://github.com/kivy/python-for-android/issues/1398
71+
'ifaddrs',
72+
# https://github.com/kivy/python-for-android/issues/1399
73+
'libglob',
74+
# cannot find -lcrystax
75+
'cffi', 'pycryptodome', 'pymuk', 'secp256k1',
76+
# https://github.com/kivy/python-for-android/issues/1404
77+
'cryptography',
78+
# https://github.com/kivy/python-for-android/issues/1294
79+
'ffmpeg', 'ffpyplayer',
80+
# https://github.com/kivy/python-for-android/pull/1307 ?
81+
'gevent',
82+
'icu',
83+
# https://github.com/kivy/python-for-android/issues/1354
84+
'kivent_core', 'kivent_cymunk', 'kivent_particles', 'kivent_polygen',
85+
# https://github.com/kivy/python-for-android/issues/1405
86+
'libpq', 'psycopg2',
87+
'netifaces',
88+
# https://github.com/kivy/python-for-android/issues/1315 ?
89+
'opencv',
90+
'protobuf_cpp',
91+
# most likely some setup in the Docker container, because it works in host
92+
'pyjnius', 'pyopenal',
93+
# SyntaxError: invalid syntax (Python2)
94+
'storm',
95+
'vlc',
96+
])
97+
BROKEN_RECIPES = {
98+
TargetPython.python2: BROKEN_RECIPES_PYTHON2,
99+
TargetPython.python3crystax: BROKEN_RECIPES_PYTHON3_CRYSTAX,
100+
}
101+
# recipes that were already built will be skipped
102+
CORE_RECIPES = set([
103+
'pyjnius', 'kivy', 'openssl', 'requests', 'sqlite3', 'setuptools',
104+
'numpy', 'android', 'python2', 'python3',
105+
])

0 commit comments

Comments
 (0)