Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pkgconfig for
openSUSE:Factory checked in at 2026-04-11 22:22:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pkgconfig (Old)
and /work/SRC/openSUSE:Factory/.python-pkgconfig.new.21863 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pkgconfig"
Sat Apr 11 22:22:57 2026 rev:13 rq:1345806 version:1.6.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pkgconfig/python-pkgconfig.changes
2025-06-04 20:27:09.605519442 +0200
+++
/work/SRC/openSUSE:Factory/.python-pkgconfig.new.21863/python-pkgconfig.changes
2026-04-11 22:23:39.485708878 +0200
@@ -1,0 +2,13 @@
+Fri Apr 10 08:38:17 UTC 2026 - John Paul Adrian Glaubitz
<[email protected]>
+
+- Update to 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.
+- Adjust path list for extracting tests from GitHub archive
+- Skip test_configure_extension test during testsuite
+
+-------------------------------------------------------------------
Old:
----
pkgconfig-1.5.5-gh.tar.gz
pkgconfig-1.5.5.tar.gz
New:
----
pkgconfig-1.6.0-gh.tar.gz
pkgconfig-1.6.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pkgconfig.spec ++++++
--- /var/tmp/diff_new_pack.7euBk6/_old 2026-04-11 22:23:40.037731474 +0200
+++ /var/tmp/diff_new_pack.7euBk6/_new 2026-04-11 22:23:40.041731638 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-pkgconfig
#
-# Copyright (c) 2025 SUSE LLC
+# Copyright (c) 2026 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%{?sle15_python_module_pythons}
Name: python-pkgconfig
-Version: 1.5.5
+Version: 1.6.0
Release: 0
Summary: Interface Python with pkg-config
License: MIT
@@ -46,7 +46,7 @@
%prep
%setup -q -n pkgconfig-%{version}
-(cd ..; tar xf %{SOURCE1} pkgconfig-%{version}/{test_pkgconfig.py,data})
+(cd ..; tar xf %{SOURCE1} pkgconfig-%{version}/tests)
%build
%pyproject_wheel
@@ -56,7 +56,7 @@
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
-%pytest
+%pytest -k "not test_configure_extension"
%files %{python_files}
%license LICENSE
++++++ pkgconfig-1.5.5-gh.tar.gz -> pkgconfig-1.6.0-gh.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/.github/workflows/ci.yml
new/pkgconfig-1.6.0/.github/workflows/ci.yml
--- old/pkgconfig-1.5.5/.github/workflows/ci.yml 1970-01-01
01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/.github/workflows/ci.yml 2026-03-06
00:55:59.000000000 +0100
@@ -0,0 +1,107 @@
+# badge:
https://github.com/matze/pkgconfig/workflows/CI/badge.svg?branch=master
+
+name: CI
+
+on:
+ push:
+ branches: [ master ]
+ paths:
+ - '**.py'
+ - '**.pc'
+ - '**.yml'
+ - '**.toml'
+ - '**.cfg'
+ - '**.ini'
+ pull_request:
+ branches: [ master ]
+ paths:
+ - '**.py'
+ - '**.pc'
+ - '**.yml'
+ - '**.toml'
+ - '**.cfg'
+ - '**.ini'
+
+jobs:
+ linux:
+
+ strategy:
+ fail-fast: true
+ matrix:
+ include:
+ - os: ubuntu-22.04
+ python-version: '3.9'
+ toxenv: py39
+ - os: ubuntu-22.04
+ python-version: '3.10'
+ toxenv: py310
+ - os: ubuntu-22.04
+ python-version: '3.11'
+ toxenv: py311
+ - 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.14'
+ toxenv: py314
+
+ env:
+ TOXENV: ${{ matrix.toxenv }}
+
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - uses: actions/checkout@v6
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v6
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install Linux packages
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y pkg-config
+ - name: Install Python requirements
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install poetry
+ poetry --version
+ poetry install
+ - name: run tox env
+ run: poetry run tox -c pyproject.toml --skip-missing-interpreters
+
+ macOS:
+
+ needs: linux
+ strategy:
+ fail-fast: true
+ matrix:
+ include:
+ - os: macos-15
+ python-version: '3.13'
+ toxenv: py313
+
+ env:
+ TOXENV: ${{ matrix.toxenv }}
+
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - uses: actions/checkout@v6
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v6
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install macOS packages
+ run: |
+ brew install pkgconf || brew upgrade pkgconf
+ - name: Install Python requirements
+ run: |
+ python -m pip install --upgrade pip
+ python -m pip install poetry
+ poetry --version
+ poetry install
+ - name: run tox env
+ run: poetry run tox -c pyproject.toml --skip-missing-interpreters
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/.travis.yml
new/pkgconfig-1.6.0/.travis.yml
--- old/pkgconfig-1.5.5/.travis.yml 2021-07-19 20:48:48.000000000 +0200
+++ new/pkgconfig-1.6.0/.travis.yml 1970-01-01 01:00:00.000000000 +0100
@@ -1,14 +0,0 @@
-os: linux
-dist: xenial # focal
-arch:
- - amd64
- - arm64
- - ppc64le
-language: python
-python:
- - "3.5"
- - "3.6"
- - "3.7"
- - "3.8"
-install: pip install pytest
-script: python -m pytest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/README.rst
new/pkgconfig-1.6.0/README.rst
--- old/pkgconfig-1.5.5/README.rst 2021-07-19 20:48:48.000000000 +0200
+++ new/pkgconfig-1.6.0/README.rst 2026-03-06 00:55:59.000000000 +0100
@@ -1,13 +1,17 @@
pkgconfig
=========
-.. image:: https://travis-ci.org/matze/pkgconfig.png?branch=master
- :target: https://travis-ci.org/matze/pkgconfig
+.. image:: https://github.com/matze/pkgconfig/workflows/CI/badge.svg
+ :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.3+.
+command-line tool for Python 3.9+.
-It can be used to
+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 ::
@@ -53,11 +57,11 @@
>>> # 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.
@@ -65,6 +69,21 @@
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
~~~~~~~~~~~~~
@@ -78,7 +97,7 @@
Version 1.5.2
~~~~~~~~~~~~~
-- Update poetry dep
+- Update poetry dependency
- Improve CI
Version 1.5.0
@@ -111,7 +130,7 @@
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
@@ -120,17 +139,17 @@
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``.
@@ -138,4 +157,4 @@
Version 1.0.0
~~~~~~~~~~~~~
-First release on September 8th 2013.
+First release on September 8th, 2013.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/data/fake-dld-pkg.pc
new/pkgconfig-1.6.0/data/fake-dld-pkg.pc
--- old/pkgconfig-1.5.5/data/fake-dld-pkg.pc 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/data/fake-dld-pkg.pc 1970-01-01 01:00:00.000000000
+0100
@@ -1,9 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
-
-Name: BetaPkg
-Description: fake package with a digit-letter-digit version number for testing
-Requires:
-Version: 1.2.3b4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/data/fake-gtk+-3.0.pc
new/pkgconfig-1.6.0/data/fake-gtk+-3.0.pc
--- old/pkgconfig-1.5.5/data/fake-gtk+-3.0.pc 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/data/fake-gtk+-3.0.pc 1970-01-01 01:00:00.000000000
+0100
@@ -1,14 +0,0 @@
-prefix=/usr
-exec_prefix=/usr
-libdir=/usr/lib_gtk_foo
-includedir=/usr/include
-targets=x11 broadway
-
-gtk_binary_version=3.0.0
-gtk_host=x86_64-suse-linux-gnu
-
-Name: GTK+
-Description: GTK+ Graphical UI Library
-Version: 3.2.1
-Libs: -L${libdir} -lgtk-3
-Cflags: -I${includedir}/gtk-3.0 -DGSEAL_ENABLE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/data/fake-openssl.pc
new/pkgconfig-1.6.0/data/fake-openssl.pc
--- old/pkgconfig-1.5.5/data/fake-openssl.pc 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/data/fake-openssl.pc 1970-01-01 01:00:00.000000000
+0100
@@ -1,10 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib/x86_64-linux-gnu
-includedir=${prefix}/include
-
-Name: OpenSSL
-Description: Secure Sockets Layer and cryptography libraries and tools
-Requires: libssl libcrypto
-Version: 1.1.0j
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/data/fake-python.pc
new/pkgconfig-1.6.0/data/fake-python.pc
--- old/pkgconfig-1.5.5/data/fake-python.pc 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/data/fake-python.pc 1970-01-01 01:00:00.000000000
+0100
@@ -1,13 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib_python_foo
-includedir=${prefix}/include
-
-Name: Python
-Description: Python library
-Requires:
-Version: 2.7
-Libs.private: -lpthread -ldl -lutil
-Libs: -L${libdir} -lpython2.7
-Cflags: -I${includedir}/python2.7
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/pkgconfig/__init__.py
new/pkgconfig-1.6.0/pkgconfig/__init__.py
--- old/pkgconfig-1.5.5/pkgconfig/__init__.py 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/pkgconfig/__init__.py 1970-01-01 01:00:00.000000000
+0100
@@ -1 +0,0 @@
-from .pkgconfig import *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/pkgconfig/pkgconfig.py
new/pkgconfig-1.6.0/pkgconfig/pkgconfig.py
--- old/pkgconfig-1.5.5/pkgconfig/pkgconfig.py 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/pkgconfig/pkgconfig.py 1970-01-01 01:00:00.000000000
+0100
@@ -1,291 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2013 Matthias Vogelgesang <[email protected]>
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# 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
-tool."""
-
-import os
-import shlex
-import re
-import collections
-from functools import wraps
-from subprocess import call, PIPE, Popen
-
-
-class PackageNotFoundError(Exception):
- """
- Raised if a package was not found.
- """
- def __init__(self, package):
- message = '%s not found' % package
- super(PackageNotFoundError, self).__init__(message)
-
-
-def _compare_versions(v1, v2):
- """
- Compare two version strings and return -1, 0 or 1 depending on the equality
- of the subset of matching version numbers.
-
- The implementation is inspired by the top answer at
- http://stackoverflow.com/a/1714190/997768.
- """
- def normalize(v):
- # strip trailing .0 or .00 or .0.0 or ...
- v = re.sub(r'(\.0+)*$', '', v)
- result = []
- for part in v.split('.'):
- # just digits
- m = re.match(r'^(\d+)$', part)
- if m:
- result.append(int(m.group(1)))
- continue
- # digits letters
- m = re.match(r'^(\d+)([a-zA-Z]+)$', part)
- if m:
- result.append(int(m.group(1)))
- result.append(m.group(2))
- continue
- # digits letters digits
- m = re.match(r'^(\d+)([a-zA-Z]+)(\d+)$', part)
- if m:
- result.append(int(m.group(1)))
- result.append(m.group(2))
- result.append(int(m.group(3)))
- continue
- return tuple(result)
-
- n1 = normalize(v1)
- n2 = normalize(v2)
-
- return (n1 > n2) - (n1 < n2)
-
-
-def _split_version_specifier(spec):
- """Splits version specifiers in the form ">= 0.1.2" into ('0.1.2', '>=')"""
- m = re.search(r'([<>=]?=?)?\s*([0-9.a-zA-Z]+)', spec)
- return m.group(2), m.group(1)
-
-
-def _convert_error(func):
- @wraps(func)
- def _wrapper(*args, **kwargs):
- try:
- return func(*args, **kwargs)
- except OSError as e:
- raise EnvironmentError("pkg-config probably not installed: %r" % e)
- return _wrapper
-
-
-def _build_options(option, static=False):
- return (option, '--static') if static else (option,)
-
-
-def _raise_if_not_exists(package):
- if not exists(package):
- raise PackageNotFoundError(package)
-
-
-@_convert_error
-def _query(package, *options):
- pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
- cmd = '{0} {1} {2}'.format(pkg_config_exe, ' '.join(options), package)
- proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)
- out, err = proc.communicate()
-
- return out.rstrip().decode('utf-8')
-
-
-@_convert_error
-def exists(package):
- """
- Return True if package information is available.
-
- If ``pkg-config`` not on path, raises ``EnvironmentError``.
- """
- pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
- cmd = '{0} --exists {1}'.format(pkg_config_exe, package).split()
- return call(cmd) == 0
-
-
-@_convert_error
-def requires(package):
- """
- Return a list of package names that is required by the package.
-
- If ``pkg-config`` not on path, raises ``EnvironmentError``.
- """
- return _query(package, '--print-requires').split('\n')
-
-
-def cflags(package):
- """
- Return the CFLAGS string returned by pkg-config.
-
- If ``pkg-config`` is not on path, raises ``EnvironmentError``.
- """
- _raise_if_not_exists(package)
- return _query(package, '--cflags')
-
-
-def modversion(package):
- """
- Return the version returned by pkg-config.
-
- If `pkg-config` is not in the path, raises ``EnvironmentError``.
- """
- _raise_if_not_exists(package)
- return _query(package, '--modversion')
-
-
-def libs(package, static=False):
- """
- Return the LDFLAGS string returned by pkg-config.
-
- The static specifier will also include libraries for static linking (i.e.,
- includes any private libraries).
- """
- _raise_if_not_exists(package)
- return _query(package, *_build_options('--libs', static=static))
-
-
-def variables(package):
- """
- Return a dictionary of all the variables defined in the .pc pkg-config file
- of 'package'.
- """
- _raise_if_not_exists(package)
- result = _query(package, '--print-variables')
- names = (x.strip() for x in result.split('\n') if x != '')
- return dict(((x, _query(package, '--variable={0}'.format(x)).strip()) for
x in names))
-
-
-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
- package 'foo':
-
- >>> installed('foo', '==0.1.2')
- True
- >>> installed('foo', '<0.1')
- False
- >>> installed('foo', '>= 0.0.4')
- True
-
- If ``pkg-config`` not on path, raises ``EnvironmentError``.
- """
- if not exists(package):
- return False
-
- number, comparator = _split_version_specifier(version)
- modversion = _query(package, '--modversion')
-
- try:
- result = _compare_versions(modversion, number)
- except ValueError:
- msg = "{0} is not a correct version specifier".format(version)
- raise ValueError(msg)
-
- if comparator in ('', '=', '=='):
- return result == 0
-
- if comparator == '>':
- return result > 0
-
- if comparator == '>=':
- return result >= 0
-
- if comparator == '<':
- return result < 0
-
- if comparator == '<=':
- return result <= 0
-
-
-_PARSE_MAP = {
- '-D': 'define_macros',
- '-I': 'include_dirs',
- '-L': 'library_dirs',
- '-l': 'libraries'
-}
-
-
-def parse(packages, static=False):
- """
- Parse the output from pkg-config about the passed package or packages.
-
- 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.
-
- 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``.
- """
- for package in packages.split():
- _raise_if_not_exists(package)
-
- out = _query(packages, *_build_options('--cflags --libs', static=static))
- out = out.replace('\\"', '')
- result = collections.defaultdict(list)
-
- for token in re.split(r'(?<!\\) ', out):
- key = _PARSE_MAP.get(token[:2])
- if key:
- result[key].append(token[2:].strip())
-
- def split(m):
- t = tuple(m.split('='))
- return t if len(t) > 1 else (t[0], None)
-
- result['define_macros'] = [split(m) for m in result['define_macros']]
-
- # only have members with values not being the empty list (which is default
- # anyway):
- return collections.defaultdict(list, ((k, v) for k, v in result.items() if
v))
-
-
-def configure_extension(ext, packages, static=False):
- """
- Append the ``--cflags`` and ``--libs`` of a space-separated list of
- *packages* to the ``extra_compile_args`` and ``extra_link_args`` of a
- distutils/setuptools ``Extension``.
- """
- for package in packages.split():
- _raise_if_not_exists(package)
-
- def query_and_extend(option, target):
- os_opts = ['--msvc-syntax'] if os.name == 'nt' else []
- flags = _query(packages, *os_opts, *_build_options(option,
static=static))
- target.extend(re.split(r'(?<!\\) ', flags.replace('\\"', '')))
-
- query_and_extend('--cflags', ext.extra_compile_args)
- query_and_extend('--libs', ext.extra_link_args)
-
-
-def list_all():
- """Return a list of all packages found by pkg-config."""
- packages = [line.split()[0] for line in _query('',
'--list-all').split('\n')]
- return packages
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/pyproject.toml
new/pkgconfig-1.6.0/pyproject.toml
--- old/pkgconfig-1.5.5/pyproject.toml 2021-07-19 20:48:48.000000000 +0200
+++ new/pkgconfig-1.6.0/pyproject.toml 2026-03-06 00:55:59.000000000 +0100
@@ -4,7 +4,7 @@
[tool.poetry]
name = "pkgconfig"
-version = "1.5.5"
+version = "1.6.0"
license = "MIT"
description = "Interface Python with pkg-config"
authors = ["Matthias Vogelgesang <[email protected]>"]
@@ -18,7 +18,24 @@
]
[tool.poetry.dependencies]
-python = "^3.3"
+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
+"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/src/pkgconfig/__init__.py
new/pkgconfig-1.6.0/src/pkgconfig/__init__.py
--- old/pkgconfig-1.5.5/src/pkgconfig/__init__.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/src/pkgconfig/__init__.py 2026-03-06
00:55:59.000000000 +0100
@@ -0,0 +1 @@
+from .pkgconfig import *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/src/pkgconfig/pkgconfig.py
new/pkgconfig-1.6.0/src/pkgconfig/pkgconfig.py
--- old/pkgconfig-1.5.5/src/pkgconfig/pkgconfig.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/src/pkgconfig/pkgconfig.py 2026-03-06
00:55:59.000000000 +0100
@@ -0,0 +1,293 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2013 Matthias Vogelgesang <[email protected]>
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# 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
+tool."""
+
+import os
+import shlex
+import re
+import collections
+from functools import wraps
+from subprocess import call, PIPE, Popen
+
+
+class PackageNotFoundError(Exception):
+ """
+ Raised if a package was not found.
+ """
+ def __init__(self, package):
+ message = '%s not found' % package
+ super(PackageNotFoundError, self).__init__(message)
+
+
+def _compare_versions(v1, v2):
+ """
+ Compare two version strings and return -1, 0 or 1 depending on the equality
+ of the subset of matching version numbers.
+
+ The implementation is inspired by the top answer at
+ http://stackoverflow.com/a/1714190/997768.
+ """
+ def normalize(v):
+ # strip trailing .0 or .00 or .0.0 or ...
+ v = re.sub(r'(\.0+)*$', '', v)
+ result = []
+ for part in v.split('.'):
+ # just digits
+ m = re.match(r'^(\d+)$', part)
+ if m:
+ result.append(int(m.group(1)))
+ continue
+ # digits letters
+ m = re.match(r'^(\d+)([a-zA-Z]+)$', part)
+ if m:
+ result.append(int(m.group(1)))
+ result.append(m.group(2))
+ continue
+ # digits letters digits
+ m = re.match(r'^(\d+)([a-zA-Z]+)(\d+)$', part)
+ if m:
+ result.append(int(m.group(1)))
+ result.append(m.group(2))
+ result.append(int(m.group(3)))
+ continue
+ return tuple(result)
+
+ n1 = normalize(v1)
+ n2 = normalize(v2)
+
+ return (n1 > n2) - (n1 < n2)
+
+
+def _split_version_specifier(spec):
+ """Splits version specifiers in the form ">= 0.1.2" into ('0.1.2', '>=')"""
+ m = re.search(r'([<>=]?=?)?\s*([0-9.a-zA-Z]+)', spec)
+ return m.group(2), m.group(1)
+
+
+def _convert_error(func):
+ @wraps(func)
+ def _wrapper(*args, **kwargs):
+ try:
+ return func(*args, **kwargs)
+ except OSError as e:
+ raise EnvironmentError("pkg-config probably not installed: %r" % e)
+ return _wrapper
+
+
+def _build_options(option, static=False):
+ return (option, '--static') if static else (option,)
+
+
+def _raise_if_not_exists(package):
+ if not exists(package):
+ raise PackageNotFoundError(package)
+
+
+@_convert_error
+def _query(package, *options):
+ pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
+ cmd = '{0} {1} {2}'.format(pkg_config_exe, ' '.join(options), package)
+ proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)
+ out, err = proc.communicate()
+
+ return out.rstrip().decode('utf-8')
+
+
+@_convert_error
+def exists(package):
+ """
+ Return True if package information is available.
+
+ 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()
+ return call(cmd) == 0
+
+
+@_convert_error
+def requires(package):
+ """
+ Return a list of package names that are required by the package.
+
+ If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
+ """
+ return _query(package, '--print-requires').split('\n')
+
+
+def cflags(package):
+ """
+ Return the CFLAGS string returned by pkg-config.
+
+ If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
+ """
+ _raise_if_not_exists(package)
+ return _query(package, '--cflags')
+
+
+def modversion(package):
+ """
+ Return the version returned by pkg-config.
+
+ If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
+ """
+ _raise_if_not_exists(package)
+ return _query(package, '--modversion')
+
+
+def libs(package, static=False):
+ """
+ Return the LDFLAGS string returned by pkg-config.
+
+ The static specifier will also include libraries for static linking (i.e.,
+ includes any private libraries).
+ """
+ _raise_if_not_exists(package)
+ return _query(package, *_build_options('--libs', static=static))
+
+
+def variables(package):
+ """
+ Return a dictionary of all the variables defined in the .pc pkg-config file
+ of the package.
+ """
+ _raise_if_not_exists(package)
+ result = _query(package, '--print-variables')
+ names = (x.strip() for x in result.split('\n') if x != '')
+ return dict(((x, _query(package, '--variable={0}'.format(x)).strip()) for
x in names))
+
+
+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
comparisons
+ behave as you would expect. For example, for an installed version '0.1.2'
of
+ package 'foo':
+
+ >>> installed('foo', '==0.1.2')
+ True
+ >>> installed('foo', '<0.1')
+ False
+ >>> installed('foo', '>= 0.0.4')
+ True
+
+ If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
+ """
+ if not exists(package):
+ return False
+
+ number, comparator = _split_version_specifier(version)
+ modversion = _query(package, '--modversion')
+
+ try:
+ result = _compare_versions(modversion, number)
+ except ValueError:
+ msg = "{0} is not a correct version specifier".format(version)
+ raise ValueError(msg)
+
+ if comparator in ('', '=', '=='):
+ return result == 0
+
+ if comparator == '>':
+ return result > 0
+
+ if comparator == '>=':
+ return result >= 0
+
+ if comparator == '<':
+ return result < 0
+
+ if comparator == '<=':
+ return result <= 0
+
+
+_PARSE_MAP = {
+ '-D': 'define_macros',
+ '-I': 'include_dirs',
+ '-L': 'library_dirs',
+ '-l': 'libraries'
+}
+
+
+def parse(packages, static=False):
+ """
+ Parse the output from pkg-config about the passed package or packages.
+
+ Builds a dictionary containing the 'libraries', the 'library_dirs', the
+ 'include_dirs', and the 'define_macros' that are presented by pkg-config.
+ *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 the PATH, an ``EnvironmentError`` is raised.
+ """
+ for package in packages.split():
+ _raise_if_not_exists(package)
+
+ out = _query(packages, *_build_options('--cflags --libs', static=static))
+ out = out.replace('\\"', '')
+ result = collections.defaultdict(list)
+
+ for token in re.split(r'(?<!\\) ', out):
+ key = _PARSE_MAP.get(token[:2])
+ if key:
+ result[key].append(token[2:].strip())
+
+ def split(m):
+ t = tuple(m.split('='))
+ return t if len(t) > 1 else (t[0], None)
+
+ result['define_macros'] = [split(m) for m in result['define_macros']]
+
+ # only have members with values not being the empty list (which is default
+ # anyway):
+ return collections.defaultdict(list, ((k, v) for k, v in result.items() if
v))
+
+
+def configure_extension(ext, packages, static=False):
+ """
+ Append the ``--cflags`` and ``--libs`` of a space-separated list of
+ *packages* to the ``extra_compile_args`` and ``extra_link_args`` of a
+ distutils/setuptools ``Extension``.
+ """
+ for package in packages.split():
+ _raise_if_not_exists(package)
+
+ def query_and_extend(option, target):
+ os_opts = ['--msvc-syntax'] if os.name == 'nt' else []
+ flags = _query(packages, *os_opts, *_build_options(option,
static=static))
+ flags = flags.replace('\\"', '')
+ if flags:
+ target.extend(re.split(r'(?<!\\) ', flags))
+
+ query_and_extend('--cflags', ext.extra_compile_args)
+ query_and_extend('--libs', ext.extra_link_args)
+
+
+def list_all():
+ """Return a list of all packages found by pkg-config."""
+ packages = [line.split()[0] for line in _query('',
'--list-all').split('\n')]
+ return packages
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/test_pkgconfig.py
new/pkgconfig-1.6.0/test_pkgconfig.py
--- old/pkgconfig-1.5.5/test_pkgconfig.py 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/test_pkgconfig.py 1970-01-01 01:00:00.000000000
+0100
@@ -1,167 +0,0 @@
-from distutils.core import Extension
-import os
-import pytest
-import pkgconfig
-
-os.environ['PKG_CONFIG_PATH'] = os.path.abspath('./data')
-PACKAGE_NAME = 'fake-gtk+-3.0'
-
-
-def test_exists():
- assert pkgconfig.exists(PACKAGE_NAME)
- assert pkgconfig.exists('fake-openssl')
-
-
[email protected]("version,expected", [
- ('3.2.1', True),
- ('==3.2.1', True),
- ('==3.2.2', False),
- ('> 2.2', True),
- ('> 3.4', False),
- ('<= 3.3.5', True),
- ('< 2.3', False),
-])
-def test_version(version, expected):
- assert pkgconfig.installed(PACKAGE_NAME, version) == expected
-
-
[email protected]("version,expected", [
- ('1.1.0j', True),
- ('==1.1.0j', True),
- ('==1.1.0k', False),
- ('>= 1.1.0', True),
- ('> 1.2.0', False),
- ('< 1.2.0', True),
- ('< 1.1.0', False),
- ('>= 1.1', True),
- ('> 1.2', False),
- ('< 1.2', True),
- ('< 1.1', False),
- ('>= 1.1.0c', True),
- ('>= 1.1.0k', False),
- # PLEASE NOTE:
- # the letters have no semantics, except string ordering, see also the
- # comment in the test below.
- # comparing release with beta, like "1.2.3" > "1.2.3b" does not work.
-])
-def test_openssl(version, expected):
- assert pkgconfig.installed('fake-openssl', version) == expected
-
-
[email protected]("version,expected", [
- ('1.2.3b4', True),
- ('==1.2.3b4', True),
- ('==1.2.3', False),
- ('>= 1.2.3b3', True),
- ('< 1.2.3b5', True),
- # 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
- # 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
- # 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.
-])
-def test_dld_pkg(version, expected):
- assert pkgconfig.installed('fake-dld-pkg', version) == expected
-
-
-def test_modversion():
- assert pkgconfig.modversion(PACKAGE_NAME) == '3.2.1'
- assert pkgconfig.modversion('fake-openssl') == '1.1.0j'
-
- with pytest.raises(pkgconfig.PackageNotFoundError):
- pkgconfig.modversion('doesnotexist')
-
-
-def test_cflags():
- flags = pkgconfig.cflags(PACKAGE_NAME)
-
- for flag in flags.split(' '):
- assert flag in ('-DGSEAL_ENABLE', '-I/usr/include/gtk-3.0')
-
- with pytest.raises(pkgconfig.PackageNotFoundError):
- pkgconfig.cflags('doesnotexist')
-
-
-def test_libs():
- flags = pkgconfig.libs(PACKAGE_NAME)
-
- for flag in flags.split(' '):
- assert flag in ('-L/usr/lib_gtk_foo', '-lgtk-3')
-
- with pytest.raises(pkgconfig.PackageNotFoundError):
- pkgconfig.libs('doesnotexist')
-
-
-def test_libs_static():
- flags = pkgconfig.libs('fake-python', static=True)
- flags = flags.split(' ')
- assert '-lpthread' in flags
- assert '-ldl' in flags
- assert '-lutil' in flags
-
-
-def test_parse():
- config = pkgconfig.parse("fake-gtk+-3.0 fake-python")
-
- assert ('GSEAL_ENABLE', None) in config['define_macros']
- assert '/usr/include/gtk-3.0' in config['include_dirs']
- assert '/usr/lib_gtk_foo' in config['library_dirs']
- assert '/usr/lib_python_foo' in config['library_dirs']
- assert 'gtk-3' in config['libraries']
-
- assert '/usr/include/python2.7' in config['include_dirs']
-
- with pytest.raises(pkgconfig.PackageNotFoundError):
- pkgconfig.parse('doesnotexist')
-
-
-def test_parse_static():
- config = pkgconfig.parse("fake-python", static=True)
- assert '/usr/lib_python_foo' in config['library_dirs']
- assert '/usr/include/python2.7' in config['include_dirs']
- assert 'python2.7' in config['libraries']
- assert 'pthread' in config['libraries']
- assert 'dl' in config['libraries']
- assert 'util' in config['libraries']
-
-
-def test_configure_extension():
- ext = Extension('foo', ['foo.c'])
- pkgconfig.configure_extension(ext, 'fake-gtk+-3.0 fake-python')
- assert sorted(ext.extra_compile_args) == [
- '-DGSEAL_ENABLE', '-I/usr/include/gtk-3.0','-I/usr/include/python2.7']
- assert sorted(ext.extra_link_args) == [
- '-L/usr/lib_gtk_foo', '-L/usr/lib_python_foo', '-lgtk-3',
'-lpython2.7']
-
-
-def test_listall():
- packages = pkgconfig.list_all()
- assert 'fake-gtk+-3.0' in packages
- assert 'fake-python' in packages
-
-
-def test_variables():
- variables = pkgconfig.variables('fake-python')
-
- assert 'prefix' in variables
- assert 'exec_prefix' in variables
- assert 'libdir' in variables
- assert 'includedir' in variables
-
- assert variables['prefix'] == '/usr'
- assert variables['exec_prefix'] == '/usr'
- assert variables['libdir'] == '/usr/lib_python_foo'
- assert variables['includedir'] == '/usr/include'
-
- with pytest.raises(pkgconfig.PackageNotFoundError):
- pkgconfig.variables('doesnotexist')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/tests/data/fake-dld-pkg.pc
new/pkgconfig-1.6.0/tests/data/fake-dld-pkg.pc
--- old/pkgconfig-1.5.5/tests/data/fake-dld-pkg.pc 1970-01-01
01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/tests/data/fake-dld-pkg.pc 2026-03-06
00:55:59.000000000 +0100
@@ -0,0 +1,9 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: BetaPkg
+Description: fake package with a digit-letter-digit version number for testing
+Requires:
+Version: 1.2.3b4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/tests/data/fake-gtk+-3.0.pc
new/pkgconfig-1.6.0/tests/data/fake-gtk+-3.0.pc
--- old/pkgconfig-1.5.5/tests/data/fake-gtk+-3.0.pc 1970-01-01
01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/tests/data/fake-gtk+-3.0.pc 2026-03-06
00:55:59.000000000 +0100
@@ -0,0 +1,14 @@
+prefix=/usr
+exec_prefix=/usr
+libdir=/usr/lib_gtk_foo
+includedir=/usr/include
+targets=x11 broadway
+
+gtk_binary_version=3.0.0
+gtk_host=x86_64-suse-linux-gnu
+
+Name: GTK+
+Description: GTK+ Graphical UI Library
+Version: 3.2.1
+Libs: -L${libdir} -lgtk-3
+Cflags: -I${includedir}/gtk-3.0 -DGSEAL_ENABLE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/tests/data/fake-ldonly-pkg.pc
new/pkgconfig-1.6.0/tests/data/fake-ldonly-pkg.pc
--- old/pkgconfig-1.5.5/tests/data/fake-ldonly-pkg.pc 1970-01-01
01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/tests/data/fake-ldonly-pkg.pc 2026-03-06
00:55:59.000000000 +0100
@@ -0,0 +1,10 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: FakeLdOnly
+Description: fake package with only libs, not cflags
+Requires:
+Version: 1.2.3
+Libs: -L${libdir} -lfakeldonly
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/tests/data/fake-openssl.pc
new/pkgconfig-1.6.0/tests/data/fake-openssl.pc
--- old/pkgconfig-1.5.5/tests/data/fake-openssl.pc 1970-01-01
01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/tests/data/fake-openssl.pc 2026-03-06
00:55:59.000000000 +0100
@@ -0,0 +1,10 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib/x86_64-linux-gnu
+includedir=${prefix}/include
+
+Name: OpenSSL
+Description: Secure Sockets Layer and cryptography libraries and tools
+Requires: libssl libcrypto
+Version: 1.1.0j
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/tests/data/fake-python.pc
new/pkgconfig-1.6.0/tests/data/fake-python.pc
--- old/pkgconfig-1.5.5/tests/data/fake-python.pc 1970-01-01
01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/tests/data/fake-python.pc 2026-03-06
00:55:59.000000000 +0100
@@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib_python_foo
+includedir=${prefix}/include
+
+Name: Python
+Description: Python library
+Requires:
+Version: 2.7
+Libs.private: -lpthread -ldl -lutil
+Libs: -L${libdir} -lpython2.7
+Cflags: -I${includedir}/python2.7
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/tests/test_pkgconfig.py
new/pkgconfig-1.6.0/tests/test_pkgconfig.py
--- old/pkgconfig-1.5.5/tests/test_pkgconfig.py 1970-01-01 01:00:00.000000000
+0100
+++ new/pkgconfig-1.6.0/tests/test_pkgconfig.py 2026-03-06 00:55:59.000000000
+0100
@@ -0,0 +1,173 @@
+from setuptools import Extension
+import os
+import pytest
+import pkgconfig
+
+this_dir = os.path.dirname(__file__)
+os.environ['PKG_CONFIG_PATH'] = os.path.abspath(os.path.join(this_dir, 'data'))
+PACKAGE_NAME = 'fake-gtk+-3.0'
+
+
+def test_exists():
+ assert pkgconfig.exists(PACKAGE_NAME)
+ assert pkgconfig.exists('fake-openssl')
+
+
[email protected]("version,expected", [
+ ('3.2.1', True),
+ ('==3.2.1', True),
+ ('==3.2.2', False),
+ ('> 2.2', True),
+ ('> 3.4', False),
+ ('<= 3.3.5', True),
+ ('< 2.3', False),
+])
+def test_version(version, expected):
+ assert pkgconfig.installed(PACKAGE_NAME, version) == expected
+
+
[email protected]("version,expected", [
+ ('1.1.0j', True),
+ ('==1.1.0j', True),
+ ('==1.1.0k', False),
+ ('>= 1.1.0', True),
+ ('> 1.2.0', False),
+ ('< 1.2.0', True),
+ ('< 1.1.0', False),
+ ('>= 1.1', True),
+ ('> 1.2', False),
+ ('< 1.2', True),
+ ('< 1.1', False),
+ ('>= 1.1.0c', True),
+ ('>= 1.1.0k', False),
+ # PLEASE NOTE:
+ # the letters have no semantics, except string ordering, see also the
+ # comment in the test below.
+ # comparing release with beta, like "1.2.3" > "1.2.3b" does not work.
+])
+def test_openssl(version, expected):
+ assert pkgconfig.installed('fake-openssl', version) == expected
+
+
[email protected]("version,expected", [
+ ('1.2.3b4', True),
+ ('==1.2.3b4', True),
+ ('==1.2.3', False),
+ ('>= 1.2.3b3', True),
+ ('< 1.2.3b5', True),
+ # 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 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 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 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
+
+
+def test_modversion():
+ assert pkgconfig.modversion(PACKAGE_NAME) == '3.2.1'
+ assert pkgconfig.modversion('fake-openssl') == '1.1.0j'
+
+ with pytest.raises(pkgconfig.PackageNotFoundError):
+ pkgconfig.modversion('doesnotexist')
+
+
+def test_cflags():
+ flags = pkgconfig.cflags(PACKAGE_NAME)
+
+ for flag in flags.split(' '):
+ assert flag in ('-DGSEAL_ENABLE', '-I/usr/include/gtk-3.0')
+
+ with pytest.raises(pkgconfig.PackageNotFoundError):
+ pkgconfig.cflags('doesnotexist')
+
+
+def test_libs():
+ flags = pkgconfig.libs(PACKAGE_NAME)
+
+ for flag in flags.split(' '):
+ assert flag in ('-L/usr/lib_gtk_foo', '-lgtk-3')
+
+ with pytest.raises(pkgconfig.PackageNotFoundError):
+ pkgconfig.libs('doesnotexist')
+
+
+def test_libs_static():
+ flags = pkgconfig.libs('fake-python', static=True)
+ flags = flags.split(' ')
+ assert '-lpthread' in flags
+ assert '-ldl' in flags
+ assert '-lutil' in flags
+
+
+def test_parse():
+ config = pkgconfig.parse("fake-gtk+-3.0 fake-python")
+
+ assert ('GSEAL_ENABLE', None) in config['define_macros']
+ assert '/usr/include/gtk-3.0' in config['include_dirs']
+ assert '/usr/lib_gtk_foo' in config['library_dirs']
+ assert '/usr/lib_python_foo' in config['library_dirs']
+ assert 'gtk-3' in config['libraries']
+
+ assert '/usr/include/python2.7' in config['include_dirs']
+
+ with pytest.raises(pkgconfig.PackageNotFoundError):
+ pkgconfig.parse('doesnotexist')
+
+
+def test_parse_static():
+ config = pkgconfig.parse("fake-python", static=True)
+ assert '/usr/lib_python_foo' in config['library_dirs']
+ assert '/usr/include/python2.7' in config['include_dirs']
+ assert 'python2.7' in config['libraries']
+ assert 'pthread' in config['libraries']
+ assert 'dl' in config['libraries']
+ assert 'util' in config['libraries']
+
+
+def test_configure_extension():
+ ext = Extension('foo', ['foo.c'])
+ pkgconfig.configure_extension(ext, 'fake-gtk+-3.0 fake-python')
+ assert sorted(ext.extra_compile_args) == [
+ '-DGSEAL_ENABLE', '-I/usr/include/gtk-3.0',
'-I/usr/include/python2.7']
+ assert sorted(ext.extra_link_args) == [
+ '-L/usr/lib_gtk_foo', '-L/usr/lib_python_foo', '-lgtk-3',
'-lpython2.7']
+
+ ext = Extension('foo', ['foo.c'])
+ pkgconfig.configure_extension(ext, 'fake-ldonly-pkg')
+ assert ext.extra_compile_args == []
+ assert ext.extra_link_args == ['-lfakeldonly']
+
+
+def test_listall():
+ packages = pkgconfig.list_all()
+ assert 'fake-gtk+-3.0' in packages
+ assert 'fake-python' in packages
+
+
+def test_variables():
+ variables = pkgconfig.variables('fake-python')
+
+ assert 'prefix' in variables
+ assert 'exec_prefix' in variables
+ assert 'libdir' in variables
+ assert 'includedir' in variables
+
+ assert variables['prefix'] == '/usr'
+ assert variables['exec_prefix'] == '/usr'
+ assert variables['libdir'] == '/usr/lib_python_foo'
+ assert variables['includedir'] == '/usr/include'
+
+ with pytest.raises(pkgconfig.PackageNotFoundError):
+ pkgconfig.variables('doesnotexist')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/tox.ini new/pkgconfig-1.6.0/tox.ini
--- old/pkgconfig-1.5.5/tox.ini 2021-07-19 20:48:48.000000000 +0200
+++ new/pkgconfig-1.6.0/tox.ini 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-[tox]
-envlist = py{26,27,33,34,35,36,37}
-
-[testenv]
-deps = pytest
-commands= pytest
++++++ pkgconfig-1.5.5-gh.tar.gz -> pkgconfig-1.6.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/.gitignore
new/pkgconfig-1.6.0/.gitignore
--- old/pkgconfig-1.5.5/.gitignore 2021-07-19 20:48:48.000000000 +0200
+++ new/pkgconfig-1.6.0/.gitignore 1970-01-01 01:00:00.000000000 +0100
@@ -1,8 +0,0 @@
-build/
-dist/
-.tox/
-.eggs/
-poetry.lock
-*.egg/*
-*.egg-info
-*.pyc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/.travis.yml
new/pkgconfig-1.6.0/.travis.yml
--- old/pkgconfig-1.5.5/.travis.yml 2021-07-19 20:48:48.000000000 +0200
+++ new/pkgconfig-1.6.0/.travis.yml 1970-01-01 01:00:00.000000000 +0100
@@ -1,14 +0,0 @@
-os: linux
-dist: xenial # focal
-arch:
- - amd64
- - arm64
- - ppc64le
-language: python
-python:
- - "3.5"
- - "3.6"
- - "3.7"
- - "3.8"
-install: pip install pytest
-script: python -m pytest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/PKG-INFO new/pkgconfig-1.6.0/PKG-INFO
--- old/pkgconfig-1.5.5/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/PKG-INFO 2026-03-06 12:12:39.000000000 +0100
@@ -0,0 +1,185 @@
+Metadata-Version: 2.4
+Name: pkgconfig
+Version: 1.6.0
+Summary: Interface Python with pkg-config
+License: MIT
+License-File: LICENSE
+Author: Matthias Vogelgesang
+Author-email: [email protected]
+Requires-Python: >=3.9.0,<4.0.0
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Classifier: Programming Language :: Python :: 3.12
+Classifier: Programming Language :: Python :: 3.13
+Classifier: Programming Language :: Python :: 3.14
+Classifier: Topic :: Software Development :: Build Tools
+Project-URL: Homepage, https://github.com/matze/pkgconfig
+Description-Content-Type: text/x-rst
+
+pkgconfig
+=========
+
+.. image:: https://github.com/matze/pkgconfig/workflows/CI/badge.svg
+ :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+.
+
+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')
+ True
+
+- check if a package meets certain version requirements ::
+
+ >>> pkgconfig.installed('glib-2.0', '< 2.26')
+ False
+
+- return 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.
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/README.rst
new/pkgconfig-1.6.0/README.rst
--- old/pkgconfig-1.5.5/README.rst 2021-07-19 20:48:48.000000000 +0200
+++ new/pkgconfig-1.6.0/README.rst 2026-03-06 12:12:39.000000000 +0100
@@ -1,13 +1,17 @@
pkgconfig
=========
-.. image:: https://travis-ci.org/matze/pkgconfig.png?branch=master
- :target: https://travis-ci.org/matze/pkgconfig
+.. image:: https://github.com/matze/pkgconfig/workflows/CI/badge.svg
+ :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.3+.
+command-line tool for Python 3.9+.
-It can be used to
+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 ::
@@ -53,11 +57,11 @@
>>> # 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.
@@ -65,6 +69,21 @@
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
~~~~~~~~~~~~~
@@ -78,7 +97,7 @@
Version 1.5.2
~~~~~~~~~~~~~
-- Update poetry dep
+- Update poetry dependency
- Improve CI
Version 1.5.0
@@ -111,7 +130,7 @@
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
@@ -120,17 +139,17 @@
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``.
@@ -138,4 +157,4 @@
Version 1.0.0
~~~~~~~~~~~~~
-First release on September 8th 2013.
+First release on September 8th, 2013.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/data/fake-dld-pkg.pc
new/pkgconfig-1.6.0/data/fake-dld-pkg.pc
--- old/pkgconfig-1.5.5/data/fake-dld-pkg.pc 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/data/fake-dld-pkg.pc 1970-01-01 01:00:00.000000000
+0100
@@ -1,9 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib
-includedir=${prefix}/include
-
-Name: BetaPkg
-Description: fake package with a digit-letter-digit version number for testing
-Requires:
-Version: 1.2.3b4
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/data/fake-gtk+-3.0.pc
new/pkgconfig-1.6.0/data/fake-gtk+-3.0.pc
--- old/pkgconfig-1.5.5/data/fake-gtk+-3.0.pc 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/data/fake-gtk+-3.0.pc 1970-01-01 01:00:00.000000000
+0100
@@ -1,14 +0,0 @@
-prefix=/usr
-exec_prefix=/usr
-libdir=/usr/lib_gtk_foo
-includedir=/usr/include
-targets=x11 broadway
-
-gtk_binary_version=3.0.0
-gtk_host=x86_64-suse-linux-gnu
-
-Name: GTK+
-Description: GTK+ Graphical UI Library
-Version: 3.2.1
-Libs: -L${libdir} -lgtk-3
-Cflags: -I${includedir}/gtk-3.0 -DGSEAL_ENABLE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/data/fake-openssl.pc
new/pkgconfig-1.6.0/data/fake-openssl.pc
--- old/pkgconfig-1.5.5/data/fake-openssl.pc 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/data/fake-openssl.pc 1970-01-01 01:00:00.000000000
+0100
@@ -1,10 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib/x86_64-linux-gnu
-includedir=${prefix}/include
-
-Name: OpenSSL
-Description: Secure Sockets Layer and cryptography libraries and tools
-Requires: libssl libcrypto
-Version: 1.1.0j
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/data/fake-python.pc
new/pkgconfig-1.6.0/data/fake-python.pc
--- old/pkgconfig-1.5.5/data/fake-python.pc 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/data/fake-python.pc 1970-01-01 01:00:00.000000000
+0100
@@ -1,13 +0,0 @@
-prefix=/usr
-exec_prefix=${prefix}
-libdir=${exec_prefix}/lib_python_foo
-includedir=${prefix}/include
-
-Name: Python
-Description: Python library
-Requires:
-Version: 2.7
-Libs.private: -lpthread -ldl -lutil
-Libs: -L${libdir} -lpython2.7
-Cflags: -I${includedir}/python2.7
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/pkgconfig/__init__.py
new/pkgconfig-1.6.0/pkgconfig/__init__.py
--- old/pkgconfig-1.5.5/pkgconfig/__init__.py 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/pkgconfig/__init__.py 1970-01-01 01:00:00.000000000
+0100
@@ -1 +0,0 @@
-from .pkgconfig import *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/pkgconfig/pkgconfig.py
new/pkgconfig-1.6.0/pkgconfig/pkgconfig.py
--- old/pkgconfig-1.5.5/pkgconfig/pkgconfig.py 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/pkgconfig/pkgconfig.py 1970-01-01 01:00:00.000000000
+0100
@@ -1,291 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2013 Matthias Vogelgesang <[email protected]>
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# 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
-tool."""
-
-import os
-import shlex
-import re
-import collections
-from functools import wraps
-from subprocess import call, PIPE, Popen
-
-
-class PackageNotFoundError(Exception):
- """
- Raised if a package was not found.
- """
- def __init__(self, package):
- message = '%s not found' % package
- super(PackageNotFoundError, self).__init__(message)
-
-
-def _compare_versions(v1, v2):
- """
- Compare two version strings and return -1, 0 or 1 depending on the equality
- of the subset of matching version numbers.
-
- The implementation is inspired by the top answer at
- http://stackoverflow.com/a/1714190/997768.
- """
- def normalize(v):
- # strip trailing .0 or .00 or .0.0 or ...
- v = re.sub(r'(\.0+)*$', '', v)
- result = []
- for part in v.split('.'):
- # just digits
- m = re.match(r'^(\d+)$', part)
- if m:
- result.append(int(m.group(1)))
- continue
- # digits letters
- m = re.match(r'^(\d+)([a-zA-Z]+)$', part)
- if m:
- result.append(int(m.group(1)))
- result.append(m.group(2))
- continue
- # digits letters digits
- m = re.match(r'^(\d+)([a-zA-Z]+)(\d+)$', part)
- if m:
- result.append(int(m.group(1)))
- result.append(m.group(2))
- result.append(int(m.group(3)))
- continue
- return tuple(result)
-
- n1 = normalize(v1)
- n2 = normalize(v2)
-
- return (n1 > n2) - (n1 < n2)
-
-
-def _split_version_specifier(spec):
- """Splits version specifiers in the form ">= 0.1.2" into ('0.1.2', '>=')"""
- m = re.search(r'([<>=]?=?)?\s*([0-9.a-zA-Z]+)', spec)
- return m.group(2), m.group(1)
-
-
-def _convert_error(func):
- @wraps(func)
- def _wrapper(*args, **kwargs):
- try:
- return func(*args, **kwargs)
- except OSError as e:
- raise EnvironmentError("pkg-config probably not installed: %r" % e)
- return _wrapper
-
-
-def _build_options(option, static=False):
- return (option, '--static') if static else (option,)
-
-
-def _raise_if_not_exists(package):
- if not exists(package):
- raise PackageNotFoundError(package)
-
-
-@_convert_error
-def _query(package, *options):
- pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
- cmd = '{0} {1} {2}'.format(pkg_config_exe, ' '.join(options), package)
- proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)
- out, err = proc.communicate()
-
- return out.rstrip().decode('utf-8')
-
-
-@_convert_error
-def exists(package):
- """
- Return True if package information is available.
-
- If ``pkg-config`` not on path, raises ``EnvironmentError``.
- """
- pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
- cmd = '{0} --exists {1}'.format(pkg_config_exe, package).split()
- return call(cmd) == 0
-
-
-@_convert_error
-def requires(package):
- """
- Return a list of package names that is required by the package.
-
- If ``pkg-config`` not on path, raises ``EnvironmentError``.
- """
- return _query(package, '--print-requires').split('\n')
-
-
-def cflags(package):
- """
- Return the CFLAGS string returned by pkg-config.
-
- If ``pkg-config`` is not on path, raises ``EnvironmentError``.
- """
- _raise_if_not_exists(package)
- return _query(package, '--cflags')
-
-
-def modversion(package):
- """
- Return the version returned by pkg-config.
-
- If `pkg-config` is not in the path, raises ``EnvironmentError``.
- """
- _raise_if_not_exists(package)
- return _query(package, '--modversion')
-
-
-def libs(package, static=False):
- """
- Return the LDFLAGS string returned by pkg-config.
-
- The static specifier will also include libraries for static linking (i.e.,
- includes any private libraries).
- """
- _raise_if_not_exists(package)
- return _query(package, *_build_options('--libs', static=static))
-
-
-def variables(package):
- """
- Return a dictionary of all the variables defined in the .pc pkg-config file
- of 'package'.
- """
- _raise_if_not_exists(package)
- result = _query(package, '--print-variables')
- names = (x.strip() for x in result.split('\n') if x != '')
- return dict(((x, _query(package, '--variable={0}'.format(x)).strip()) for
x in names))
-
-
-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
- package 'foo':
-
- >>> installed('foo', '==0.1.2')
- True
- >>> installed('foo', '<0.1')
- False
- >>> installed('foo', '>= 0.0.4')
- True
-
- If ``pkg-config`` not on path, raises ``EnvironmentError``.
- """
- if not exists(package):
- return False
-
- number, comparator = _split_version_specifier(version)
- modversion = _query(package, '--modversion')
-
- try:
- result = _compare_versions(modversion, number)
- except ValueError:
- msg = "{0} is not a correct version specifier".format(version)
- raise ValueError(msg)
-
- if comparator in ('', '=', '=='):
- return result == 0
-
- if comparator == '>':
- return result > 0
-
- if comparator == '>=':
- return result >= 0
-
- if comparator == '<':
- return result < 0
-
- if comparator == '<=':
- return result <= 0
-
-
-_PARSE_MAP = {
- '-D': 'define_macros',
- '-I': 'include_dirs',
- '-L': 'library_dirs',
- '-l': 'libraries'
-}
-
-
-def parse(packages, static=False):
- """
- Parse the output from pkg-config about the passed package or packages.
-
- 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.
-
- 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``.
- """
- for package in packages.split():
- _raise_if_not_exists(package)
-
- out = _query(packages, *_build_options('--cflags --libs', static=static))
- out = out.replace('\\"', '')
- result = collections.defaultdict(list)
-
- for token in re.split(r'(?<!\\) ', out):
- key = _PARSE_MAP.get(token[:2])
- if key:
- result[key].append(token[2:].strip())
-
- def split(m):
- t = tuple(m.split('='))
- return t if len(t) > 1 else (t[0], None)
-
- result['define_macros'] = [split(m) for m in result['define_macros']]
-
- # only have members with values not being the empty list (which is default
- # anyway):
- return collections.defaultdict(list, ((k, v) for k, v in result.items() if
v))
-
-
-def configure_extension(ext, packages, static=False):
- """
- Append the ``--cflags`` and ``--libs`` of a space-separated list of
- *packages* to the ``extra_compile_args`` and ``extra_link_args`` of a
- distutils/setuptools ``Extension``.
- """
- for package in packages.split():
- _raise_if_not_exists(package)
-
- def query_and_extend(option, target):
- os_opts = ['--msvc-syntax'] if os.name == 'nt' else []
- flags = _query(packages, *os_opts, *_build_options(option,
static=static))
- target.extend(re.split(r'(?<!\\) ', flags.replace('\\"', '')))
-
- query_and_extend('--cflags', ext.extra_compile_args)
- query_and_extend('--libs', ext.extra_link_args)
-
-
-def list_all():
- """Return a list of all packages found by pkg-config."""
- packages = [line.split()[0] for line in _query('',
'--list-all').split('\n')]
- return packages
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/pyproject.toml
new/pkgconfig-1.6.0/pyproject.toml
--- old/pkgconfig-1.5.5/pyproject.toml 2021-07-19 20:48:48.000000000 +0200
+++ new/pkgconfig-1.6.0/pyproject.toml 2026-03-06 12:12:39.000000000 +0100
@@ -4,7 +4,7 @@
[tool.poetry]
name = "pkgconfig"
-version = "1.5.5"
+version = "1.6.0"
license = "MIT"
description = "Interface Python with pkg-config"
authors = ["Matthias Vogelgesang <[email protected]>"]
@@ -18,7 +18,24 @@
]
[tool.poetry.dependencies]
-python = "^3.3"
+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
+"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/setup.cfg
new/pkgconfig-1.6.0/setup.cfg
--- old/pkgconfig-1.5.5/setup.cfg 2021-07-19 20:48:48.000000000 +0200
+++ new/pkgconfig-1.6.0/setup.cfg 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-[pycodestyle]
-max-line-length = 119
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/src/pkgconfig/__init__.py
new/pkgconfig-1.6.0/src/pkgconfig/__init__.py
--- old/pkgconfig-1.5.5/src/pkgconfig/__init__.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/src/pkgconfig/__init__.py 2026-03-06
12:12:39.000000000 +0100
@@ -0,0 +1 @@
+from .pkgconfig import *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/src/pkgconfig/pkgconfig.py
new/pkgconfig-1.6.0/src/pkgconfig/pkgconfig.py
--- old/pkgconfig-1.5.5/src/pkgconfig/pkgconfig.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pkgconfig-1.6.0/src/pkgconfig/pkgconfig.py 2026-03-06
12:12:39.000000000 +0100
@@ -0,0 +1,293 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2013 Matthias Vogelgesang <[email protected]>
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# 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
+tool."""
+
+import os
+import shlex
+import re
+import collections
+from functools import wraps
+from subprocess import call, PIPE, Popen
+
+
+class PackageNotFoundError(Exception):
+ """
+ Raised if a package was not found.
+ """
+ def __init__(self, package):
+ message = '%s not found' % package
+ super(PackageNotFoundError, self).__init__(message)
+
+
+def _compare_versions(v1, v2):
+ """
+ Compare two version strings and return -1, 0 or 1 depending on the equality
+ of the subset of matching version numbers.
+
+ The implementation is inspired by the top answer at
+ http://stackoverflow.com/a/1714190/997768.
+ """
+ def normalize(v):
+ # strip trailing .0 or .00 or .0.0 or ...
+ v = re.sub(r'(\.0+)*$', '', v)
+ result = []
+ for part in v.split('.'):
+ # just digits
+ m = re.match(r'^(\d+)$', part)
+ if m:
+ result.append(int(m.group(1)))
+ continue
+ # digits letters
+ m = re.match(r'^(\d+)([a-zA-Z]+)$', part)
+ if m:
+ result.append(int(m.group(1)))
+ result.append(m.group(2))
+ continue
+ # digits letters digits
+ m = re.match(r'^(\d+)([a-zA-Z]+)(\d+)$', part)
+ if m:
+ result.append(int(m.group(1)))
+ result.append(m.group(2))
+ result.append(int(m.group(3)))
+ continue
+ return tuple(result)
+
+ n1 = normalize(v1)
+ n2 = normalize(v2)
+
+ return (n1 > n2) - (n1 < n2)
+
+
+def _split_version_specifier(spec):
+ """Splits version specifiers in the form ">= 0.1.2" into ('0.1.2', '>=')"""
+ m = re.search(r'([<>=]?=?)?\s*([0-9.a-zA-Z]+)', spec)
+ return m.group(2), m.group(1)
+
+
+def _convert_error(func):
+ @wraps(func)
+ def _wrapper(*args, **kwargs):
+ try:
+ return func(*args, **kwargs)
+ except OSError as e:
+ raise EnvironmentError("pkg-config probably not installed: %r" % e)
+ return _wrapper
+
+
+def _build_options(option, static=False):
+ return (option, '--static') if static else (option,)
+
+
+def _raise_if_not_exists(package):
+ if not exists(package):
+ raise PackageNotFoundError(package)
+
+
+@_convert_error
+def _query(package, *options):
+ pkg_config_exe = os.environ.get('PKG_CONFIG', None) or 'pkg-config'
+ cmd = '{0} {1} {2}'.format(pkg_config_exe, ' '.join(options), package)
+ proc = Popen(shlex.split(cmd), stdout=PIPE, stderr=PIPE)
+ out, err = proc.communicate()
+
+ return out.rstrip().decode('utf-8')
+
+
+@_convert_error
+def exists(package):
+ """
+ Return True if package information is available.
+
+ 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()
+ return call(cmd) == 0
+
+
+@_convert_error
+def requires(package):
+ """
+ Return a list of package names that are required by the package.
+
+ If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
+ """
+ return _query(package, '--print-requires').split('\n')
+
+
+def cflags(package):
+ """
+ Return the CFLAGS string returned by pkg-config.
+
+ If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
+ """
+ _raise_if_not_exists(package)
+ return _query(package, '--cflags')
+
+
+def modversion(package):
+ """
+ Return the version returned by pkg-config.
+
+ If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
+ """
+ _raise_if_not_exists(package)
+ return _query(package, '--modversion')
+
+
+def libs(package, static=False):
+ """
+ Return the LDFLAGS string returned by pkg-config.
+
+ The static specifier will also include libraries for static linking (i.e.,
+ includes any private libraries).
+ """
+ _raise_if_not_exists(package)
+ return _query(package, *_build_options('--libs', static=static))
+
+
+def variables(package):
+ """
+ Return a dictionary of all the variables defined in the .pc pkg-config file
+ of the package.
+ """
+ _raise_if_not_exists(package)
+ result = _query(package, '--print-variables')
+ names = (x.strip() for x in result.split('\n') if x != '')
+ return dict(((x, _query(package, '--variable={0}'.format(x)).strip()) for
x in names))
+
+
+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
comparisons
+ behave as you would expect. For example, for an installed version '0.1.2'
of
+ package 'foo':
+
+ >>> installed('foo', '==0.1.2')
+ True
+ >>> installed('foo', '<0.1')
+ False
+ >>> installed('foo', '>= 0.0.4')
+ True
+
+ If ``pkg-config`` is not on the PATH, an ``EnvironmentError`` is raised.
+ """
+ if not exists(package):
+ return False
+
+ number, comparator = _split_version_specifier(version)
+ modversion = _query(package, '--modversion')
+
+ try:
+ result = _compare_versions(modversion, number)
+ except ValueError:
+ msg = "{0} is not a correct version specifier".format(version)
+ raise ValueError(msg)
+
+ if comparator in ('', '=', '=='):
+ return result == 0
+
+ if comparator == '>':
+ return result > 0
+
+ if comparator == '>=':
+ return result >= 0
+
+ if comparator == '<':
+ return result < 0
+
+ if comparator == '<=':
+ return result <= 0
+
+
+_PARSE_MAP = {
+ '-D': 'define_macros',
+ '-I': 'include_dirs',
+ '-L': 'library_dirs',
+ '-l': 'libraries'
+}
+
+
+def parse(packages, static=False):
+ """
+ Parse the output from pkg-config about the passed package or packages.
+
+ Builds a dictionary containing the 'libraries', the 'library_dirs', the
+ 'include_dirs', and the 'define_macros' that are presented by pkg-config.
+ *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 the PATH, an ``EnvironmentError`` is raised.
+ """
+ for package in packages.split():
+ _raise_if_not_exists(package)
+
+ out = _query(packages, *_build_options('--cflags --libs', static=static))
+ out = out.replace('\\"', '')
+ result = collections.defaultdict(list)
+
+ for token in re.split(r'(?<!\\) ', out):
+ key = _PARSE_MAP.get(token[:2])
+ if key:
+ result[key].append(token[2:].strip())
+
+ def split(m):
+ t = tuple(m.split('='))
+ return t if len(t) > 1 else (t[0], None)
+
+ result['define_macros'] = [split(m) for m in result['define_macros']]
+
+ # only have members with values not being the empty list (which is default
+ # anyway):
+ return collections.defaultdict(list, ((k, v) for k, v in result.items() if
v))
+
+
+def configure_extension(ext, packages, static=False):
+ """
+ Append the ``--cflags`` and ``--libs`` of a space-separated list of
+ *packages* to the ``extra_compile_args`` and ``extra_link_args`` of a
+ distutils/setuptools ``Extension``.
+ """
+ for package in packages.split():
+ _raise_if_not_exists(package)
+
+ def query_and_extend(option, target):
+ os_opts = ['--msvc-syntax'] if os.name == 'nt' else []
+ flags = _query(packages, *os_opts, *_build_options(option,
static=static))
+ flags = flags.replace('\\"', '')
+ if flags:
+ target.extend(re.split(r'(?<!\\) ', flags))
+
+ query_and_extend('--cflags', ext.extra_compile_args)
+ query_and_extend('--libs', ext.extra_link_args)
+
+
+def list_all():
+ """Return a list of all packages found by pkg-config."""
+ packages = [line.split()[0] for line in _query('',
'--list-all').split('\n')]
+ return packages
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/test_pkgconfig.py
new/pkgconfig-1.6.0/test_pkgconfig.py
--- old/pkgconfig-1.5.5/test_pkgconfig.py 2021-07-19 20:48:48.000000000
+0200
+++ new/pkgconfig-1.6.0/test_pkgconfig.py 1970-01-01 01:00:00.000000000
+0100
@@ -1,167 +0,0 @@
-from distutils.core import Extension
-import os
-import pytest
-import pkgconfig
-
-os.environ['PKG_CONFIG_PATH'] = os.path.abspath('./data')
-PACKAGE_NAME = 'fake-gtk+-3.0'
-
-
-def test_exists():
- assert pkgconfig.exists(PACKAGE_NAME)
- assert pkgconfig.exists('fake-openssl')
-
-
[email protected]("version,expected", [
- ('3.2.1', True),
- ('==3.2.1', True),
- ('==3.2.2', False),
- ('> 2.2', True),
- ('> 3.4', False),
- ('<= 3.3.5', True),
- ('< 2.3', False),
-])
-def test_version(version, expected):
- assert pkgconfig.installed(PACKAGE_NAME, version) == expected
-
-
[email protected]("version,expected", [
- ('1.1.0j', True),
- ('==1.1.0j', True),
- ('==1.1.0k', False),
- ('>= 1.1.0', True),
- ('> 1.2.0', False),
- ('< 1.2.0', True),
- ('< 1.1.0', False),
- ('>= 1.1', True),
- ('> 1.2', False),
- ('< 1.2', True),
- ('< 1.1', False),
- ('>= 1.1.0c', True),
- ('>= 1.1.0k', False),
- # PLEASE NOTE:
- # the letters have no semantics, except string ordering, see also the
- # comment in the test below.
- # comparing release with beta, like "1.2.3" > "1.2.3b" does not work.
-])
-def test_openssl(version, expected):
- assert pkgconfig.installed('fake-openssl', version) == expected
-
-
[email protected]("version,expected", [
- ('1.2.3b4', True),
- ('==1.2.3b4', True),
- ('==1.2.3', False),
- ('>= 1.2.3b3', True),
- ('< 1.2.3b5', True),
- # 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
- # 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
- # 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.
-])
-def test_dld_pkg(version, expected):
- assert pkgconfig.installed('fake-dld-pkg', version) == expected
-
-
-def test_modversion():
- assert pkgconfig.modversion(PACKAGE_NAME) == '3.2.1'
- assert pkgconfig.modversion('fake-openssl') == '1.1.0j'
-
- with pytest.raises(pkgconfig.PackageNotFoundError):
- pkgconfig.modversion('doesnotexist')
-
-
-def test_cflags():
- flags = pkgconfig.cflags(PACKAGE_NAME)
-
- for flag in flags.split(' '):
- assert flag in ('-DGSEAL_ENABLE', '-I/usr/include/gtk-3.0')
-
- with pytest.raises(pkgconfig.PackageNotFoundError):
- pkgconfig.cflags('doesnotexist')
-
-
-def test_libs():
- flags = pkgconfig.libs(PACKAGE_NAME)
-
- for flag in flags.split(' '):
- assert flag in ('-L/usr/lib_gtk_foo', '-lgtk-3')
-
- with pytest.raises(pkgconfig.PackageNotFoundError):
- pkgconfig.libs('doesnotexist')
-
-
-def test_libs_static():
- flags = pkgconfig.libs('fake-python', static=True)
- flags = flags.split(' ')
- assert '-lpthread' in flags
- assert '-ldl' in flags
- assert '-lutil' in flags
-
-
-def test_parse():
- config = pkgconfig.parse("fake-gtk+-3.0 fake-python")
-
- assert ('GSEAL_ENABLE', None) in config['define_macros']
- assert '/usr/include/gtk-3.0' in config['include_dirs']
- assert '/usr/lib_gtk_foo' in config['library_dirs']
- assert '/usr/lib_python_foo' in config['library_dirs']
- assert 'gtk-3' in config['libraries']
-
- assert '/usr/include/python2.7' in config['include_dirs']
-
- with pytest.raises(pkgconfig.PackageNotFoundError):
- pkgconfig.parse('doesnotexist')
-
-
-def test_parse_static():
- config = pkgconfig.parse("fake-python", static=True)
- assert '/usr/lib_python_foo' in config['library_dirs']
- assert '/usr/include/python2.7' in config['include_dirs']
- assert 'python2.7' in config['libraries']
- assert 'pthread' in config['libraries']
- assert 'dl' in config['libraries']
- assert 'util' in config['libraries']
-
-
-def test_configure_extension():
- ext = Extension('foo', ['foo.c'])
- pkgconfig.configure_extension(ext, 'fake-gtk+-3.0 fake-python')
- assert sorted(ext.extra_compile_args) == [
- '-DGSEAL_ENABLE', '-I/usr/include/gtk-3.0','-I/usr/include/python2.7']
- assert sorted(ext.extra_link_args) == [
- '-L/usr/lib_gtk_foo', '-L/usr/lib_python_foo', '-lgtk-3',
'-lpython2.7']
-
-
-def test_listall():
- packages = pkgconfig.list_all()
- assert 'fake-gtk+-3.0' in packages
- assert 'fake-python' in packages
-
-
-def test_variables():
- variables = pkgconfig.variables('fake-python')
-
- assert 'prefix' in variables
- assert 'exec_prefix' in variables
- assert 'libdir' in variables
- assert 'includedir' in variables
-
- assert variables['prefix'] == '/usr'
- assert variables['exec_prefix'] == '/usr'
- assert variables['libdir'] == '/usr/lib_python_foo'
- assert variables['includedir'] == '/usr/include'
-
- with pytest.raises(pkgconfig.PackageNotFoundError):
- pkgconfig.variables('doesnotexist')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pkgconfig-1.5.5/tox.ini new/pkgconfig-1.6.0/tox.ini
--- old/pkgconfig-1.5.5/tox.ini 2021-07-19 20:48:48.000000000 +0200
+++ new/pkgconfig-1.6.0/tox.ini 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-[tox]
-envlist = py{26,27,33,34,35,36,37}
-
-[testenv]
-deps = pytest
-commands= pytest