craft_parts.packages.normalize module

Definition and helpers for the repository base class.

craft_parts.packages.normalize.fix_pkg_config(prefix_prepend, pkg_config_file, prefix_trim=None)[source]

Fix the prefix parameter in pkg-config files.

This function does 3 things: 1. Remove prefix_trim from the prefix. 2. Remove directories commonly added by staged snaps from the prefix. 3. Prepend prefix_prepend to the prefix.

The prepended stage directory depends on the source of the pkg-config file: - From snaps built via launchpad: /build/<snap-name>/stage - From snaps built via a provider: /root/stage - From snaps built locally: <local-path-to-project>/stage - Built during the build stage: the install directory

  • pkg_config_file (Path) – pkg-config (.pc) file to modify

  • prefix_prepend (Path) – directory to prepend to the prefix

  • prefix_trim (Optional[Path]) – directory to remove from prefix

Return type:


craft_parts.packages.normalize.normalize(unpack_dir, *, repository)[source]

Normalize unpacked artifacts.

Repository-specific packages are generally created to live in a specific distro. Normalize scans through the unpacked artifacts and slightly modifies them to work better in the Craft Parts build environment.

  • unpack_dir (Path) – Directory containing unpacked files to normalize.

  • repository (Type[BaseRepository]) – The package format handler.

Return type: