@@ -288,7 +288,8 @@ def setup_extension(self, ext, package, default_include_dirs=[],
288
288
command = "{0} --libs --cflags " .format (executable )
289
289
290
290
try :
291
- output = check_output (command , shell = True )
291
+ output = check_output (command , shell = True ,
292
+ stderr = subprocess .STDOUT )
292
293
except subprocess .CalledProcessError :
293
294
pass
294
295
else :
@@ -310,7 +311,7 @@ def setup_extension(self, ext, package, default_include_dirs=[],
310
311
dir = os .path .join (base , lib )
311
312
if os .path .exists (dir ):
312
313
ext .library_dirs .append (dir )
313
- ext .libraries = default_libraries
314
+ ext .libraries . extend ( default_libraries )
314
315
return True
315
316
316
317
return False
@@ -328,6 +329,7 @@ def get_version(self, package):
328
329
return output
329
330
return None
330
331
332
+
331
333
# The PkgConfig class should be used through this singleton
332
334
pkg_config = PkgConfig ()
333
335
@@ -409,13 +411,17 @@ def _check_for_pkg_config(self, package, include_file, min_version=None,
409
411
if version is None :
410
412
version = pkg_config .get_version (package )
411
413
414
+ if version is None :
415
+ raise CheckFailed (
416
+ "pkg-config information for '%s' could not be found" %
417
+ package )
418
+
412
419
if min_version == 'PATCH' :
413
420
raise CheckFailed (
414
421
"Requires patches that have not been merged upstream." )
415
422
416
423
if min_version :
417
- if (version is not None and
418
- not is_min_version (version , min_version )):
424
+ if (not is_min_version (version , min_version )):
419
425
raise CheckFailed (
420
426
"Requires %s %s or later. Found %s." %
421
427
(package , min_version , version ))
@@ -672,8 +678,17 @@ def check(self):
672
678
return self ._check_for_pkg_config (
673
679
'PyCXX' , 'CXX/Extensions.hxx' , min_version = '6.2.4' )
674
680
except CheckFailed as e :
675
- self .__class__ .found_external = False
676
- return str (e ) + ' Using local copy.'
681
+ # Since there is no .pc file for PyCXX upstream, many
682
+ # distros don't package it either. We don't necessarily
683
+ # need to fall back to a local build in that scenario if
684
+ # the header files can be found.
685
+ base_include_dirs = [
686
+ os .path .join (x , 'include' ) for x in get_base_dirs ()]
687
+ if has_include_file (base_include_dirs , 'CXX/Extensions.hxx' ):
688
+ return 'Using system CXX (version unknown, no pkg-config info)'
689
+ else :
690
+ self .__class__ .found_external = False
691
+ return str (e ) + ' Using local copy.'
677
692
678
693
def add_flags (self , ext ):
679
694
if self .found_external :
0 commit comments