@@ -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
@@ -930,7 +937,8 @@ class FreeType(SetupPackage):
930
937
931
938
def check (self ):
932
939
if sys .platform == 'win32' :
933
- return "Unknown version"
940
+ check_include_file (get_include_dirs (), 'ft2build.h' , 'freetype' )
941
+ return 'Using unknown version found on system.'
934
942
935
943
status , output = getstatusoutput ("freetype-config --ftversion" )
936
944
if status == 0 :
@@ -1007,7 +1015,8 @@ class Png(SetupPackage):
1007
1015
1008
1016
def check (self ):
1009
1017
if sys .platform == 'win32' :
1010
- return "Unknown version"
1018
+ check_include_file (get_include_dirs (), 'png.h' , 'png' )
1019
+ return 'Using unknown version found on system.'
1011
1020
1012
1021
status , output = getstatusoutput ("libpng-config --version" )
1013
1022
if status == 0 :
@@ -1020,9 +1029,7 @@ def check(self):
1020
1029
'libpng' , 'png.h' ,
1021
1030
min_version = '1.2' , version = version )
1022
1031
except CheckFailed as e :
1023
- include_dirs = [
1024
- os .path .join (dir , 'include' ) for dir in get_base_dirs ()]
1025
- if has_include_file (include_dirs , 'png.h' ):
1032
+ if has_include_file (get_include_dirs (), 'png.h' ):
1026
1033
return str (e ) + ' Using unknown version found on system.'
1027
1034
raise
1028
1035
@@ -1053,7 +1060,7 @@ def check(self):
1053
1060
# present on this system, so check if the header files can be
1054
1061
# found.
1055
1062
include_dirs = [
1056
- os .path .join (x , 'include' , ' qhull' ) for x in get_base_dirs ()]
1063
+ os .path .join (x , 'qhull' ) for x in get_include_dirs ()]
1057
1064
if has_include_file (include_dirs , 'qhull_a.h' ):
1058
1065
return 'Using system Qhull (version unknown, no pkg-config info)'
1059
1066
else :
0 commit comments