Skip to content

Commit

Permalink
Merge branch 'adding-more-assets' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Pfeiffer committed Apr 26, 2020
2 parents 6a1fdcc + bcee016 commit 85f7789
Show file tree
Hide file tree
Showing 44 changed files with 880 additions and 523 deletions.
12 changes: 12 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version = 1

test_patterns = ["tests/**"]

exclude_patterns = ["testapps/**"]

[[analyzers]]
name = "python"
enabled = true

[analyzers.meta]
runtime_version = "3.x.x"
18 changes: 18 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ jobs:
steps:
- name: Checkout python-for-android
uses: actions/checkout@v2
# helps with GitHub runner getting out of space
- name: Free disk space
run: |
df -h
sudo swapoff -a
sudo rm -f /swapfile
sudo apt -y clean
docker rmi $(docker image ls -aq)
df -h
- name: Pull docker image
run: |
make docker/pull
Expand All @@ -75,6 +84,15 @@ jobs:
uses: actions/checkout@v2
with:
ref: 'develop'
# helps with GitHub runner getting out of space
- name: Free disk space
run: |
df -h
sudo swapoff -a
sudo rm -f /swapfile
sudo apt -y clean
docker rmi $(docker image ls -aq)
df -h
- name: Pull docker image
run: |
make docker/pull
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ python_for_android.egg-info
/build/
doc/build
__pycache__/
venv/

#idea/pycharm
.idea/
Expand Down
18 changes: 14 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ jobs:
# See also: https://github.com/travis-ci/travis-ci/issues/8589
- type -t deactivate && deactivate || true
- export PATH=/opt/python/3.7/bin:$PATH
# Install tox & virtualenv
# Note: venv/virtualenv are both used by tests/test_pythonpackage.py
- pip3.7 install -U virtualenv
# Install tox
- pip3.7 install tox>=2.0
# Install coveralls & dependencies
# Note: pyOpenSSL needed to send the coveralls reports
Expand Down Expand Up @@ -54,7 +52,19 @@ jobs:
# installs java 1.8, android's SDK/NDK and p4a
- make -f ci/makefiles/osx.mk
- export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
script: make testapps/armeabi-v7a PYTHON_WITH_VERSION=python3
script: make testapps-no-venv/armeabi-v7a
- <<: *testapps
name: Rebuild updated recipes
script: travis_wait 30 make docker/run/make/rebuild_updated_recipes

# Deploy to PyPI using token set in `PYPI_PASSWORD` environment variable
# https://pypi.org/manage/account/token/
# https://travis-ci.org/github/kivy/python-for-android/settings
deploy:
provider: pypi
distributions: sdist bdist_wheel
user: "__token__"
on:
tags: true
repo: kivy/python-for-android
python: 3.7
10 changes: 2 additions & 8 deletions Dockerfile.py3 → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# - python-for-android dependencies
#
# Build with:
# docker build --tag=p4a --file Dockerfile.py3 .
# docker build --tag=p4a --file Dockerfile .
#
# Run with:
# docker run -it --rm p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
Expand Down Expand Up @@ -66,20 +66,18 @@ RUN dpkg --add-architecture i386 \
libncurses5:i386 \
libpangox-1.0-0:i386 \
libpangoxft-1.0-0:i386 \
libssl-dev \
libstdc++6:i386 \
libtool \
openjdk-8-jdk \
patch \
pkg-config \
python \
python-pip \
python3 \
python3-dev \
python3-pip \
python3-venv \
sudo \
unzip \
virtualenv \
wget \
zip \
zlib1g-dev \
Expand All @@ -95,10 +93,6 @@ RUN useradd --create-home --shell /bin/bash ${USER}
RUN usermod -append --groups sudo ${USER}
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

# install cython for python 2 (for python 3 it's inside the venv)
RUN pip2 install --upgrade Cython==0.28.6 \
&& rm -rf ~/.cache/

WORKDIR ${WORK_DIR}
RUN mkdir ${ANDROID_HOME} && chown --recursive ${USER} ${HOME_DIR} ${ANDROID_HOME}
USER ${USER}
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

include LICENSE README.md
include *.toml

recursive-include doc *
prune doc/build
Expand Down
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ANDROID_NDK_HOME ?= $(HOME)/.android/android-ndk
all: virtualenv

$(VIRTUAL_ENV):
virtualenv --python=$(PYTHON_WITH_VERSION) $(VIRTUAL_ENV)
python3 -m venv $(VIRTUAL_ENV)
$(PIP) install Cython==0.28.6
$(PIP) install -e .

Expand All @@ -28,7 +28,6 @@ virtualenv: $(VIRTUAL_ENV)
# ignores test_pythonpackage.py since it runs for too long
test:
$(TOX) -- tests/ --ignore tests/test_pythonpackage.py
@if test -n "$$CI"; then .tox/py$(PYTHON_MAJOR_MINOR)/bin/coveralls; fi; \

rebuild_updated_recipes: virtualenv
. $(ACTIVATE) && \
Expand All @@ -48,6 +47,14 @@ testapps/%: virtualenv
python setup.py apk --sdk-dir $(ANDROID_SDK_HOME) --ndk-dir $(ANDROID_NDK_HOME) \
--arch=$($@_APP_ARCH)

testapps-no-venv/%:
pip3 install Cython==0.28.6
pip3 install -e .
$(eval $@_APP_ARCH := $(shell basename $*))
cd testapps/on_device_unit_tests/ && \
python3 setup.py apk --sdk-dir $(ANDROID_SDK_HOME) --ndk-dir $(ANDROID_NDK_HOME) \
--arch=$($@_APP_ARCH)

clean:
find . -type d -name "__pycache__" -exec rm -r {} +
find . -type d -name "*.egg-info" -exec rm -r {} +
Expand All @@ -59,7 +66,7 @@ docker/pull:
docker pull $(DOCKER_IMAGE):latest || true

docker/build:
docker build --cache-from=$(DOCKER_IMAGE) --tag=$(DOCKER_IMAGE) --file=Dockerfile.py3 .
docker build --cache-from=$(DOCKER_IMAGE) --tag=$(DOCKER_IMAGE) .

docker/push:
docker push $(DOCKER_IMAGE)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ python-for-android
==================

[![Build Status](https://travis-ci.org/kivy/python-for-android.svg?branch=develop)](https://travis-ci.org/kivy/python-for-android)
[![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)
[![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)
[![Backers on Open Collective](https://opencollective.com/kivy/backers/badge.svg)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/kivy/sponsors/badge.svg)](#sponsors)
Expand Down
90 changes: 45 additions & 45 deletions doc/source/testing_pull_requests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,28 @@ Fetch the pull request by number
For the example, we will use `1901` for the example) and the pull request
branch that we will use is `feature-fix-numpy`, then you will use a variation
of the following git command:
`git fetch origin pull/<#>/head:<local_branch_name>`, eg.::
`git fetch origin pull/<#>/head:<local_branch_name>`, e.g.:

.. codeblock:: bash
.. code-block:: bash
git fetch upstream pull/1901/head:feature-fix-numpy
git fetch upstream pull/1901/head:feature-fix-numpy
.. note:: Notice that we fetch from `upstream`, since that is the original
project, where the pull request is supposed to be

.. tip:: The amount of work of some users maybe worth it to add his remote
to your fork's git configuration, to do so with the imaginary
github user `Obi-Wan Kenobi` which nickname is `obiwankenobi`, you
will do::
will do:

.. codeblock:: bash
.. code-block:: bash
git remote add obiwankenobi https://github.com/obiwankenobi/python-for-android.git
And to fetch the pull request branch that we put as example, you
would do::
would do:

.. codeblock:: bash
.. code-block:: bash
git fetch obiwankenobi
git checkout obiwankenobi/feature-fix-numpy
Expand All @@ -74,9 +74,9 @@ Clone the pull request branch from the user's fork
--------------------------------------------------
Sometimes you may prefer to use directly the fork of the user, so you will get
the nickname of the user who created the pull request, let's take the same
imaginary user than before `obiwankenobi`::
imaginary user than before `obiwankenobi`:

.. codeblock:: bash
.. code-block:: bash
git clone -b feature-fix-numpy \
--single-branch \
Expand All @@ -103,25 +103,25 @@ Using python-for-android commands directly from the pull request files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Enter inside the directory of the cloned repository in the above
step and run p4a command with proper args, eg (to test an modified
`pycryptodome` recipe)::

.. codeblock:: bash

cd p4a-feature-fix-numpy
PYTHONPATH=. python3 -m pythonforandroid.toolchain apk \
--private=testapps/on_device_unit_tests/test_app \
--dist-name=dist_unit_tests_app_pycryptodome \
--package=org.kivy \
--name=unit_tests_app_pycryptodome \
--version=0.1 \
--requirements=sdl2,pyjnius,kivy,python3,pycryptodome \
--ndk-dir=/media/DEVEL/Android/android-ndk-r20 \
--sdk-dir=/media/DEVEL/Android/android-sdk-linux \
--android-api=27 \
--arch=arm64-v8a \
--permission=VIBRATE \
--debug
step and run p4a command with proper args, e.g. (to test an modified
`pycryptodome` recipe)

.. code-block:: bash
cd p4a-feature-fix-numpy
PYTHONPATH=. python3 -m pythonforandroid.toolchain apk \
--private=testapps/on_device_unit_tests/test_app \
--dist-name=dist_unit_tests_app_pycryptodome \
--package=org.kivy \
--name=unit_tests_app_pycryptodome \
--version=0.1 \
--requirements=sdl2,pyjnius,kivy,python3,pycryptodome \
--ndk-dir=/media/DEVEL/Android/android-ndk-r20 \
--sdk-dir=/media/DEVEL/Android/android-sdk-linux \
--android-api=27 \
--arch=arm64-v8a \
--permission=VIBRATE \
--debug
Things that you should know:

Expand Down Expand Up @@ -153,31 +153,31 @@ Installing python-for-android using the github's branch of the pull request
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Enter inside the directory of the cloned repository mentioned in
`Common steps` and install it via pip, eg.::
`Common steps` and install it via pip, e.g.:

.. codeblock:: bash
.. code-block:: bash
cd p4a-feature-fix-numpy
pip3 install . --upgrade --user
cd p4a-feature-fix-numpy
pip3 install . --upgrade --user
- Now, go inside the `testapps/on_device_unit_tests` directory (we assume that
you still are inside the cloned repository)::
you still are inside the cloned repository)

.. codeblock:: bash
.. code-block:: bash
cd testapps/on_device_unit_tests
cd testapps/on_device_unit_tests
- Run the build of the apk via the freshly installed copy of python-for-android
by running a similar command than below::
by running a similar command than below

.. code-block:: bash
.. code-block:: bash
python3 setup.py apk \
--ndk-dir=/media/DEVEL/Android/android-ndk-r20 \
--sdk-dir=/media/DEVEL/Android/android-sdk-linux \
--android-api=27 \
--arch=arm64-v8a \
--debug
python3 setup.py apk \
--ndk-dir=/media/DEVEL/Android/android-ndk-r20 \
--sdk-dir=/media/DEVEL/Android/android-sdk-linux \
--android-api=27 \
--arch=arm64-v8a \
--debug
Things that you should know:
Expand Down Expand Up @@ -207,7 +207,7 @@ Using buildozer with a custom app

p4a.source_dir = /home/user/p4a_pull_requests/p4a-feature-fix-numpy

- Run you buildozer command as usual, eg.::
- Run you buildozer command as usual, e.g.::

buildozer android debug p4a --dist-name=dist-test-feature-fix-numpy

Expand All @@ -223,4 +223,4 @@ Using buildozer with a custom app
.. tip:: this method it's useful for developing pull requests since you can
edit `p4a.source_dir` to point to your python-for-android fork and you
can test any branch you want only switching branches with:
`git checkout <branch-name>` from inside your python-for-android fork
`git checkout <branch-name>` from inside your python-for-android fork
2 changes: 1 addition & 1 deletion pythonforandroid/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2019.10.06.post0'
__version__ = '2020.03.30'
Loading

0 comments on commit 85f7789

Please sign in to comment.