Skip to main content

aosp

Python wrapper around an AOSP (Android Open Source Project) source tree. Sources build/envsetup.sh, runs lunch, exposes the resulting build environment as a Python object, and provides convenience accessors for the product-out tree.

Requires sh and yautil (uses docker_sh for sandboxed builds).

Install

pip install -e .

Python ≥ 3.9.

API

from aosp import Aosp, load_aosp, get_env

Aosp

Main object representing one AOSP checkout + build target.

aosp = Aosp(path="/path/to/aosp", build_target="aosp_arm64-eng")
# or
aosp = Aosp.from_path("/path/to/aosp", build_target="aosp_arm64-eng")

Notable properties:

Member Description
path Absolute path to the AOSP root.
build_target The lunch target.
env dict of env vars exported by envsetup.sh + lunch.
build_var dict of build variables from get_build_var.
out AospProductOut — wrapper around $ANDROID_PRODUCT_OUT.
external_paths Extra PATH entries injected when running commands inside the tree.

AospProductOut

Returned by Aosp.out. Helpers for locating files under $ANDROID_PRODUCT_OUT:

Member Returns
dir Absolute path of the product-out directory.
system_dir system/ partition root.
system_lib_dirs All directories on the target's LD_LIBRARY_PATH.
system_bin_dirs All directories on the target's PATH.
rc_path Path to the target's init *.rc.
find_system_lib(basename) List of matching library files across system_lib_dirs.
find_system_bin(basename) List of matching binaries across system_bin_dirs.

load_aosp(...)

Module-level factory (see aosp.aosp.load_aosp) that constructs an Aosp from a config profile.

get_env(path, target=None) -> dict

Lower-level helper: sources build/envsetup.sh in path (and optionally runs lunch <target>), then returns the resulting environment as a dict.

env = get_env("/path/to/aosp", "aosp_arm64-eng")
print(env["ANDROID_PRODUCT_OUT"])

Release files for aosp 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aosp 0.1.2
File Size Uploaded
aosp-0.1.2.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aosp 0.1.2
File Interpreter ABI Platform
aosp-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size:13.9 kB

Release files / aosp-0.1.2.tar.gz

Download URL aosp-0.1.2.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
37fdb56926fedf0ef971ba6c745aa5dec25fa8a6382e6489e713395f30134b12
BLAKE2b-256 checksum
How to use checksums
b3780fae867f47eccfb7bb0731e70e643f9e647301cc43a71c2624778fffdb08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / aosp-0.1.2-py3-none-any.whl

Download URL aosp-0.1.2-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10aa93b9819b157ce2902303a8f66f1e8bdf36a5ce523b1303cf8799df938b7b
BLAKE2b-256 checksum
How to use checksums
d5c41e30689ef7cf79f42b4f089093fdbe65b114a706768eb2580b954d85d290
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page