Skip to content
Open
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
14 changes: 10 additions & 4 deletions pkgconfig/pkgconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,17 @@ def requires(package):
return _query(package, '--print-requires').split('\n')


def cflags(package):
def cflags(package, keep_system=False):
"""
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')
option = "--cflags"
if keep_system:
option += " --keep-system-cflags"
return _query(package, option)


def modversion(package):
Expand All @@ -155,15 +158,18 @@ def modversion(package):
return _query(package, '--modversion')


def libs(package, static=False):
def libs(package, static=False, keep_system=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))
option = "--libs"
if keep_system:
option += " --keep-system-libs"
return _query(package, *_build_options(option, static=static))


def variables(package):
Expand Down