Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions buildozer/default.spec
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,24 @@ version = 0.1

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy
requirements = python3,kivy==2.3.1

# (list) Additional package index urls used for dependency resolution (currently Android only)
# These indexes are searched in addition to the default PyPI index during Android builds.
# WARNING: Third party indexes are untrusted sources and may introduce supply chain risks,
# including malicious, tampered, outdated, or incompatible packages.
extra_index_urls = https://chaquo.com/pypi-13.1/, https://anshdadwal.is-a.dev/p4a-wheels/p4a/

# (bool) Disable use of prebuilt binary packages when available (currently Android only)
# If enabled, all dependencies are built from source even if prebuilt wheels exist.
skip_prebuilt = False

# (list) Packages allowed to use available prebuilt wheels (currently Android only)
# Overrides recipe pinned versions and bypasses default version selection behavior
# when a compatible prebuilt wheel is available in the index.
# Example: if kivy==2.3.1 is requested but only `3.0.0` is available in prebuilt index,
# this option allows using the prebuilt wheel instead of building from source.
# use_prebuilt_version_for = numpy,kivy

# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
Expand Down Expand Up @@ -366,7 +383,8 @@ android.allow_backup = True
# (str) extra command line arguments to pass when invoking pythonforandroid.toolchain
#p4a.extra_args =


# (string) Directory where built wheel artifacts are stored (empty disables saving)
# p4a.save_wheel_dir =

#
# iOS specific
Expand Down
18 changes: 17 additions & 1 deletion buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def __init__(self, *args, **kwargs):
if port is not None:
self.extra_p4a_args.append(f"--port={port}")

setup_py = self.buildozer.config.getdefault('app', 'p4a.setup_py', False)
setup_py = self.buildozer.config.getbooldefault('app', 'p4a.setup_py', False)
if setup_py:
self.extra_p4a_args.append("--use-setup-py")
else:
Expand All @@ -123,6 +123,22 @@ def __init__(self, *args, **kwargs):
if self.logger.log_level >= 2:
self.extra_p4a_args.append("--debug")

save_wheel_dir = self.buildozer.config.getdefault('app', "p4a.save_wheel_dir", "")
if save_wheel_dir != "":
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!= "" is not needed. Just use if save_wheel_dir:

self.extra_p4a_args.append(f"--save-wheel-dir={save_wheel_dir}")

extra_index_urls = self.buildozer.config.getlist('app', "extra_index_urls", "")
for index in extra_index_urls:
self.extra_p4a_args.append(f"--extra-index-url={index}")

use_prebuilt_version_for = self.buildozer.config.getlist('app', "use_prebuilt_version_for", "")
for _recipes in use_prebuilt_version_for:
self.extra_p4a_args.append(f"--use-prebuilt-version-for={_recipes}")

skip_prebuilt = self.buildozer.config.getbooldefault('app', 'skip_prebuilt', False)
if skip_prebuilt:
self.extra_p4a_args.append("--skip-prebuilt")

user_extra_p4a_args = self.buildozer.config.getdefault('app', 'p4a.extra_args', "")
self.extra_p4a_args.extend(shlex.split(user_extra_p4a_args))

Expand Down
Loading