@@ -179,7 +179,7 @@ def get_version_info(module_version_string="", silent=False):
179
179
gitfolder = ".git"
180
180
181
181
if os .path .isfile (".git" ):
182
- with open (".git" , "r" ) as file :
182
+ with open (".git" , "r" , encoding = "utf-8" ) as file :
183
183
module_folder = file .readline ().strip ()
184
184
if module_folder .startswith ("gitdir: " ):
185
185
gitfolder = module_folder [8 :]
@@ -196,12 +196,12 @@ def get_version_info(module_version_string="", silent=False):
196
196
head = os .path .join (gitfolder , ref )
197
197
packedrefs = os .path .join (gitfolder , "packed-refs" )
198
198
if os .path .isfile (head ):
199
- with open (head , "r" ) as file :
199
+ with open (head , "r" , encoding = "utf-8" ) as file :
200
200
githash = file .readline ().strip ()
201
201
elif os .path .isfile (packedrefs ):
202
202
# Git may pack refs into a single file. This code searches .git/packed-refs file for the current ref's hash.
203
203
# https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-pack-refs.html
204
- for line in open (packedrefs , "r" ).read ().splitlines ():
204
+ for line in open (packedrefs , "r" , encoding = "utf-8" ).read ().splitlines ():
205
205
if line .startswith ("#" ):
206
206
continue
207
207
(line_hash , line_ref ) = line .split (" " )
@@ -270,7 +270,7 @@ def generate_version_header(module_version_string=""):
270
270
271
271
272
272
def parse_cg_file (fname , uniforms , sizes , conditionals ):
273
- with open (fname , "r" ) as fs :
273
+ with open (fname , "r" , encoding = "utf-8" ) as fs :
274
274
line = fs .readline ()
275
275
276
276
while line :
@@ -1243,7 +1243,7 @@ def format_key_value(v):
1243
1243
).hexdigest ()
1244
1244
1245
1245
if os .path .exists (f"{ project_name } .vcxproj.filters" ):
1246
- with open (f"{ project_name } .vcxproj.filters" , "r" ) as file :
1246
+ with open (f"{ project_name } .vcxproj.filters" , "r" , encoding = "utf-8" ) as file :
1247
1247
existing_filters = file .read ()
1248
1248
match = re .search (r"(?ms)^<!-- CHECKSUM$.([0-9a-f]{32})" , existing_filters )
1249
1249
if match is not None and md5 == match .group (1 ):
@@ -1255,7 +1255,7 @@ def format_key_value(v):
1255
1255
if not skip_filters :
1256
1256
print (f"Regenerating { project_name } .vcxproj.filters" )
1257
1257
1258
- with open ("misc/msvs/vcxproj.filters.template" , "r" ) as file :
1258
+ with open ("misc/msvs/vcxproj.filters.template" , "r" , encoding = "utf-8" ) as file :
1259
1259
filters_template = file .read ()
1260
1260
for i in range (1 , 10 ):
1261
1261
filters_template = filters_template .replace (f"%%UUID{ i } %%" , str (uuid .uuid4 ()))
@@ -1409,7 +1409,7 @@ def format_key_value(v):
1409
1409
)
1410
1410
output = f'bin\\ godot{ env ["PROGSUFFIX" ]} '
1411
1411
1412
- with open ("misc/msvs/props.template" , "r" ) as file :
1412
+ with open ("misc/msvs/props.template" , "r" , encoding = "utf-8" ) as file :
1413
1413
props_template = file .read ()
1414
1414
1415
1415
props_template = props_template .replace ("%%VSCONF%%" , vsconf )
@@ -1478,7 +1478,7 @@ def format_key_value(v):
1478
1478
sln_uuid = str (uuid .uuid4 ())
1479
1479
1480
1480
if os .path .exists (f"{ project_name } .sln" ):
1481
- for line in open (f"{ project_name } .sln" , "r" ).read ().splitlines ():
1481
+ for line in open (f"{ project_name } .sln" , "r" , encoding = "utf-8" ).read ().splitlines ():
1482
1482
if line .startswith ('Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}")' ):
1483
1483
proj_uuid = re .search (
1484
1484
r"\"{(\b[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-\b[0-9a-fA-F]{12}\b)}\"$" ,
@@ -1567,7 +1567,7 @@ def format_key_value(v):
1567
1567
section2 = sorted (section2 )
1568
1568
1569
1569
if not get_bool (original_args , "vsproj_props_only" , False ):
1570
- with open ("misc/msvs/vcxproj.template" , "r" ) as file :
1570
+ with open ("misc/msvs/vcxproj.template" , "r" , encoding = "utf-8" ) as file :
1571
1571
proj_template = file .read ()
1572
1572
proj_template = proj_template .replace ("%%UUID%%" , proj_uuid )
1573
1573
proj_template = proj_template .replace ("%%CONFS%%" , "\n " .join (configurations ))
@@ -1579,7 +1579,7 @@ def format_key_value(v):
1579
1579
f .write (proj_template )
1580
1580
1581
1581
if not get_bool (original_args , "vsproj_props_only" , False ):
1582
- with open ("misc/msvs/sln.template" , "r" ) as file :
1582
+ with open ("misc/msvs/sln.template" , "r" , encoding = "utf-8" ) as file :
1583
1583
sln_template = file .read ()
1584
1584
sln_template = sln_template .replace ("%%NAME%%" , project_name )
1585
1585
sln_template = sln_template .replace ("%%UUID%%" , proj_uuid )
0 commit comments