Skip to content

Commit 44f0c9f

Browse files
committed
Merge tag 'v2020.06.02'
🔖 v2020.06.02 * Adds missing requests sub dependencies (kivy#2221) * Bumps to Gradle 6.4.1 (kivy#2222) * Bumps to Cython==0.29.19 (kivy#2220) * Updates install and troubleshooting docs (kivy#2219) * Bumps to Ubuntu 20.04 (kivy#2218) * Attempt to improve the issue template (kivy#2217) * Add `opencv_extras` recipe (kivy#2209) * Split logic for build modes & debug symbols (kivy#2213) * Troubleshoot SSL error (kivy#2205) * Remove superfluous recipes fixes (kivy#2202) * Add tests for hostpython3 recipe (kivy#2196) * Fix for 'cannot find setuptools module' (kivy#2195) * Rename `Hostpython3Recipe` class to camel case (kivy#2194) * Fix `test_should_build` (kivy#2193) * Add initial tests for python3 recipe (kivy#2192) * PythonActivityUtil helper for unpacking data (kivy#2189) * Fixes flake8 errors post update (kivy#2191) * Share PythonUtil.java between bootstraps (kivy#2188) * Java code linting using PMD 6.23.0 (kivy#2187) * Deletes deprecated renpy Python{Activity,Service}.java (kivy#2186) * Removes java concurrency/ folder (kivy#2185) * Reuse common AssetExtract.java (kivy#2182) * Use common Hardware.java (kivy#2183) * Moves kamranzafar/ java directory to common/ (kivy#2184) * Updates release documentation (kivy#2177) * Fixes service only unittest loading (kivy#2181) * Narrows some context manager scopes (kivy#2179) * Downgrades to SDL2 2.0.9 (kivy#2180) * Bump to SDL2 2.0.10 & extract .java from SDL2 tarball (kivy#2113) * Adds pygame recipe (kivy#2164) * Adds macOS install instructions (2165) * Removed python2 support mention from README (kivy#2162) * Adding more assets (kivy#2132) * Get --add-source working for dirs in Gradle builds (kivy#2156) * Fixes python build with macOS venv (kivy#2159)
2 parents 274ef71 + 1b3b0e3 commit 44f0c9f

File tree

108 files changed

+794
-9191
lines changed

Some content is hidden

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

108 files changed

+794
-9191
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
<!--
2-
The issue tracker is a tool to address bugs.
3-
Please use the Disord community or Stack Overflow for support questions,
2+
The issue tracker is a tool to address bugs NOT a support platform.
3+
Please use the Discord community or Stack Overflow for support questions,
44
more information at https://github.com/kivy/python-for-android#support
5-
6-
Before opening a new issue, make sure you do the following:
7-
* check that your issue isn't already filed: https://github.com/kivy/python-for-android/issues
8-
* prepare a short, runnable example that reproduces the issue
9-
* make sure to have `log_level = 2` in your `buildozer.spec`
10-
* reproduce the problem with the latest development version (`p4a.branch = master`)
11-
* double-check that the issue is indeed a bug and not a support request
12-
* please use backticks to format code or logs
135
-->
146

7+
### Checklist
8+
9+
- [ ] the issue is indeed a bug and not a support request
10+
- [ ] issue doesn't already exist: https://github.com/kivy/python-for-android/issues
11+
- [ ] I have a short, runnable example that reproduces the issue
12+
- [ ] I reproduced the problem with the latest development version (`p4a.branch = develop`)
13+
- [ ] I used the grave accent (aka backticks) to format code or logs when appropriated
14+
1515
### Versions
1616

17-
* Python:
18-
* OS:
19-
* Kivy:
20-
* Cython:
17+
- Python:
18+
- OS:
19+
- Kivy:
20+
- Cython:
21+
- OpenJDK:
2122

2223
### Description
2324

@@ -28,6 +29,7 @@ Before opening a new issue, make sure you do the following:
2829
Command:
2930
```sh
3031
// REPLACE ME: buildozer command ran? e.g. buildozer android debug
32+
// Keep the triple grave accent (aka backquote/backtick) to have the code formatted
3133
```
3234

3335
Spec file:
@@ -38,5 +40,6 @@ Spec file:
3840
### Logs
3941

4042
```
41-
// REPLACE ME: Paste the build ouput containing the error
43+
// REPLACE ME: Paste the build output containing the error
44+
// Keep the triple grave accent (a.k.a. backquote/backtick) to have the code formatted
4245
```

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@
1515
# Use 'docker run' without '--rm' flag for keeping the container and use
1616
# 'docker commit <container hash> <new image>' to extend the original image
1717

18-
FROM ubuntu:18.04
18+
FROM ubuntu:20.04
1919

2020
# configure locale
21-
RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \
21+
RUN apt -y update -qq > /dev/null \
22+
&& DEBIAN_FRONTEND=noninteractive apt install -qq --yes --no-install-recommends \
2223
locales && \
2324
locale-gen en_US.UTF-8
2425
ENV LANG="en_US.UTF-8" \
2526
LANGUAGE="en_US.UTF-8" \
2627
LC_ALL="en_US.UTF-8"
2728

28-
RUN apt -y update -qq > /dev/null && apt -y install -qq --no-install-recommends \
29+
RUN apt -y update -qq > /dev/null \
30+
&& DEBIAN_FRONTEND=noninteractive apt install -qq --yes --no-install-recommends \
2931
ca-certificates \
3032
curl \
3133
&& apt -y autoremove \
@@ -49,7 +51,7 @@ ENV WORK_DIR="${HOME_DIR}/app" \
4951
# install system dependencies
5052
RUN dpkg --add-architecture i386 \
5153
&& ${RETRY} apt -y update -qq > /dev/null \
52-
&& ${RETRY} apt -y install -qq --no-install-recommends \
54+
&& ${RETRY} DEBIAN_FRONTEND=noninteractive apt install -qq --yes --no-install-recommends \
5355
autoconf \
5456
automake \
5557
autopoint \
@@ -64,8 +66,6 @@ RUN dpkg --add-architecture i386 \
6466
libidn11:i386 \
6567
libltdl-dev \
6668
libncurses5:i386 \
67-
libpangox-1.0-0:i386 \
68-
libpangoxft-1.0-0:i386 \
6969
libssl-dev \
7070
libstdc++6:i386 \
7171
libtool \

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ all: virtualenv
2020

2121
$(VIRTUAL_ENV):
2222
python3 -m venv $(VIRTUAL_ENV)
23-
$(PIP) install Cython==0.28.6
23+
$(PIP) install Cython==0.29.19
2424
$(PIP) install -e .
2525

2626
virtualenv: $(VIRTUAL_ENV)
@@ -38,7 +38,7 @@ testapps-with-numpy/%: virtualenv
3838
$(eval $@_APP_ARCH := $(shell basename $*))
3939
. $(ACTIVATE) && cd testapps/on_device_unit_tests/ && \
4040
python setup.py apk --sdk-dir $(ANDROID_SDK_HOME) --ndk-dir $(ANDROID_NDK_HOME) \
41-
--requirements libffi,sdl2,pyjnius,kivy,python3,openssl,requests,sqlite3,setuptools,numpy \
41+
--requirements libffi,sdl2,pyjnius,kivy,python3,openssl,requests,urllib3,chardet,idna,sqlite3,setuptools,numpy \
4242
--arch=$($@_APP_ARCH)
4343

4444
testapps/%: virtualenv

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ dependencies you want, and bundle it in an APK along with your own code.
1313

1414
Features include:
1515

16-
- Support for building with both Python 2 and Python 3.
1716
- Different app backends including Kivy, PySDL2, and a WebView with
1817
Python webserver.
1918
- Automatic support for most pure Python modules, and built in support

ci/makefiles/osx.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ install_java:
1111
/usr/libexec/java_home -V
1212

1313
upgrade_cython:
14-
pip3 install --upgrade Cython==0.28.6
14+
pip3 install --upgrade Cython==0.29.19
1515

1616
install_android_ndk_sdk:
1717
mkdir -p $(ANDROID_HOME)

doc/source/contribute.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ At this point, wait for reviewer approval and conclude any discussion that arise
5555
- Merge the release branch to the ``master`` branch.
5656
- Also merge the release branch to the ``develop`` branch.
5757
- Tag the release commit in ``master``, with tag ``vYYYY.MM.DD``. Include a short summary of the changes.
58-
- Create the release distributions: ``python3 setup.py sdist bdist_wheel``
59-
- Upload the release to pypi: ``python3 -m twine upload``.
58+
- Release distributions and PyPI upload should be `handled by the CI
59+
<https://github.com/kivy/python-for-android/blob/v2020.04.29/.travis.yml#L60-L70>`_.
6060
- Add to the Github release page (see e.g. `this example <https://github.com/kivy/python-for-android/releases/tag/v2019.06.06>`__):
6161
- The python-for-android README summary
6262
- A short list of major changes in this release, if any
@@ -67,15 +67,18 @@ At this point, wait for reviewer approval and conclude any discussion that arise
6767

6868
Release checklist
6969
~~~~~~~~~~~~~~~~~
70-
71-
- [ ] Check that the [build is passing](https://travis-ci.org/kivy/python-for-android)
72-
- [ ] Run the tests locally via `tox`: this performs some long-running tests that are skipped on Travis.
73-
- [ ] Build and run the [on_device_unit_tests](https://github.com/kivy/python-for-android/tree/master/testapps/on_device_unit_tests) app using buildozer. Check that they all pass.
74-
- [ ] Build and run the following [testapps](https://github.com/kivy/python-for-android/tree/master/testapps) for arch `armeabi-v7a` and `arm64-v8a`:
75-
- `python3 setup_testapp_python3_sqlite_openssl.py apk`
76-
- [ ] `armeabi-v7a`
77-
- [ ] `arm64-v8a`
78-
- [ ] Check that the version number is correct
70+
::
71+
72+
- [ ] Check that the builds are passing
73+
- [ ] [Travis build](https://travis-ci.org/kivy/python-for-android)
74+
- [ ] [GitHub Action](https://github.com/kivy/python-for-android/actions)
75+
- [ ] Run the tests locally via `tox`: this performs some long-running tests that are skipped on Travis.
76+
- [ ] Build and run the [on_device_unit_tests](https://github.com/kivy/python-for-android/tree/master/testapps/on_device_unit_tests) app using buildozer. Check that they all pass.
77+
- [ ] Build (or download from github actions) and run the following [testapps](https://github.com/kivy/python-for-android/tree/master/testapps/on_device_unit_tests) for arch `armeabi-v7a` and `arm64-v8a`:
78+
- [ ] on_device_unit_tests
79+
- [ ] `armeabi-v7a` (`cd testapps/on_device_unit_tests && PYTHONPATH=.:../../ python3 setup.py apk --ndk-dir=<your-ndk-dir> --sdk-dir=<your-sdk-dir> --arch=armeabi-v7a --debug`)
80+
- [ ] `arm64-v8a` (`cd testapps/on_device_unit_tests && PYTHONPATH=.:../../ python3 setup.py apk --ndk-dir=<your-ndk-dir> --sdk-dir=<your-sdk-dir> --arch=arm64-v8a --debug`)
81+
- [ ] Check that the version number is correct
7982

8083

8184

doc/source/troubleshooting.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,20 @@ ModuleNotFoundError: No module named '_ctypes'
202202
You do not have the libffi headers available to python-for-android, so you need to install them. On Ubuntu and derivatives these come from the `libffi-dev` package.
203203

204204
After installing the headers, clean the build (`p4a clean builds`, or with buildozer delete the `.buildozer` directory within your app directory) and run python-for-android again.
205+
206+
SSLError("Can't connect to HTTPS URL because the SSL module is not available.")
207+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
208+
209+
Your `hostpython3` was compiled without SSL support. You need to install the SSL development files before rebuilding the `hostpython3` recipe.
210+
Remember to always clean the build before rebuilding (`p4a clean builds`, or with buildozer `buildozer android clean`).
211+
212+
On Ubuntu and derivatives::
213+
214+
apt install libssl-dev
215+
p4a clean builds # or with: buildozer `buildozer android clean
216+
217+
On macOS::
218+
219+
brew install openssl
220+
sudo ln -sfn /usr/local/opt/openssl /usr/local/ssl
221+
p4a clean builds # or with: buildozer `buildozer android clean

pythonforandroid/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '2020.03.30'
1+
__version__ = '2020.06.02'

pythonforandroid/archs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ def get_env(self, with_flags_in_cc=True):
145145
+ " ".join(
146146
[
147147
"-L'"
148-
+ l.replace("'", "'\"'\"'")
148+
+ link_path.replace("'", "'\"'\"'")
149149
+ "'" # no shlex.quote in py2
150-
for l in self.extra_global_link_paths
150+
for link_path in self.extra_global_link_paths
151151
]
152152
)
153153
+ ' ' + ' '.join(self.common_ldflags).format(

pythonforandroid/bootstrap.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ def get_build_dir(self):
132132
def get_dist_dir(self, name):
133133
return join(self.ctx.dist_dir, name)
134134

135-
def get_common_dir(self):
136-
return os.path.abspath(join(self.bootstrap_dir, "..", 'common'))
137-
138135
@property
139136
def name(self):
140137
modname = self.__class__.__module__
@@ -152,6 +149,23 @@ def get_bootstrap_dirs(self):
152149
]
153150
return bootstrap_dirs
154151

152+
def _copy_in_final_files(self):
153+
if self.name == "sdl2":
154+
# Get the paths for copying SDL2's java source code:
155+
sdl2_recipe = Recipe.get_recipe("sdl2", self.ctx)
156+
sdl2_build_dir = sdl2_recipe.get_jni_dir()
157+
src_dir = join(sdl2_build_dir, "SDL", "android-project",
158+
"app", "src", "main", "java",
159+
"org", "libsdl", "app")
160+
target_dir = join(self.dist_dir, 'src', 'main', 'java', 'org',
161+
'libsdl', 'app')
162+
163+
# Do actual copying:
164+
info('Copying in SDL2 .java files from: ' + str(src_dir))
165+
if not os.path.exists(target_dir):
166+
os.makedirs(target_dir)
167+
copy_files(src_dir, target_dir, override=True)
168+
155169
def prepare_build_dir(self):
156170
"""Ensure that a build dir exists for the recipe. This same single
157171
dir will be used for building all different archs."""
@@ -168,7 +182,12 @@ def prepare_build_dir(self):
168182
def prepare_dist_dir(self):
169183
ensure_dir(self.dist_dir)
170184

171-
def run_distribute(self):
185+
def assemble_distribution(self):
186+
''' Copies all the files into the distribution (this function is
187+
overridden by the specific bootstrap classes to do this)
188+
and add in the distribution info.
189+
'''
190+
self._copy_in_final_files()
172191
self.distribution.save_info(self.dist_dir)
173192

174193
@classmethod

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -530,24 +530,28 @@ def make_package(args):
530530
for patch_name in os.listdir(join('src', 'patches')):
531531
patch_path = join('src', 'patches', patch_name)
532532
print("Applying patch: " + str(patch_path))
533+
534+
# -N: insist this is FORWARD patch, don't reverse apply
535+
# -p1: strip first path component
536+
# -t: batch mode, don't ask questions
537+
patch_command = ["patch", "-N", "-p1", "-t", "-i", patch_path]
538+
533539
try:
534-
subprocess.check_output([
535-
# -N: insist this is FORWARd patch, don't reverse apply
536-
# -p1: strip first path component
537-
# -t: batch mode, don't ask questions
538-
"patch", "-N", "-p1", "-t", "-i", patch_path
539-
])
540+
# Use a dry run to establish whether the patch is already applied.
541+
# If we don't check this, the patch may be partially applied (which is bad!)
542+
subprocess.check_output(patch_command + ["--dry-run"])
540543
except subprocess.CalledProcessError as e:
541544
if e.returncode == 1:
542-
# Return code 1 means it didn't apply, this will
543-
# usually mean it is already applied.
544-
print("Warning: failed to apply patch (" +
545-
"exit code 1), " +
546-
"assuming it is already applied: " +
547-
str(patch_path)
548-
)
545+
# Return code 1 means not all hunks could be applied, this usually
546+
# means the patch is already applied.
547+
print("Warning: failed to apply patch (exit code 1), "
548+
"assuming it is already applied: ",
549+
str(patch_path))
549550
else:
550551
raise e
552+
else:
553+
# The dry run worked, so do the real thing
554+
subprocess.check_output(patch_command)
551555

552556

553557
def parse_args_and_make_package(args=None):
@@ -676,6 +680,9 @@ def parse_args_and_make_package(args=None):
676680
const='release', default='debug',
677681
help='Build your app as a non-debug release build. '
678682
'(Disables gdb debugging among other things)')
683+
ap.add_argument('--with-debug-symbols', dest='with_debug_symbols',
684+
action='store_const', const=True, default=False,
685+
help='Will keep debug symbols from `.so` files.')
679686
ap.add_argument('--add-jar', dest='add_jar', action='append',
680687
help=('Add a Java .jar to the libs, so you can access its '
681688
'classes with pyjnius. You can specify this '

pythonforandroid/bootstraps/common/build/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip

0 commit comments

Comments
 (0)