craft_parts.packages package

Submodules

Module contents

Operations with platform-specific package repositories.

craft_parts.packages.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

But if the prefix begins with pcfiledir variable, it must be kept as-is, because that variable refers to the current location of the .pc file. It allows to create “relocatable” pkgconfig files, so no changes are required.

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

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

  • prefix_trim (Path | None) – directory to remove from prefix

Return type:

None