Skip to content

Commit

Permalink
Prefer vendored qhull if sys-wide version can't be determined.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anntzer committed Dec 22, 2017
1 parent 207b9a7 commit 927c281
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions setupext.py
Expand Up @@ -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',
Expand Down Expand Up @@ -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')))


Expand All @@ -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


Expand Down Expand Up @@ -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'])
Expand Down

0 comments on commit 927c281

Please sign in to comment.