@@ -281,7 +281,8 @@ def setup_extension(self, ext, package, default_include_dirs=[],
281
281
use_defaults = True
282
282
if self .has_pkgconfig :
283
283
try :
284
- output = check_output (command , shell = True )
284
+ output = check_output (command , shell = True ,
285
+ stderr = subprocess .STDOUT )
285
286
except subprocess .CalledProcessError :
286
287
pass
287
288
else :
@@ -303,7 +304,7 @@ def setup_extension(self, ext, package, default_include_dirs=[],
303
304
dir = os .path .join (base , lib )
304
305
if os .path .exists (dir ):
305
306
ext .library_dirs .append (dir )
306
- ext .libraries = default_libraries
307
+ ext .libraries . extend ( default_libraries )
307
308
return True
308
309
309
310
return False
@@ -321,6 +322,7 @@ def get_version(self, package):
321
322
return output
322
323
return None
323
324
325
+
324
326
# The PkgConfig class should be used through this singleton
325
327
pkg_config = PkgConfig ()
326
328
@@ -402,13 +404,17 @@ def _check_for_pkg_config(self, package, include_file, min_version=None,
402
404
if version is None :
403
405
version = pkg_config .get_version (package )
404
406
407
+ if version is None :
408
+ raise CheckFailed (
409
+ "pkg-config information for '%s' could not be found" %
410
+ package )
411
+
405
412
if min_version == 'PATCH' :
406
413
raise CheckFailed (
407
414
"Requires patches that have not been merged upstream." )
408
415
409
416
if min_version :
410
- if (version is not None and
411
- not is_min_version (version , min_version )):
417
+ if (not is_min_version (version , min_version )):
412
418
raise CheckFailed (
413
419
"Requires %s %s or later. Found %s." %
414
420
(package , min_version , version ))
@@ -665,8 +671,17 @@ def check(self):
665
671
return self ._check_for_pkg_config (
666
672
'PyCXX' , 'CXX/Extensions.hxx' , min_version = '6.2.4' )
667
673
except CheckFailed as e :
668
- self .__class__ .found_external = False
669
- return str (e ) + ' Using local copy.'
674
+ # Since there is no .pc file for PyCXX upstream, many
675
+ # distros don't package it either. We don't necessarily
676
+ # need to fall back to a local build in that scenario if
677
+ # the header files can be found.
678
+ base_include_dirs = [
679
+ os .path .join (x , 'include' ) for x in get_base_dirs ()]
680
+ if has_include_file (base_include_dirs , 'CXX/Extensions.hxx' ):
681
+ return 'Using system CXX (version unknown, no pkg-config info)'
682
+ else :
683
+ self .__class__ .found_external = False
684
+ return str (e ) + ' Using local copy.'
670
685
671
686
def add_flags (self , ext ):
672
687
if self .found_external :
0 commit comments