Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setupext [backport to 1.4.x] #3510

Merged
merged 1 commit into from Sep 18, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 15 additions & 8 deletions setupext.py
Expand Up @@ -120,6 +120,8 @@ def has_include_file(include_dirs, filename):
Returns `True` if `filename` can be found in one of the
directories in `include_dirs`.
"""
if sys.platform == 'win32':
include_dirs += os.environ.get('INCLUDE', '.').split(';')
for dir in include_dirs:
if os.path.exists(os.path.join(dir, filename)):
return True
Expand All @@ -130,8 +132,6 @@ def check_include_file(include_dirs, filename, package):
"""
Raises an exception if the given include file can not be found.
"""
if sys.platform == 'win32':
include_dirs.extend(os.getenv('INCLUDE', '.').split(';'))
if not has_include_file(include_dirs, filename):
raise CheckFailed(
"The C/C++ header for %s (%s) could not be found. You "
Expand All @@ -156,6 +156,13 @@ def get_base_dirs():
return basedir_map.get(sys.platform, ['/usr/local', '/usr'])


def get_include_dirs():
"""
Returns a list of standard include directories on this platform.
"""
return [os.path.join(d, 'include') for d in get_base_dirs()]


def is_min_version(found, minversion):
"""
Returns `True` if `found` is at least as high a version as
Expand Down Expand Up @@ -927,7 +934,8 @@ class FreeType(SetupPackage):

def check(self):
if sys.platform == 'win32':
return "Unknown version"
check_include_file(get_include_dirs(), 'ft2build.h', 'freetype')
return 'Using unknown version found on system.'

status, output = getstatusoutput("freetype-config --ftversion")
if status == 0:
Expand Down Expand Up @@ -1004,7 +1012,8 @@ class Png(SetupPackage):

def check(self):
if sys.platform == 'win32':
return "Unknown version"
check_include_file(get_include_dirs(), 'png.h', 'png')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged all of the other branches up into master. This seems to have introduced a conflict here. Can you rebase this PR?

return 'Using unknown version found on system.'

status, output = getstatusoutput("libpng-config --version")
if status == 0:
Expand All @@ -1017,9 +1026,7 @@ def check(self):
'libpng', 'png.h',
min_version='1.2', version=version)
except CheckFailed as e:
include_dirs = [
os.path.join(dir, 'include') for dir in get_base_dirs()]
if has_include_file(include_dirs, 'png.h'):
if has_include_file(get_include_dirs(), 'png.h'):
return str(e) + ' Using unknown version found on system.'
raise

Expand Down Expand Up @@ -1050,7 +1057,7 @@ def check(self):
# present on this system, so check if the header files can be
# found.
include_dirs = [
os.path.join(x, 'include', 'qhull') for x in get_base_dirs()]
os.path.join(x, 'qhull') 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:
Expand Down