Interface Python with pkg-config
Project description
pkgconfig is a Python module to interface with the pkg-config command-line tool for Python 3.9+.
The pkg-config command-line tool typically comes from a package either called pkg-config (the original implementation) or pkgconf (a more recent, improved reimplementation intended as a drop-in replacement).
The pkgconfig module can be used to
find all pkg-config packages
>>> packages = pkgconfig.list_all()
check if a package exists
>>> pkgconfig.exists('glib-2.0') Truecheck if a package meets certain version requirements
>>> pkgconfig.installed('glib-2.0', '< 2.26') Falsereturn the version
>>> pkgconfig.modversion('glib-2.0') '2.56.3'query CFLAGS and LDFLAGS
>>> pkgconfig.cflags('glib-2.0') '-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include' >>> pkgconfig.libs('glib-2.0') '-lglib-2.0'get all variables defined for a package:
>>> pkgconfig.variables('glib-2.0') {u'exec_prefix': u'/usr'}parse the output to build extensions with setup.py
>>> d = pkgconfig.parse('glib-2.0 gtk+-2.0') >>> d['libraries'] [u'gtk+-2.0', u'glib-2.0']or
>>> ext = Extension('foo', ['foo.c']) >>> # sets extension attributes as needed >>> pkgconfig.configure_extension(ext, 'glib-2.0 gtk+-2.0')The pkgconfig.parse function returns a dictionary of lists. The lists returned are accurate representations of the equivalent pkg-config call’s results, both in content and order.
If pkg-config is not on the PATH, an EnvironmentError is raised.
The pkgconfig module is licensed under the MIT license.
Changelog
Version 1.6.0
Drop support for Python < 3.9, support 3.9 .. 3.14.
README: clarify pkg-config and pkgconf, #75
Switch CI from Travis to GitHub Actions; test on all supported Python versions.
Use src/ layout for project, fixes #36. Also move tests and test data to tests/.
Replace deprecated distutils with setuptools to make tests work on Python 3.12; fixes #64.
Fix configure_extension for empty cflags or libs.
Version 1.5.5
Make tests more robust by sorting.
Version 1.5.4
Adjust pyproject.toml and drop Python 2 support
Version 1.5.3
Add configure_extension API
Version 1.5.2
Update poetry dependency
Improve CI
Version 1.5.0
Use poetry instead of setuptools directly
Fix #42: raise exception if package is missing
Fix version parsing for openssl-like version numbers, fixes #32
Fix #31: expose –modversion
Fix #30: strip whitespace from variable names
Version 1.4.0
Add boolean static keyword to output private libraries as well
Raise original OSError as well
Version 1.3.1
Fix compatibility problems with Python 2.6
Version 1.3.0
Add variables() API to query defined variables
Disable Python 3.2 and enable Python 3.5 and 3.6 tests
Fix #16: handle spaces of values in .pc files correctly
Version 1.2.1 and 1.2.2
Bugfix releases on December 1 and 2, 2016.
Include the data folder in the distribution in order to run tests
Improve the tests
Version 1.2.0
Released on November 30th, 2016.
Potential break: switch from result set to list
Expose the –list-all query
Added support for the PKG_CONFIG environment variable
Version 1.1.0
Released on November 6th, 2013.
Multiple packages can now be parsed with a single call to .parse.
Version 1.0.0
First release on September 8th, 2013.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pkgconfig-1.6.0.tar.gz.
File metadata
- Download URL: pkgconfig-1.6.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a5a6631ce937fafac457104a40d558785a658bbdca5c49b6295bc3fd651907f
|
|
| MD5 |
fe94675a8b78717922de3e7694ee0643
|
|
| BLAKE2b-256 |
52fd0adde075cd3bfecd557bc7d757e00e231d34d8a6edb4c8d1642759254c21
|
File details
Details for the file pkgconfig-1.6.0-py3-none-any.whl.
File metadata
- Download URL: pkgconfig-1.6.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98e71754855e9563838d952a160eb577edabb57782e49853edb5381927e6bea1
|
|
| MD5 |
31716110434ddc3519291b8364a43d36
|
|
| BLAKE2b-256 |
756ff7ec07fba48f07c555cc4099481df644fbbc12067879072c17ac229f6556
|