Skip to content

Commit 17dfa6a

Browse files
authored
Merge pull request #2174 from kivy/release-2020.04.29
Release 2020.04.29
2 parents 8cf66cc + 1ffdb76 commit 17dfa6a

File tree

196 files changed

+3437
-4199
lines changed

Some content is hidden

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

196 files changed

+3437
-4199
lines changed

.deepsource.toml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version = 1
2+
3+
test_patterns = ["tests/**"]
4+
5+
exclude_patterns = ["testapps/**"]
6+
7+
[[analyzers]]
8+
name = "python"
9+
enabled = true
10+
11+
[analyzers.meta]
12+
runtime_version = "3.x.x"

.github/workflows/push.yml

+25-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Unit tests & Build Testapp
1+
name: Unit tests & build apps
22

33
on: ['push', 'pull_request']
44

@@ -42,25 +42,35 @@ jobs:
4242
make test
4343
4444
build:
45-
name: Build testapp
45+
name: Unit test apk
4646
needs: [flake8]
4747
runs-on: ubuntu-latest
4848
strategy:
49+
fail-fast: false
4950
matrix:
50-
build-arch: ['arm64-v8a', 'armeabi-v7a']
51+
build-arch: ['arm64-v8a', 'armeabi-v7a', 'x86_64', 'x86']
5152
steps:
5253
- name: Checkout python-for-android
5354
uses: actions/checkout@v2
55+
# helps with GitHub runner getting out of space
56+
- name: Free disk space
57+
run: |
58+
df -h
59+
sudo swapoff -a
60+
sudo rm -f /swapfile
61+
sudo apt -y clean
62+
docker rmi $(docker image ls -aq)
63+
df -h
5464
- name: Pull docker image
5565
run: |
5666
make docker/pull
57-
- name: Build apk for Python 3 ${{ matrix.build-arch }}
67+
- name: Build apk Python 3 ${{ matrix.build-arch }}
5868
run: |
5969
mkdir -p apks
60-
make docker/run/make/with-artifact/testapps/python3/${{ matrix.build-arch }}
70+
make docker/run/make/with-artifact/testapps-with-numpy/${{ matrix.build-arch }}
6171
- uses: actions/upload-artifact@v1
6272
with:
63-
name: bdisttest_python3_sqlite_openssl_googlendk__${{ matrix.build-arch }}-debug-1.1.apk
73+
name: bdist_test_app_unittests__${{ matrix.build-arch }}-debug-1.1.apk
6474
path: apks
6575

6676
rebuild_updated_recipes:
@@ -74,6 +84,15 @@ jobs:
7484
uses: actions/checkout@v2
7585
with:
7686
ref: 'develop'
87+
# helps with GitHub runner getting out of space
88+
- name: Free disk space
89+
run: |
90+
df -h
91+
sudo swapoff -a
92+
sudo rm -f /swapfile
93+
sudo apt -y clean
94+
docker rmi $(docker image ls -aq)
95+
df -h
7796
- name: Pull docker image
7897
run: |
7998
make docker/pull

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ python_for_android.egg-info
1818
/build/
1919
doc/build
2020
__pycache__/
21+
venv/
2122

2223
#idea/pycharm
2324
.idea/

.travis.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ jobs:
2323
# See also: https://github.com/travis-ci/travis-ci/issues/8589
2424
- type -t deactivate && deactivate || true
2525
- export PATH=/opt/python/3.7/bin:$PATH
26-
# Install tox & virtualenv
27-
# Note: venv/virtualenv are both used by tests/test_pythonpackage.py
28-
- pip3.7 install -U virtualenv
26+
# Install tox
2927
- pip3.7 install tox>=2.0
3028
# Install coveralls & dependencies
3129
# Note: pyOpenSSL needed to send the coveralls reports
@@ -36,9 +34,6 @@ jobs:
3634
- tox -- tests/ --ignore tests/test_pythonpackage.py
3735
name: "Tox Pep8"
3836
env: TOXENV=pep8
39-
- <<: *unittests
40-
name: "Tox Python 2"
41-
env: TOXENV=py27
4237
- <<: *unittests
4338
name: "Tox Python 3 & Coverage"
4439
env: TOXENV=py3
@@ -48,7 +43,7 @@ jobs:
4843
name: Python 3 arm64-v8a (with numpy)
4944
stage: build testapps
5045
before_script: make docker/pull
51-
script: make docker/run/make/testapps/python3/arm64-v8a
46+
script: make docker/run/make/testapps-with-numpy/arm64-v8a
5247
- <<: *testapps
5348
name: Python 3 armeabi-v7a
5449
os: osx
@@ -57,10 +52,19 @@ jobs:
5752
# installs java 1.8, android's SDK/NDK and p4a
5853
- make -f ci/makefiles/osx.mk
5954
- export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
60-
script: make testapps/python3/armeabi-v7a PYTHON_WITH_VERSION=python3
61-
- <<: *testapps
62-
name: Python 2 armeabi-v7a
63-
script: make docker/run/make/testapps/python2/armeabi-v7a
55+
script: make testapps-no-venv/armeabi-v7a
6456
- <<: *testapps
6557
name: Rebuild updated recipes
6658
script: travis_wait 30 make docker/run/make/rebuild_updated_recipes
59+
60+
# Deploy to PyPI using token set in `PYPI_PASSWORD` environment variable
61+
# https://pypi.org/manage/account/token/
62+
# https://travis-ci.org/github/kivy/python-for-android/settings
63+
deploy:
64+
provider: pypi
65+
distributions: sdist bdist_wheel
66+
user: "__token__"
67+
on:
68+
tags: true
69+
repo: kivy/python-for-android
70+
python: 3.7

Dockerfile.py3 renamed to Dockerfile

+2-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# - python-for-android dependencies
44
#
55
# Build with:
6-
# docker build --tag=p4a --file Dockerfile.py3 .
6+
# docker build --tag=p4a --file Dockerfile .
77
#
88
# Run with:
99
# docker run -it --rm p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
@@ -66,20 +66,18 @@ RUN dpkg --add-architecture i386 \
6666
libncurses5:i386 \
6767
libpangox-1.0-0:i386 \
6868
libpangoxft-1.0-0:i386 \
69+
libssl-dev \
6970
libstdc++6:i386 \
7071
libtool \
7172
openjdk-8-jdk \
7273
patch \
7374
pkg-config \
74-
python \
75-
python-pip \
7675
python3 \
7776
python3-dev \
7877
python3-pip \
7978
python3-venv \
8079
sudo \
8180
unzip \
82-
virtualenv \
8381
wget \
8482
zip \
8583
zlib1g-dev \
@@ -95,10 +93,6 @@ RUN useradd --create-home --shell /bin/bash ${USER}
9593
RUN usermod -append --groups sudo ${USER}
9694
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
9795

98-
# install cython for python 2 (for python 3 it's inside the venv)
99-
RUN pip2 install --upgrade Cython==0.28.6 \
100-
&& rm -rf ~/.cache/
101-
10296
WORKDIR ${WORK_DIR}
10397
RUN mkdir ${ANDROID_HOME} && chown --recursive ${USER} ${HOME_DIR} ${ANDROID_HOME}
10498
USER ${USER}

Dockerfile.py2

-94
This file was deleted.

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
include LICENSE README.md
3+
include *.toml
34

45
recursive-include doc *
56
prune doc/build

Makefile

+21-22
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ANDROID_NDK_HOME ?= $(HOME)/.android/android-ndk
1919
all: virtualenv
2020

2121
$(VIRTUAL_ENV):
22-
virtualenv --python=$(PYTHON_WITH_VERSION) $(VIRTUAL_ENV)
22+
python3 -m venv $(VIRTUAL_ENV)
2323
$(PIP) install Cython==0.28.6
2424
$(PIP) install -e .
2525

@@ -28,28 +28,32 @@ virtualenv: $(VIRTUAL_ENV)
2828
# ignores test_pythonpackage.py since it runs for too long
2929
test:
3030
$(TOX) -- tests/ --ignore tests/test_pythonpackage.py
31-
@if test -n "$$CI"; then .tox/py$(PYTHON_MAJOR_MINOR)/bin/coveralls; fi; \
3231

3332
rebuild_updated_recipes: virtualenv
3433
. $(ACTIVATE) && \
3534
ANDROID_SDK_HOME=$(ANDROID_SDK_HOME) ANDROID_NDK_HOME=$(ANDROID_NDK_HOME) \
3635
$(PYTHON) ci/rebuild_updated_recipes.py
3736

38-
testapps/python2/armeabi-v7a: virtualenv
39-
. $(ACTIVATE) && cd testapps/ && \
40-
python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir $(ANDROID_SDK_HOME) --ndk-dir $(ANDROID_NDK_HOME) \
41-
--requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3,setuptools
42-
43-
testapps/python3/arm64-v8a: virtualenv
44-
. $(ACTIVATE) && cd testapps/ && \
45-
python setup_testapp_python3_sqlite_openssl.py apk --sdk-dir $(ANDROID_SDK_HOME) --ndk-dir $(ANDROID_NDK_HOME) \
37+
testapps-with-numpy/%: virtualenv
38+
$(eval $@_APP_ARCH := $(shell basename $*))
39+
. $(ACTIVATE) && cd testapps/on_device_unit_tests/ && \
40+
python setup.py apk --sdk-dir $(ANDROID_SDK_HOME) --ndk-dir $(ANDROID_NDK_HOME) \
4641
--requirements libffi,sdl2,pyjnius,kivy,python3,openssl,requests,sqlite3,setuptools,numpy \
47-
--arch=arm64-v8a
42+
--arch=$($@_APP_ARCH)
4843

49-
testapps/python3/armeabi-v7a: virtualenv
50-
. $(ACTIVATE) && cd testapps/ && \
51-
python setup_testapp_python3_sqlite_openssl.py apk --sdk-dir $(ANDROID_SDK_HOME) --ndk-dir $(ANDROID_NDK_HOME) \
52-
--arch=armeabi-v7a
44+
testapps/%: virtualenv
45+
$(eval $@_APP_ARCH := $(shell basename $*))
46+
. $(ACTIVATE) && cd testapps/on_device_unit_tests/ && \
47+
python setup.py apk --sdk-dir $(ANDROID_SDK_HOME) --ndk-dir $(ANDROID_NDK_HOME) \
48+
--arch=$($@_APP_ARCH)
49+
50+
testapps-no-venv/%:
51+
pip3 install Cython==0.28.6
52+
pip3 install -e .
53+
$(eval $@_APP_ARCH := $(shell basename $*))
54+
cd testapps/on_device_unit_tests/ && \
55+
python3 setup.py apk --sdk-dir $(ANDROID_SDK_HOME) --ndk-dir $(ANDROID_NDK_HOME) \
56+
--arch=$($@_APP_ARCH)
5357

5458
clean:
5559
find . -type d -name "__pycache__" -exec rm -r {} +
@@ -62,7 +66,7 @@ docker/pull:
6266
docker pull $(DOCKER_IMAGE):latest || true
6367

6468
docker/build:
65-
docker build --cache-from=$(DOCKER_IMAGE) --tag=$(DOCKER_IMAGE) --file=Dockerfile.py3 .
69+
docker build --cache-from=$(DOCKER_IMAGE) --tag=$(DOCKER_IMAGE) .
6670

6771
docker/push:
6872
docker push $(DOCKER_IMAGE)
@@ -77,14 +81,9 @@ docker/run/make/%: docker/build
7781
docker run --rm --env-file=.env $(DOCKER_IMAGE) make $*
7882

7983
docker/run/make/with-artifact/%: docker/build
80-
ifeq (,$(findstring python3,$($*)))
81-
$(eval $@_APP_NAME := bdisttest_python3_sqlite_openssl_googlendk)
82-
else
83-
$(eval $@_APP_NAME := bdisttest_python2_sqlite_openssl)
84-
endif
8584
$(eval $@_APP_ARCH := $(shell basename $*))
8685
docker run --name p4a-latest --env-file=.env $(DOCKER_IMAGE) make $*
87-
docker cp p4a-latest:/home/user/app/testapps/$($@_APP_NAME)__$($@_APP_ARCH)-debug-1.1-.apk ./apks
86+
docker cp p4a-latest:/home/user/app/testapps/on_device_unit_tests/bdist_unit_tests_app__$($@_APP_ARCH)-debug-1.1-.apk ./apks
8887
docker rm -fv p4a-latest
8988

9089
docker/run/shell: docker/build

README.md

+5-14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ python-for-android
22
==================
33

44
[![Build Status](https://travis-ci.org/kivy/python-for-android.svg?branch=develop)](https://travis-ci.org/kivy/python-for-android)
5+
[![Unit tests & build apps](https://github.com/kivy/python-for-android/workflows/Unit%20tests%20&%20build%20apps/badge.svg?branch=develop)](https://github.com/kivy/python-for-android/actions?query=workflow%3A%22Unit+tests+%26+build+apps%22)
56
[![Coverage Status](https://coveralls.io/repos/github/kivy/python-for-android/badge.svg?branch=develop&kill_cache=1)](https://coveralls.io/github/kivy/python-for-android?branch=develop)
67
[![Backers on Open Collective](https://opencollective.com/kivy/backers/badge.svg)](#backers)
78
[![Sponsors on Open Collective](https://opencollective.com/kivy/sponsors/badge.svg)](#sponsors)
@@ -102,23 +103,13 @@ new recipe for python3 (3.7.1) had a new build system which was
102103
applied to the ancient python recipe, allowing us to bump the python2
103104
version number to 2.7.15. This change unified the build process for
104105
both python recipes, and probably solved various issues detected over the
105-
years. It should also be mentioned that these **unified python recipes**
106-
require a **minimum target api level of 21**,
107-
*Android 5.0 - Lollipop*, so in the case that you need to build targeting an
106+
years. These **unified python recipes** require a **minimum target api level of 21**,
107+
*Android 5.0 - Lollipop*. If you need to build targeting an
108108
api level below 21, you should use an older version of python-for-android
109109
(<=0.7.1).
110110

111-
Be aware that this project is in constant development so, as per time of writing,
112-
you should use a minimum on Android's NDK r19, and ``we recommend using NDK r19b``.
113-
This is because the toolchains installed by
114-
default with the NDK can be used *in-place* and the python-for-android project
115-
has been adapted for that feature. Also be aware that more recent versions of the
116-
Android's NDK may not work.
117-
118-
Those mentioned changes has been done this way to make easier the transition
119-
between python3 and python2. We will slowly phase out python2 support
120-
towards 2020...so...if you are using python2 in your projects you should
121-
consider migrating it into python3.
111+
On March of 2020 we dropped support for creating apps that use Python 2. The latest
112+
python-for-android release that supported building Python 2 was version 2019.10.6.
122113

123114
## Contributors
124115

0 commit comments

Comments
 (0)