@@ -160,7 +160,7 @@ def add_to_config_c(source_path: pathlib.Path, extension: str, init_fn: str):
160
160
161
161
lines = []
162
162
163
- with config_c_path .open ('r' ) as fh :
163
+ with config_c_path .open ('r' , encoding = 'utf8' ) as fh :
164
164
for line in fh :
165
165
line = line .rstrip ()
166
166
@@ -176,7 +176,7 @@ def add_to_config_c(source_path: pathlib.Path, extension: str, init_fn: str):
176
176
177
177
lines .append (line )
178
178
179
- with config_c_path .open ('w' ) as fh :
179
+ with config_c_path .open ('w' , encoding = 'utf8' ) as fh :
180
180
fh .write ('\n ' .join (lines ))
181
181
182
182
@@ -193,7 +193,7 @@ def remove_from_extension_modules(source_path: pathlib.Path, extension: str):
193
193
194
194
lines = []
195
195
196
- with pcbuild_proj_path .open ('r' ) as fh :
196
+ with pcbuild_proj_path .open ('r' , encoding = 'utf8' ) as fh :
197
197
for line in fh :
198
198
line = line .rstrip ()
199
199
@@ -210,7 +210,7 @@ def remove_from_extension_modules(source_path: pathlib.Path, extension: str):
210
210
211
211
lines .append (line )
212
212
213
- with pcbuild_proj_path .open ('w' ) as fh :
213
+ with pcbuild_proj_path .open ('w' , encoding = 'utf8' ) as fh :
214
214
fh .write ('\n ' .join (lines ))
215
215
216
216
@@ -223,7 +223,7 @@ def make_project_static_library(source_path: pathlib.Path, project: str):
223
223
found_config_type = False
224
224
found_target_ext = False
225
225
226
- with proj_path .open ('r' ) as fh :
226
+ with proj_path .open ('r' , encoding = 'utf8' ) as fh :
227
227
for line in fh :
228
228
line = line .rstrip ()
229
229
@@ -254,7 +254,7 @@ def make_project_static_library(source_path: pathlib.Path, project: str):
254
254
log ('failed to adjust target extension for %s' % project )
255
255
sys .exit (1 )
256
256
257
- with proj_path .open ('w' ) as fh :
257
+ with proj_path .open ('w' , encoding = 'utf8' ) as fh :
258
258
fh .write ('\n ' .join (lines ))
259
259
260
260
@@ -281,7 +281,7 @@ def convert_to_static_library(source_path: pathlib.Path, extension: str, entry:
281
281
itemgroup_line = None
282
282
itemdefinitiongroup_line = None
283
283
284
- with proj_path .open ('r' ) as fh :
284
+ with proj_path .open ('r' , encoding = 'utf8' ) as fh :
285
285
for i , line in enumerate (fh ):
286
286
line = line .rstrip ()
287
287
@@ -362,7 +362,7 @@ def convert_to_static_library(source_path: pathlib.Path, extension: str, entry:
362
362
363
363
lines = lines [:start_line ] + lines [end_line + 1 :]
364
364
365
- with proj_path .open ('w' ) as fh :
365
+ with proj_path .open ('w' , encoding = 'utf8' ) as fh :
366
366
fh .write ('\n ' .join (lines ))
367
367
368
368
# Tell pythoncore to link against the static .lib.
@@ -371,7 +371,7 @@ def convert_to_static_library(source_path: pathlib.Path, extension: str, entry:
371
371
pythoncore_path = source_path / 'PCbuild' / 'pythoncore.vcxproj'
372
372
lines = []
373
373
374
- with pythoncore_path .open ('r' ) as fh :
374
+ with pythoncore_path .open ('r' , encoding = 'utf8' ) as fh :
375
375
for line in fh :
376
376
line = line .rstrip ()
377
377
@@ -389,7 +389,7 @@ def convert_to_static_library(source_path: pathlib.Path, extension: str, entry:
389
389
390
390
lines .append (line )
391
391
392
- with pythoncore_path .open ('w' ) as fh :
392
+ with pythoncore_path .open ('w' , encoding = 'utf8' ) as fh :
393
393
fh .write ('\n ' .join (lines ))
394
394
395
395
# Change pythoncore to depend on the extension project.
@@ -401,13 +401,13 @@ def convert_to_static_library(source_path: pathlib.Path, extension: str, entry:
401
401
402
402
pcbuild_proj_path = source_path / 'PCbuild' / 'pcbuild.proj'
403
403
404
- with pcbuild_proj_path .open ('r' ) as fh :
404
+ with pcbuild_proj_path .open ('r' , encoding = 'utf8' ) as fh :
405
405
data = fh .read ()
406
406
407
407
data = data .replace ('<Projects Include="pythoncore.vcxproj">' ,
408
408
' <Projects Include="%s.vcxproj" />\n <Projects Include="pythoncore.vcxproj">' % extension )
409
409
410
- with pcbuild_proj_path .open ('w' ) as fh :
410
+ with pcbuild_proj_path .open ('w' , encoding = 'utf8' ) as fh :
411
411
fh .write (data )
412
412
413
413
# We don't technically need to modify the solution since msbuild doesn't
@@ -421,7 +421,7 @@ def convert_to_static_library(source_path: pathlib.Path, extension: str, entry:
421
421
extension_id = None
422
422
pythoncore_line = None
423
423
424
- with pcbuild_sln_path .open ('r' ) as fh :
424
+ with pcbuild_sln_path .open ('r' , encoding = 'utf8' ) as fh :
425
425
# First pass buffers the file, finds the ID of the extension project,
426
426
# and finds where the pythoncore project is defined.
427
427
for i , line in enumerate (fh ):
@@ -457,7 +457,7 @@ def convert_to_static_library(source_path: pathlib.Path, extension: str, entry:
457
457
lines .insert (pythoncore_line + 1 , '\t ProjectSection(ProjectDependencies) = postProject' )
458
458
lines .insert (pythoncore_line + 3 , '\t EndProjectSection' )
459
459
460
- with pcbuild_sln_path .open ('w' ) as fh :
460
+ with pcbuild_sln_path .open ('w' , encoding = 'utf8' ) as fh :
461
461
fh .write ('\n ' .join (lines ))
462
462
463
463
@@ -468,7 +468,7 @@ def copy_link_to_lib(p: pathlib.Path):
468
468
copy_lines = []
469
469
copy_active = False
470
470
471
- with p .open ('r' ) as fh :
471
+ with p .open ('r' , encoding = 'utf8' ) as fh :
472
472
for line in fh :
473
473
line = line .rstrip ()
474
474
@@ -489,7 +489,7 @@ def copy_link_to_lib(p: pathlib.Path):
489
489
if copy_active :
490
490
copy_lines .append (line )
491
491
492
- with p .open ('w' ) as fh :
492
+ with p .open ('w' , encoding = 'utf8' ) as fh :
493
493
fh .write ('\n ' .join (lines ))
494
494
495
495
@@ -1106,7 +1106,7 @@ def process_project(project: pathlib.Path, dest_dir: pathlib.Path):
1106
1106
def find_additional_dependencies (project : pathlib .Path ):
1107
1107
vcproj = pcbuild_path / ('%s.vcxproj' % project )
1108
1108
1109
- with vcproj .open ('r' ) as fh :
1109
+ with vcproj .open ('r' , encoding = 'utf8' ) as fh :
1110
1110
for line in fh :
1111
1111
m = RE_ADDITIONAL_DEPENDENCIES .search (line )
1112
1112
@@ -1259,7 +1259,7 @@ def build_cpython(pgo=False):
1259
1259
# Parse config.c before we hack it up: we want a pristine copy.
1260
1260
config_c_path = cpython_source_path / 'PC' / 'config.c'
1261
1261
1262
- with config_c_path .open ('r' ) as fh :
1262
+ with config_c_path .open ('r' , encoding = 'utf8' ) as fh :
1263
1263
config_c = fh .read ()
1264
1264
1265
1265
builtin_extensions = parse_config_c (config_c )
@@ -1361,7 +1361,7 @@ def build_cpython(pgo=False):
1361
1361
'build_info' : build_info ,
1362
1362
}
1363
1363
1364
- with (out_dir / 'python' / 'PYTHON.json' ).open ('w' ) as fh :
1364
+ with (out_dir / 'python' / 'PYTHON.json' ).open ('w' , encoding = 'utf8' ) as fh :
1365
1365
json .dump (python_info , fh , sort_keys = True , indent = 4 )
1366
1366
1367
1367
# Copy software licenses file.
0 commit comments