kivy / buildozer

Generic Python packager for Android and iOS
https://buildozer.readthedocs.io
MIT License
1.74k stars 502 forks source link

local_recipes is not passed to `p4a` command #1366

Open dlech opened 3 years ago

dlech commented 3 years ago

Versions

Description

I'm trying to clean a local recipe to rebuild it without rebuilding everything else. I would expect the following command to work:

buildozer.spec

Command:

buildozer android p4a -- clean-recipe-build bleak

Spec file:

...
# (str) The directory in which python-for-android should look for your own build recipes (if any)
#p4a.local_recipes = recipes
p4a.local_recipes = ../../bleak/backends/p4android/recipes
...

Logs

...
ValueError: Recipe does not exist: bleak
# Command failed: /home/david/work/pybricks/bleak/.venv/bin/python -m pythonforandroid.toolchain clean-recipe-build bleak --color=always --storage-dir="/home/david/work/pybricks/bleak/examples/kivy/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21
...
dlech commented 3 years ago

To make it work, I have to run:

buildozer android p4a -- clean-recipe-build bleak --local-recipes=../../../../../../bleak/backends/p4android/recipes

It is inconvenient to have to add the extra argument and to remember to add ../../../../ to the path given in the spec file. It would be much nicer if the argument from the spec file was passed to this p4a command like it is to other commands.

leycec commented 2 years ago

So much, "Ugh!" Ironically, I just hit this exact same issue while also attempting (but failing) to force Buildozer to acknowledge the exact same Bleak recipe. Incidentally, let's note that @dlech is the active maintainer for Bleak. Mad props, @dlech.

I can also confirm that this...

It would be much nicer if the argument from the spec file was passed to this p4a command like it is to other commands.

...doesn't actually appear to be the case. The buildozer android p4a command always unconditionally ignores the p4a.local_recipes setting in the top-level buildozer.spec file. This applies to not merely the clean-recipe-build subcommand but to all the other subcommands as well (e.g., buildozer android p4a -- recipes).

This is probably thanks to the extreme caching performed by both Buildozer and p4a. The buildozer android p4a command probably reuses a previously synthesized dist, build, or bootstrap rather than re-reading the top-level buildozer.spec file. Since internal and external documentation is scant on the subject, we're just left with bad assumptions. :face_exhaling: