Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
fail-fast: true
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
python-version: '3.9'
toxenv: py39
- os: ubuntu-22.04
Expand All @@ -41,6 +41,15 @@ jobs:
- os: ubuntu-24.04
python-version: '3.12'
toxenv: py312
- os: ubuntu-24.04
python-version: '3.13'
toxenv: py313
- os: ubuntu-24.04
python-version: '3.13'
toxenv: py313
- os: ubuntu-24.04
python-version: '3.14'
toxenv: py314

env:
TOXENV: ${{ matrix.toxenv }}
Expand All @@ -60,11 +69,11 @@ jobs:
- name: Install Python requirements
run: |
python -m pip install --upgrade pip
pip install tox
- name: Install pkgconfig
run: pip install -ve .
python -m pip install poetry
poetry --version
poetry install
- name: run tox env
run: tox --skip-missing-interpreters
run: poetry run tox -c pyproject.toml --skip-missing-interpreters

macOS:

Expand Down Expand Up @@ -94,8 +103,8 @@ jobs:
- name: Install Python requirements
run: |
python -m pip install --upgrade pip
pip install tox
- name: Install pkgconfig
run: pip install -ve .
python -m pip install poetry
poetry --version
poetry install
- name: run tox env
run: tox --skip-missing-interpreters
run: poetry run tox -c pyproject.toml --skip-missing-interpreters
34 changes: 17 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pkgconfig
:target: https://github.com/matze/pkgconfig/actions/workflows/ci.yml

``pkgconfig`` is a Python module to interface with the ``pkg-config``
command line tool for Python 3.9+.
command-line tool for Python 3.9+.

It can be used to

Expand Down Expand Up @@ -53,31 +53,31 @@ It can be used to
>>> # sets extension attributes as needed
>>> pkgconfig.configure_extension(ext, 'glib-2.0 gtk+-2.0')

The ``pkgconfig.parse`` function returns a dictonary of lists.
The ``pkgconfig.parse`` function returns a dictionary of lists.
The lists returned are accurate representations of the equivalent
``pkg-config`` call's result, both in content and order.
``pkg-config`` call's results, both in content and order.

If ``pkg-config`` is not on the path, raises ``EnvironmentError``.
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
~~~~~~~~~~~~~
Version 1.6.0 (not released yet)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- Drop support for Python < 3.9, support 3.9, 3.10, 3.11, 3.12.
- Switch CI from travis to github actions, test on all supported Python versions.
- Drop support for Python < 3.9, support 3.9 .. 3.14.
- 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 by setuptools to make tests work on py312, fixes #64.
- 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
- Make tests more robust by sorting.

Version 1.5.4
~~~~~~~~~~~~~
Expand All @@ -92,7 +92,7 @@ Version 1.5.3
Version 1.5.2
~~~~~~~~~~~~~

- Update poetry dep
- Update poetry dependency
- Improve CI

Version 1.5.0
Expand Down Expand Up @@ -125,7 +125,7 @@ Version 1.3.0
Version 1.2.1 and 1.2.2
~~~~~~~~~~~~~~~~~~~~~~~

Bug fix releases released on December 1st and 2nd 2016.
Bugfix releases on December 1 and 2, 2016.

- Include the ``data`` folder in the distribution in order to run tests
- Improve the tests
Expand All @@ -134,22 +134,22 @@ Bug fix releases released on December 1st and 2nd 2016.
Version 1.2.0
~~~~~~~~~~~~~

Released on November 30th 2016.
Released on November 30th, 2016.

- Potential break: switch from result set to list
- Expose --list-all query
- Added support for PKG_CONFIG environment variable
- Expose the --list-all query
- Added support for the PKG_CONFIG environment variable


Version 1.1.0
~~~~~~~~~~~~~

Released on November 6th 2013.
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.
First release on September 8th, 2013.
21 changes: 19 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,22 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.9.0"

[tool.poetry.dev-dependencies]
pytest = "^3.8.2"
[tool.poetry.group.dev.dependencies]
pytest = "^8.4.2"
tox = "^4.29.0"

[tool.tox]
legacy_tox_ini = """
[tox]
# test on all supported Python versions, see also:
# - pyproject.toml: tool.poetry.dependencies
# - .github/workflows/ci.yml
# - README.rst
envlist = py{39,310,311,312,313,314}

[testenv]
deps =
pytest
setuptools
commands= pytest -v -rs
"""
24 changes: 12 additions & 12 deletions src/pkgconfig/pkgconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""pkgconfig is a Python module to interface with the pkg-config command line
"""pkgconfig is a Python module to interface with the pkg-config command-line
tool."""

import os
Expand Down Expand Up @@ -118,7 +118,7 @@ def exists(package):
"""
Return True if package information is available.

If ``pkg-config`` not on path, raises ``EnvironmentError``.
If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
"""
pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
cmd = '{0} --exists {1}'.format(pkg_config_exe, package).split()
Expand All @@ -128,9 +128,9 @@ def exists(package):
@_convert_error
def requires(package):
"""
Return a list of package names that is required by the package.
Return a list of package names that are required by the package.

If ``pkg-config`` not on path, raises ``EnvironmentError``.
If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
"""
return _query(package, '--print-requires').split('\n')

Expand All @@ -139,7 +139,7 @@ def cflags(package):
"""
Return the CFLAGS string returned by pkg-config.

If ``pkg-config`` is not on path, raises ``EnvironmentError``.
If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
"""
_raise_if_not_exists(package)
return _query(package, '--cflags')
Expand All @@ -149,7 +149,7 @@ def modversion(package):
"""
Return the version returned by pkg-config.

If `pkg-config` is not in the path, raises ``EnvironmentError``.
If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
"""
_raise_if_not_exists(package)
return _query(package, '--modversion')
Expand All @@ -169,7 +169,7 @@ def libs(package, static=False):
def variables(package):
"""
Return a dictionary of all the variables defined in the .pc pkg-config file
of 'package'.
of the package.
"""
_raise_if_not_exists(package)
result = _query(package, '--print-variables')
Expand All @@ -182,8 +182,8 @@ def installed(package, version):
Check if the package meets the required version.

The version specifier consists of an optional comparator (one of =, ==, >,
<, >=, <=) and an arbitrarily long version number separated by dots. The
should be as you would expect, e.g. for an installed version '0.1.2' of
<, >=, <=) and an arbitrarily long version number separated by dots. The comparisons
behave as you would expect. For example, for an installed version '0.1.2' of
package 'foo':

>>> installed('foo', '==0.1.2')
Expand All @@ -193,7 +193,7 @@ def installed(package, version):
>>> installed('foo', '>= 0.0.4')
True

If ``pkg-config`` not on path, raises ``EnvironmentError``.
If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
"""
if not exists(package):
return False
Expand Down Expand Up @@ -237,12 +237,12 @@ def parse(packages, static=False):

Builds a dictionary containing the 'libraries', the 'library_dirs', the
'include_dirs', and the 'define_macros' that are presented by pkg-config.
*package* is a string with space-delimited package names.
*packages* is a string with space-delimited package names.

The static specifier will also include libraries for static linking (i.e.,
includes any private libraries).

If ``pkg-config`` is not on path, raises ``EnvironmentError``.
If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
"""
for package in packages.split():
_raise_if_not_exists(package)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_pkgconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ def test_openssl(version, expected):
# PLEASE NOTE:
# sadly, when looking at all (esp. non-python) libraries out there, there
# is no agreement on the semantics of letters appended to version numbers.
# e.g. for a release candidate, some might use "c", but other also might
# use "rc" or whatever. stuff like openssl does not use the letters to
# e.g. for a release candidate, some might use "c", but others also might
# use "rc" or whatever. Software like OpenSSL does not use the letters to
# represent release status, but rather minor updates using a-z.
# so, as there is no real standard / agreement, we can NOT assume any
# advanced semantics here (like we could for python packages).
# thus we do NOT implement any special semantics for the letters,
# except string ordering
# thus, comparing a version with a letter-digits appendix to one without
# except string ordering.
# thus, comparing a version with a letterdigits suffix to one without
# may or may not give the desired result.
# e.g. python packages use a1 for alpha 1, b2 for beta 2, c3 for release
# candidate 3 and <nothing> for release.
# we do not implement this semantics, "1.2.3" > "1.2.3b1" does not work.
# we do not implement these semantics; "1.2.3" > "1.2.3b1" does not work.
])
def test_dld_pkg(version, expected):
assert pkgconfig.installed('fake-dld-pkg', version) == expected
Expand Down
12 changes: 0 additions & 12 deletions tox.ini

This file was deleted.

Loading