Skip to content

Commit 7910400

Browse files
author
Pol Canelles
committed
Merge branch master of https://github.com/kivy/python-for-android into fix-env-py2...after solved conflicts
2 parents 53c485b + 764b59e commit 7910400

File tree

314 files changed

+6600
-4228
lines changed

Some content is hidden

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

314 files changed

+6600
-4228
lines changed

.travis.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
sudo: required
2+
3+
language: generic
4+
5+
services:
6+
- docker
7+
8+
before_install:
9+
- sudo apt-get update -qq
10+
- sudo apt-get install -qq python-tox
11+
12+
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'
20+
21+
before_script:
22+
# we want to fail fast on tox errors without having to `docker build` first
23+
- tox
24+
25+
script:
26+
- docker build --tag=p4a .
27+
- docker run p4a /bin/sh -c "$COMMAND"

Dockerfile

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Dockerfile with:
2+
# - Android build environment
3+
# - python-for-android dependencies
4+
# Build with:
5+
# docker build --tag=p4a .
6+
# Run with:
7+
# docker run p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
8+
# Or for interactive shell:
9+
# docker run -it --rm p4a
10+
#
11+
# TODO:
12+
# - delete archives to keep small the container small
13+
# - setup caching (for apt, pip, ndk, sdk and p4a recipes downloads)
14+
FROM ubuntu:16.04
15+
16+
17+
# get the latest version from https://developer.android.com/ndk/downloads/index.html
18+
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"
21+
# get the latest version from https://developer.android.com/studio/index.html
22+
ENV ANDROID_SDK_TOOLS_VERSION="3859397"
23+
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}"
36+
37+
# 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+
41+
# build dependencies
42+
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
43+
RUN dpkg --add-architecture i386 && apt update -qq && apt install -qq --yes --no-install-recommends \
44+
build-essential ccache git libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
45+
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 python2.7 python2.7-dev \
46+
openjdk-8-jdk unzip zlib1g-dev zlib1g:i386
47+
RUN pip install --quiet --upgrade cython==0.21
48+
49+
# download and install Android NDK
50+
RUN curl --location --progress-bar "${ANDROID_NDK_DL_URL}" --output "${ANDROID_NDK_ARCHIVE}" && \
51+
mkdir --parents "${ANDROID_NDK_HOME_V}" && \
52+
unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}" && \
53+
ln -sfn "${ANDROID_NDK_HOME_V}" "${ANDROID_NDK_HOME}"
54+
55+
# download and install CrystaX NDK
56+
# added `gnutls_handshake` flag to workaround random `gnutls_handshake()` issues
57+
RUN curl --location --progress-bar "${CRYSTAX_NDK_DL_URL}" --output "${CRYSTAX_NDK_ARCHIVE}" --insecure && \
58+
bsdtar -xf "${CRYSTAX_NDK_ARCHIVE}" --directory "${ANDROID_HOME}" \
59+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/docs \
60+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/samples \
61+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/tests \
62+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/renderscript \
63+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/x86_64-* \
64+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/llvm-* \
65+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/aarch64-* \
66+
--exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/mips64el-* && \
67+
ln -sfn "${CRYSTAX_NDK_HOME_V}" "${CRYSTAX_NDK_HOME}"
68+
69+
# download and install Android SDK
70+
RUN curl --location --progress-bar "${ANDROID_SDK_TOOLS_DL_URL}" --output "${ANDROID_SDK_TOOLS_ARCHIVE}" && \
71+
mkdir --parents "${ANDROID_SDK_HOME}" && \
72+
unzip -q "${ANDROID_SDK_TOOLS_ARCHIVE}" -d "${ANDROID_SDK_HOME}"
73+
74+
# update Android SDK, install Android API, Build Tools...
75+
RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" && \
76+
echo '### User Sources for Android SDK Manager' > "${ANDROID_SDK_HOME}/.android/repositories.cfg"
77+
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" --licenses
78+
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19"
79+
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;26.0.2"
80+
81+
# install python-for-android from current branch
82+
WORKDIR /app
83+
COPY . /app
84+
RUN virtualenv --python=python venv && . venv/bin/activate && pip install --quiet -e .

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2010-2015 Kivy Team and other contributors
1+
Copyright (c) 2010-2017 Kivy Team and other contributors
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 0 additions & 96 deletions
This file was deleted.

README.rst

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
python-for-android
2+
==================
3+
4+
|Build Status|
5+
6+
.. |Build Status| image:: https://secure.travis-ci.org/kivy/python-for-android.png?branch=master
7+
:target: https://travis-ci.org/kivy/python-for-android
8+
9+
python-for-android is a packager for Python apps on Android. You can
10+
create your own Python distribution including the modules and
11+
dependencies you want, and bundle it in an APK along with your own code.
12+
13+
Features include:
14+
15+
- Support for building with both Python 2 and Python 3.
16+
- Different app backends including Kivy, PySDL2, and a WebView with
17+
Python webserver.
18+
- Automatic support for most pure Python modules, and built in support
19+
for many others, including popular dependencies such as numpy and
20+
sqlalchemy.
21+
- Multiple architecture targets, for APKs optimised on any given
22+
device.
23+
24+
For documentation and support, see:
25+
26+
- Website: http://python-for-android.readthedocs.io
27+
- Mailing list: https://groups.google.com/forum/#!forum/kivy-users or
28+
https://groups.google.com/forum/#!forum/python-android.
29+
30+
In 2015 these tools were rewritten to provide a new, easier to use and
31+
extend interface. If you are looking for the old toolchain with
32+
distribute.sh and build.py, it is still available at
33+
https://github.com/kivy/python-for-android/tree/old\_toolchain, and
34+
issues and PRs relating to this branch are still accepted. However, the
35+
new toolchain contains all the same functionality via the built in
36+
pygame bootstrap.
37+
38+
Documentation
39+
=============
40+
41+
Follow the `quickstart
42+
instructions <https://python-for-android.readthedocs.org/en/latest/quickstart/>`__
43+
to install and begin creating APKs.
44+
45+
Quick instructions to start would be::
46+
47+
pip install python-for-android
48+
49+
or to test the master branch::
50+
51+
pip install git+https://github.com/kivy/python-for-android.git
52+
53+
The executable is called ``python-for-android`` or ``p4a`` (both are
54+
equivalent). To test that the installation worked, try::
55+
56+
python-for-android recipes
57+
58+
This should return a list of recipes available to be built.
59+
60+
To build any distributions, you need to set up the Android SDK and NDK
61+
as described in the documentation linked above.
62+
63+
If you did this, to build an APK with SDL2 you can try e.g.::
64+
65+
p4a apk --requirements=kivy --private /home/asandy/devel/planewave_frozen/ --package=net.inclem.planewavessdl2 --name="planewavessdl2" --version=0.5 --bootstrap=sdl2
66+
67+
For full instructions and parameter options, see `the
68+
documentation <https://python-for-android.readthedocs.io/en/latest/quickstart/#usage>`__.
69+
70+
Support
71+
=======
72+
73+
If you need assistance, you can ask for help on our mailing list:
74+
75+
- User Group: https://groups.google.com/group/kivy-users
76+
77+
78+
We also have an IRC channel:
79+
80+
- Server: irc.freenode.net
81+
- Port: 6667, 6697 (SSL only)
82+
- Channel: #kivy
83+
84+
Contributing
85+
============
86+
87+
We love pull requests and discussing novel ideas. Check out our
88+
`contribution guide <http://kivy.org/docs/contribute.html>`__ and feel
89+
free to improve python-for-android.
90+
91+
The following mailing list and IRC channel are used exclusively for
92+
discussions about developing the Kivy framework and its sister projects:
93+
94+
- Dev Group: https://groups.google.com/group/kivy-dev
95+
96+
97+
IRC channel:
98+
99+
- Server: irc.freenode.net
100+
- Port: 6667, 6697 (SSL only)
101+
- Channel: #kivy or #kivy-dev
102+
103+
License
104+
=======
105+
106+
python-for-android is released under the terms of the MIT License.
107+
Please refer to the LICENSE file.

0 commit comments

Comments
 (0)