summaryrefslogtreecommitdiff
path: root/cffi/api.py
diff options
context:
space:
mode:
authorMichal Vyskocil <michal.vyskocil@gmail.com>2017-05-22 23:49:09 +0200
committerMichal Vyskocil <michal.vyskocil@gmail.com>2017-05-22 23:49:09 +0200
commit452dab22a065ed62230e07bfd21d1961aacc1a9d (patch)
tree78919a3bd69585d0f72515807976d11d0cfb4fa7 /cffi/api.py
parent594c8e7358b9e025a459dc2d9618e01fea448593 (diff)
downloadcffi-452dab22a065ed62230e07bfd21d1961aacc1a9d.tar.gz
Passing of proper CFLAGS/CXXFLAGS/LDFLAGS is hard and error prone
Add pkg-config wrapper, which is the cross-platform tool telling exactly this.
Diffstat (limited to 'cffi/api.py')
-rw-r--r--cffi/api.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/cffi/api.py b/cffi/api.py
index 502b376..9e5412c 100644
--- a/cffi/api.py
+++ b/cffi/api.py
@@ -2,6 +2,7 @@ import sys, types
from .lock import allocate_lock
from .error import CDefError
from . import model
+from .pkgconfig import pkgconfig_installed, merge_dicts, pkgconfig_kwargs
try:
callable
@@ -611,6 +612,18 @@ class FFI(object):
if os.sep in module_name or (os.altsep and os.altsep in module_name):
raise ValueError("'module_name' must not contain '/': use a dotted "
"name to make a 'package.module' location")
+ if "pkgconfig" in kwds:
+ if pkgconfig_installed ():
+ try:
+ del kwds ["libraries"]
+ except KeyError:
+ pass
+ merge_dicts (kwds, pkgconfig_kwargs (kwds ["pkgconfig"]))
+ try:
+ del kwds ["pkgconfig"]
+ except KeyError:
+ pass
+ print (kwds)
self._assigned_source = (str(module_name), source,
source_extension, kwds)