Skip to content

Commit 91e1e83

Browse files
committed
Decouple the extra 'nl-route-3' library from the logic
1 parent 1569d0d commit 91e1e83

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

setup.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@
1818
class PkgConfigExtension(Extension):
1919
'''Extension with lazy properties taken from pkg-config'''
2020
def __init__(self, *args, **kwargs):
21-
pkg = kwargs['pkg']
21+
self._pkg = kwargs['pkg']
2222
del kwargs['pkg']
23+
if 'extra_libraries' in kwargs:
24+
self._extra_libraries = kwargs['extra_libraries']
25+
del kwargs['extra_libraries']
26+
else:
27+
self._extra_libraries = []
28+
2329
Extension.__init__(self, *args, **kwargs)
30+
2431
try:
2532
# on Python 2 we need to delete those now
2633
del self.include_dirs
@@ -29,7 +36,6 @@ def __init__(self, *args, **kwargs):
2936
except AttributeError:
3037
# on Python 3, that's not needed or possible
3138
pass
32-
self._pkg = pkg
3339

3440
@classmethod
3541
def _str2list(cls, pkgstr, onlystr):
@@ -61,7 +67,7 @@ def libraries(self):
6167
if res != 0:
6268
print('Failed to query pkg-config --libs-only-l %s' % self._pkg)
6369
sys.exit(1)
64-
return self._str2list(libs, '-l') + ['nl-route-3']
70+
return self._str2list(libs, '-l') + self._extra_libraries
6571

6672
@include_dirs.setter
6773
def include_dirs(self, value):
@@ -121,6 +127,7 @@ def libraries(self, value):
121127
extra_compile_args=['-fno-strict-aliasing'],
122128
define_macros = [('VERSION', '"%s"' % version)],
123129
pkg = 'libnl-3.0',
130+
extra_libraries = ['nl-route-3'],
124131
)
125132
]
126133
)

0 commit comments

Comments
 (0)