Python bindings to libpkgconf
Project description
This project provides Python bindings to pkgconf.
Building pypkgconf
wheel
pip install build
python -m build
Building on Windows
On Windows, you want to link with the static
version of libpkgconf.
You also want to use release
buildtype.
pip install build
python -m build -Csetup-args="-Ddefault_library=static" -Csetup-args="-Dbuildtype=release"
Running tests
You need a recent version of meson
.
pip install pytest cffi
meson setup . build
meson test -C build
Using pypkgconf
The API is very close to the original C code.
cli-like API
This high-level API uses same arguments as the pkgconf
executable.
Results are returned as a list of string (the list may be empty).
Errors and warnings are logger using the standard Python logging module, under
the pkgconf
logger.
In case or error result, a pypkgconf.PkgConfError
exception is raised.
pypkgconf.query_args(command: str, env: dict[str, str] | None = None) -> list[str]
The command is just like the command line arguments (e.g.: "--libs foo"
)
If env
is provided, pkgconf will use it for any envvar it queries.
If env
is None
(default), os.environ
is used.
pypkgconf.query(args: list[str] | None, **kwargs) -> list[str]
Positional arguments are given as a list of strings.
Optional arguments are given either using an union of pypkgconf.Flags
,
or as keyword arguments, depending if it is a boolean value or not.
low-level API
The cffi interface to c function is provided through
pypkgconf._libpkgconf.lib
and pypkgconf._libpkgconf.ffi
.
Please refer to pkgconf code and to cffi documentation, or use the high-level interface as a reference on how to use it.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pypkgconf-0.1.2-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0327ea3b22bd0a78f6a31143b657c21ef17343d0e34afcc504f4f8ccddb6f3df |
|
MD5 | f5bdd31a4c69a593ed61eb33da724f98 |
|
BLAKE2b-256 | fd74aa58b9e3fd1dd584249b628e76f60249ea4749e4fbc5729bbf9496f4ac47 |