From 927c2819cbad053ed68958a21670e1c5c64bf698 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 21 Dec 2017 22:47:44 -0800 Subject: [PATCH] Prefer vendored qhull if sys-wide version can't be determined. 1. When qhull is available system-wide but its version cannot be determined, ignore it (there is no guarantee that it will, in fact, work) and fallback to the vendored version. 2. When adding header paths to vendored libraries, prepend the paths to give them higher priority than /usr/{,local/}include. (In reality we should just not add the system /usr/{,local/}include paths to the compiler invocations at all, but that's a more complicated patch. --- setupext.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/setupext.py b/setupext.py index 583ccfeea388..314406f9d3ed 100644 --- a/setupext.py +++ b/setupext.py @@ -1033,7 +1033,7 @@ def add_flags(self, ext, add_sources=True): if self.found_external: pkg_config.setup_extension(ext, 'libagg') else: - ext.include_dirs.append('extern/agg24-svn/include') + ext.include_dirs.insert(0, 'extern/agg24-svn/include') if add_sources: agg_sources = [ 'agg_bezier_arc.cpp', @@ -1348,23 +1348,15 @@ def check(self): 'libqhull', 'libqhull/qhull_a.h', min_version='2015.2') except CheckFailed as e: self.__class__.found_pkgconfig = False - # Qhull may not be in the pkg-config system but may still be - # present on this system, so check if the header files can be - # found. - include_dirs = [ - os.path.join(x, 'libqhull') for x in get_include_dirs()] - if has_include_file(include_dirs, 'qhull_a.h'): - return 'Using system Qhull (version unknown, no pkg-config info)' - else: - self.__class__.found_external = False - return str(e) + ' Using local copy.' + self.__class__.found_external = False + return str(e) + ' Using local copy.' def add_flags(self, ext): if self.found_external: pkg_config.setup_extension(ext, 'qhull', default_libraries=['qhull']) else: - ext.include_dirs.append('extern') + ext.include_dirs.insert(0, 'extern') ext.sources.extend(sorted(glob.glob('extern/libqhull/*.c'))) @@ -1380,7 +1372,7 @@ def get_extension(self): ] ext = make_extension('matplotlib.ttconv', sources) Numpy().add_flags(ext) - ext.include_dirs.append('extern') + ext.include_dirs.insert(0, 'extern') return ext @@ -1536,7 +1528,7 @@ def get_extension(self): return ext def add_flags(self, ext): - ext.include_dirs.extend(['src']) + ext.include_dirs.insert(0, 'src') if sys.platform == 'win32': # PSAPI library needed for finding Tcl / Tk at run time ext.libraries.extend(['psapi'])