[v0.1.0a2] Explicitly set the default file encoding to utf8

This commit is contained in:
sup39 2023-07-14 21:30:57 +09:00
parent ec8f0251b4
commit 125667f474
No known key found for this signature in database
GPG key ID: 14D2E0D21140D260
3 changed files with 6 additions and 4 deletions

View file

@ -1,4 +1,6 @@
# Changelog
## v0.1.0a2
- Explicitly set the default file encoding to utf8
## v0.1.0a1
- Implemented `build`, `make_xml` functions
- Added symbols.py and ldscript

View file

@ -1,6 +1,6 @@
[metadata]
name = supSMSGecko
version = 0.1.0a1
version = 0.1.0a2
author = sup39
author_email = sms@sup39.dev
description = A helper library to write Gecko code for Super Mario Sunshine

View file

@ -18,10 +18,10 @@ def build(main, version):
def make_xml(
main, versions=VERSIONS,
info_xml='info.xml', out_xml='out.xml',
indent=4, tag='code',
indent=4, tag='code', encoding='utf8',
):
if type(indent) == int: indent = ' '*indent
with open(out_xml, 'w') as fw:
with open(out_xml, 'w', encoding=encoding) as fw:
def write_sources(indent_src):
for ver in versions:
print(f'{indent_src}<source version="{ver}">', file=fw)
@ -29,7 +29,7 @@ def make_xml(
print(f'{indent_src}</source>', file=fw)
if info_xml is not None and os.path.isfile(info_xml):
found_tag = False
with open(info_xml) as f:
with open(info_xml, encoding=encoding) as f:
for line in f:
m = re.search(r'^(\s*)</(\S+)\s*>', line)
if m is not None: