@@ -147,12 +147,24 @@ def extract(self, overwrite=True):
147
147
for line in lines :
148
148
fd .write (line .replace (oldtext , newtext ).encode ())
149
149
150
- # The SVN revision file is not created on the fly before 3.6.0.
151
- svn_hfile = os .path .join (zipfold , "geos_svn_revision.h" )
152
- if self .version_tuple < (3 , 6 , 0 ) and not os .path .exists (svn_hfile ):
153
- with io .open (svn_hfile , "wb" ) as fd :
154
- text = "#define GEOS_SVN_REVISION 0"
155
- fd .write (text .encode ())
150
+ # Apply specific patches for GEOS < 3.6.0.
151
+ if self .version_tuple < (3 , 6 , 0 ):
152
+ # The SVN revision file is not created on the fly before 3.6.0.
153
+ svn_hfile = os .path .join (zipfold , "geos_svn_revision.h" )
154
+ if not os .path .exists (svn_hfile ):
155
+ with io .open (svn_hfile , "wb" ) as fd :
156
+ text = "#define GEOS_SVN_REVISION 0"
157
+ fd .write (text .encode ())
158
+ # Reduce warnings when compiling with `nmake` on Windows.
159
+ cmakefile = os .path .join (zipfold , "CMakeLists.txt" )
160
+ if os .path .exists (cmakefile ):
161
+ with io .open (cmakefile , "r" , encoding = "utf-8" ) as fd :
162
+ lines = fd .readlines ()
163
+ with io .open (cmakefile , "wb" ) as fd :
164
+ oldtext = 'string(REGEX REPLACE "/W[0-9]" "/W4"'
165
+ newtext = oldtext .replace ("W4" , "W1" )
166
+ for line in lines :
167
+ fd .write (line .replace (oldtext , newtext ).encode ())
156
168
157
169
def build (self , installdir = None , njobs = 1 ):
158
170
"""Build and install GEOS from source."""
@@ -191,7 +203,7 @@ def build(self, installdir=None, njobs=1):
191
203
build_opts .extend ([
192
204
"--" ,
193
205
"WIN64={0}" .format ("YES" if win64 else "NO" ),
194
- "BUILD_BATCH={0}" .format ("YES" if njobs > 1 else "NO" )
206
+ "BUILD_BATCH={0}" .format ("YES" if njobs > 1 else "NO" ),
195
207
])
196
208
else :
197
209
build_opts = ["-j" , "{0:d}" .format (njobs )] + build_opts
0 commit comments