Restore filetype dep, fix Settings label wrapping to 1px column

python_depends was emptied too aggressively in an earlier fix (dodging
the requests/charset-normalizer Android-wheel bug) and took filetype
with it — kivy/core/image imports it directly, causing a startup crash.
Restored just filetype (pure Python, no dependency chain, safe).

Settings popup's info label set text_size=(self.width, None) at
__init__ time, before layout ever runs — self was the Popup at its
default ~100px pre-layout width, not its real on-screen size, so the
label rendered as a 1-character-wide column. Now binds text_size to
the label's own width so it updates once real layout happens.
This commit is contained in:
AI_Assistant 2026-08-22 12:07:30 +00:00
commit d276f8842f
No known key found for this signature in database
3 changed files with 35 additions and 18 deletions

View file

@ -10,14 +10,17 @@ version = 0.1
requirements = python3,kivy
# Upstream p4a's kivy recipe declares python_depends on requests/certifi/
# chardet/idna/urllib3/filetype — kivy.network.UrlRequest extras we never
# call. p4a-recipes/kivy is a copy of that recipe with python_depends
# emptied out. It's not just cleanup: requests pulls in charset-normalizer,
# whose newest release ships an Android-tagged wheel; p4a's dependency
# resolver pins that exact wheel into requirements.txt, then installs it
# with a plain host pip that has no idea it's an Android wheel, and the
# build dies on "not a supported wheel on this platform". Dropping the
# unused chain avoids the bug entirely instead of chasing version pins.
# chardet/idna/urllib3/filetype — mostly kivy.network.UrlRequest extras we
# never call, EXCEPT filetype, which kivy/core/image imports directly for
# real (confirmed by a startup crash when it was dropped too). p4a-recipes/
# kivy is a copy of that recipe keeping only filetype. It's not just
# cleanup: requests pulls in charset-normalizer, whose newest release
# ships an Android-tagged wheel; p4a's dependency resolver pins that exact
# wheel into requirements.txt, then installs it with a plain host pip that
# has no idea it's an Android wheel, and the build dies on "not a
# supported wheel on this platform". Dropping the unused requests chain
# avoids the bug entirely instead of chasing version pins — filetype has
# no such transitive dependency and installs cleanly on its own.
p4a.local_recipes = p4a-recipes
orientation = portrait

View file

@ -140,12 +140,19 @@ class SettingsPopup(Popup):
self.on_save = on_save
box = BoxLayout(orientation="vertical", spacing=10, padding=10)
box.add_widget(Label(
info_label = Label(
text="Path to the synced event_log.csv on this device "
"(check your sync app's configured destination folder):",
size_hint_y=None, height=80, halign="left", valign="top",
text_size=(self.width, None),
))
)
# text_size can't just be set once here: at __init__ time this Popup
# hasn't been laid out yet, so self.width is Kivy's default ~100px
# widget width, not the popup's real on-screen size — that's what
# was squeezing this label into a thin vertical column. Binding to
# the label's own `width` keeps text_size in sync as the box (and
# therefore this label, which fills it) actually gets sized.
info_label.bind(width=lambda inst, w: setattr(inst, "text_size", (w, None)))
box.add_widget(info_label)
self.path_input = TextInput(text=current_path, multiline=False, size_hint_y=None, height=48)
box.add_widget(self.path_input)

View file

@ -1,10 +1,17 @@
# Local override of p4a's built-in kivy recipe — identical except
# python_depends is emptied. See buildozer.spec for why: upstream's
# ['certifi', 'chardet', 'idna', 'requests', 'urllib3', 'filetype'] pulls
# in requests -> charset-normalizer, whose newest release ships an
# Android-tagged wheel that p4a's own install step can't actually install
# (see comment in buildozer.spec). We never call kivy.network.UrlRequest,
# so dropping the whole chain is correct, not just a workaround.
# python_depends is trimmed. See buildozer.spec for the full story:
# upstream's ['certifi', 'chardet', 'idna', 'requests', 'urllib3',
# 'filetype'] pulls in requests -> charset-normalizer, whose newest
# release ships an Android-tagged wheel that p4a's own install step
# can't actually install.
#
# 'filetype' is kept — it's NOT part of that broken chain (zero deps of
# its own, no requests/charset-normalizer involved) and it's a genuine
# runtime dependency: kivy/core/image/__init__.py imports it directly
# for image format sniffing, unlike the other five which are only for
# kivy.network.UrlRequest (which this app never calls). Confirmed the
# hard way — dropping it too caused a startup crash on-device:
# ModuleNotFoundError: No module named 'filetype'
from os.path import join
import sys
import packaging.version
@ -41,7 +48,7 @@ class KivyRecipe(PyProjectRecipe):
name = 'kivy'
depends = [('sdl2', 'sdl3'), 'pyjnius', 'setuptools', 'android']
python_depends = [] # upstream: ['certifi', 'chardet', 'idna', 'requests', 'urllib3', 'filetype'] — unused, see buildozer.spec
python_depends = ['filetype'] # upstream also had: 'certifi', 'chardet', 'idna', 'requests', 'urllib3' — unused, see buildozer.spec
hostpython_prerequisites = ["cython>=0.29.1,<=3.0.12"]
# sdl-gl-swapwindow-nogil.patch is needed to avoid a deadlock.