@@ -120,6 +120,8 @@ def has_include_file(include_dirs, filename):
120
120
Returns `True` if `filename` can be found in one of the
121
121
directories in `include_dirs`.
122
122
"""
123
+ if sys .platform == 'win32' :
124
+ include_dirs += os .environ .get ('INCLUDE' , '.' ).split (';' )
123
125
for dir in include_dirs :
124
126
if os .path .exists (os .path .join (dir , filename )):
125
127
return True
@@ -130,8 +132,6 @@ def check_include_file(include_dirs, filename, package):
130
132
"""
131
133
Raises an exception if the given include file can not be found.
132
134
"""
133
- if sys .platform == 'win32' :
134
- include_dirs .extend (os .getenv ('INCLUDE' , '.' ).split (';' ))
135
135
if not has_include_file (include_dirs , filename ):
136
136
raise CheckFailed (
137
137
"The C/C++ header for %s (%s) could not be found. You "
@@ -156,6 +156,13 @@ def get_base_dirs():
156
156
return basedir_map .get (sys .platform , ['/usr/local' , '/usr' ])
157
157
158
158
159
+ def get_include_dirs ():
160
+ """
161
+ Returns a list of standard include directories on this platform.
162
+ """
163
+ return [os .path .join (d , 'include' ) for d in get_base_dirs ()]
164
+
165
+
159
166
def is_min_version (found , minversion ):
160
167
"""
161
168
Returns `True` if `found` is at least as high a version as
@@ -927,7 +934,8 @@ class FreeType(SetupPackage):
927
934
928
935
def check (self ):
929
936
if sys .platform == 'win32' :
930
- return "Unknown version"
937
+ check_include_file (get_include_dirs (), 'ft2build.h' , 'freetype' )
938
+ return 'Using unknown version found on system.'
931
939
932
940
status , output = getstatusoutput ("freetype-config --ftversion" )
933
941
if status == 0 :
@@ -1004,7 +1012,8 @@ class Png(SetupPackage):
1004
1012
1005
1013
def check (self ):
1006
1014
if sys .platform == 'win32' :
1007
- return "Unknown version"
1015
+ check_include_file (get_include_dirs (), 'png.h' , 'png' )
1016
+ return 'Using unknown version found on system.'
1008
1017
1009
1018
status , output = getstatusoutput ("libpng-config --version" )
1010
1019
if status == 0 :
@@ -1017,9 +1026,7 @@ def check(self):
1017
1026
'libpng' , 'png.h' ,
1018
1027
min_version = '1.2' , version = version )
1019
1028
except CheckFailed as e :
1020
- include_dirs = [
1021
- os .path .join (dir , 'include' ) for dir in get_base_dirs ()]
1022
- if has_include_file (include_dirs , 'png.h' ):
1029
+ if has_include_file (get_include_dirs (), 'png.h' ):
1023
1030
return str (e ) + ' Using unknown version found on system.'
1024
1031
raise
1025
1032
@@ -1050,7 +1057,7 @@ def check(self):
1050
1057
# present on this system, so check if the header files can be
1051
1058
# found.
1052
1059
include_dirs = [
1053
- os .path .join (x , 'include' , ' qhull' ) for x in get_base_dirs ()]
1060
+ os .path .join (x , 'qhull' ) for x in get_include_dirs ()]
1054
1061
if has_include_file (include_dirs , 'qhull_a.h' ):
1055
1062
return 'Using system Qhull (version unknown, no pkg-config info)'
1056
1063
else :
0 commit comments