Skip to content

Commit 19bf41a

Browse files
authored
Merge branch 'kivy:develop' into firebase
2 parents 73457b8 + 182bec5 commit 19bf41a

File tree

10 files changed

+65
-11
lines changed

10 files changed

+65
-11
lines changed

.github/workflows/docker.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Docker
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- develop
8+
pull_request:
9+
10+
jobs:
11+
docker:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: docker/setup-buildx-action@v3
16+
- run: make docker/build
17+
env:
18+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
19+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
20+
- name: docker push
21+
if: github.ref == 'develop'
22+
run: |
23+
make docker/login
24+
make docker/push

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ docker/pull:
117117
docker/build:
118118
docker build --cache-from=$(DOCKER_IMAGE) --tag=$(DOCKER_IMAGE) .
119119

120+
docker/login:
121+
@echo $(DOCKERHUB_TOKEN) | docker login --username $(DOCKERHUB_USERNAME) --password-stdin
122+
120123
docker/push:
121124
docker push $(DOCKER_IMAGE)
122125

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ python-for-android is not limited to being used with Buildozer.
4747

4848
[![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)
4949
[![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)
50+
[![Docker](https://github.com/kivy/python-for-android/actions/workflows/docker.yml/badge.svg)](https://github.com/kivy/python-for-android/actions/workflows/docker.yml)
5051

5152
## Documentation
5253

ci/rebuild_updated_recipes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def modified_recipes(branch='origin/develop'):
3939
# using the contrib version on purpose rather than sh.git, since it comes
4040
# with a bunch of fixes, e.g. disabled TTY, see:
4141
# https://stackoverflow.com/a/20128598/185510
42-
git_diff = sh.contrib.git.diff('--name-only', branch)
42+
git_diff = sh.contrib.git.diff('--name-only', branch).split("\n")
4343
recipes = set()
4444
for file_path in git_diff:
4545
if 'pythonforandroid/recipes/' in file_path:

pythonforandroid/build.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
def get_targets(sdk_dir):
3030
if exists(join(sdk_dir, 'cmdline-tools', 'latest', 'bin', 'avdmanager')):
3131
avdmanager = sh.Command(join(sdk_dir, 'cmdline-tools', 'latest', 'bin', 'avdmanager'))
32-
targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n')
32+
targets = avdmanager('list', 'target').split('\n')
3333

3434
elif exists(join(sdk_dir, 'tools', 'bin', 'avdmanager')):
3535
avdmanager = sh.Command(join(sdk_dir, 'tools', 'bin', 'avdmanager'))
36-
targets = avdmanager('list', 'target').stdout.decode('utf-8').split('\n')
36+
targets = avdmanager('list', 'target').split('\n')
3737
elif exists(join(sdk_dir, 'tools', 'android')):
3838
android = sh.Command(join(sdk_dir, 'tools', 'android'))
39-
targets = android('list').stdout.decode('utf-8').split('\n')
39+
targets = android('list').split('\n')
4040
else:
4141
raise BuildInterruptingException(
4242
'Could not find `android` or `sdkmanager` binaries in Android SDK',

pythonforandroid/recipe.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
from urllib.request import urlretrieve
1313
from os import listdir, unlink, environ, curdir, walk
1414
from sys import stdout
15-
from wheel.wheelfile import WheelFile
16-
from wheel.cli.tags import tags as wheel_tags
1715
import time
1816
try:
1917
from urlparse import urlparse
@@ -26,7 +24,7 @@
2624
logger, info, warning, debug, shprint, info_main, error)
2725
from pythonforandroid.util import (
2826
current_directory, ensure_dir, BuildInterruptingException, rmdir, move,
29-
touch)
27+
touch, patch_wheel_setuptools_logging)
3028
from pythonforandroid.util import load_source as import_recipe
3129

3230

@@ -469,8 +467,7 @@ def unpack(self, arch):
469467
elif extraction_filename.endswith(
470468
('.tar.gz', '.tgz', '.tar.bz2', '.tbz2', '.tar.xz', '.txz')):
471469
sh.tar('xf', extraction_filename)
472-
root_directory = sh.tar('tf', extraction_filename).stdout.decode(
473-
'utf-8').split('\n')[0].split('/')[0]
470+
root_directory = sh.tar('tf', extraction_filename).split('\n')[0].split('/')[0]
474471
if root_directory != basename(directory_name):
475472
move(root_directory, directory_name)
476473
else:
@@ -1205,6 +1202,9 @@ def get_wheel_platform_tag(self, arch):
12051202
}[arch.arch]
12061203

12071204
def install_wheel(self, arch, built_wheels):
1205+
with patch_wheel_setuptools_logging():
1206+
from wheel.cli.tags import tags as wheel_tags
1207+
from wheel.wheelfile import WheelFile
12081208
_wheel = built_wheels[0]
12091209
built_wheel_dir = dirname(_wheel)
12101210
# Fix wheel platform tag

pythonforandroid/recipes/python3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def build_arch(self, arch):
320320

321321
android_build = sh.Command(
322322
join(recipe_build_dir,
323-
'config.guess'))().stdout.strip().decode('utf-8')
323+
'config.guess'))().strip()
324324

325325
with current_directory(build_dir):
326326
if not exists('config.status'):
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from pythonforandroid.recipe import RustCompiledComponentsRecipe
2+
3+
4+
class TiktokenRecipe(RustCompiledComponentsRecipe):
5+
name = 'tiktoken'
6+
version = '0.7.0'
7+
url = 'https://github.com/openai/tiktoken/archive/refs/tags/{version}.tar.gz'
8+
sha512sum = "bb2d8fd5acd660d60e690769e46cf29b06361343ea30e35613d27d55f44acf9834e51aef28f4ff316ef66f2130042079718cea04b2353301aef334cd7bd6d221"
9+
depends = ['regex', 'requests']
10+
11+
12+
recipe = TiktokenRecipe()

pythonforandroid/util.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import contextlib
2+
from unittest import mock
23
from fnmatch import fnmatch
34
import logging
45
from os.path import exists, join
@@ -163,3 +164,16 @@ def max_build_tool_version(
163164
"""
164165

165166
return max(build_tools_versions, key=build_tools_version_sort_key)
167+
168+
169+
def patch_wheel_setuptools_logging():
170+
"""
171+
When setuptools is not present and the root logger has no handlers,
172+
Wheels would configure the root logger with DEBUG level, refs:
173+
- https://github.com/pypa/wheel/blob/0.44.0/src/wheel/util.py
174+
- https://github.com/pypa/wheel/blob/0.44.0/src/wheel/_setuptools_logging.py
175+
176+
Both of these conditions are met in our CI, leading to very verbose
177+
and unreadable `sh` logs. Patching it prevents that.
178+
"""
179+
return mock.patch("wheel._setuptools_logging.configure")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# https://github.com/kivy/buildozer/issues/722
2222
install_reqs = [
2323
'appdirs', 'colorama>=0.3.3', 'jinja2',
24-
'sh>=1.10, <2.0; sys_platform!="win32"',
24+
'sh>=2, <3.0; sys_platform!="win32"',
2525
'build', 'toml', 'packaging', 'setuptools', 'wheel~=0.43.0'
2626
]
2727
# (build and toml are used by pythonpackage.py)

0 commit comments

Comments
 (0)