Skip to content

Commit

Permalink
fix: py3k for scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
fffonion committed Oct 26, 2024
1 parent 9beaf3c commit 141ad3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions util/make_release_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
os.mkdir(target)

target = os.path.join(target, "config.py")
cli = open(os.path.join(FILEPATH, "xeHentai", "cli.py"), "rb").read()
zh_hans = open(os.path.join(FILEPATH, "xeHentai", "i18n", "zh_hans.py"), "rb").read()
cli = open(os.path.join(FILEPATH, "xeHentai", "cli.py"), "r", encoding="utf-8").read()
zh_hans = open(os.path.join(FILEPATH, "xeHentai", "i18n", "zh_hans.py"), "r", encoding="utf-8").read()

f = open(target, "wb")
f = open(target, "w", encoding="utf-8")
f.write('''# coding:utf-8
# --UTF8补丁-- #
Expand All @@ -35,11 +35,11 @@
if k == "download_range":
i18n = "XEH_OPT_download_range"
else:
i18n = re.findall("_def\[['\"]%s['\"]\].*?help\s*=\s*i18n.([^\)]+)\)" % k, cli, re.DOTALL)[0]
txt = re.findall("%s\s*=\s*['\"](.*?)\s*\(当前.+['\"]" % i18n, zh_hans, re.DOTALL)[0]
i18n = re.findall(r"_def\[['\"]%s['\"]\].*?help\s*=\s*i18n.([^\)]+)\)" % k, cli, re.DOTALL)[0]
txt = re.findall(r"%s\s*=\s*['\"](.*?)\s*\(当前.+['\"]" % i18n, zh_hans, re.DOTALL)[0]
# multiline fix
txt = txt.replace('"', '').replace('\\\n', '\n# ')
txt = re.sub("\nXEH_.+", "", txt, re.DOTALL)
txt = re.sub(r"\nXEH_.+", "", txt, re.DOTALL)
else:
txt = other_mappings[k]
f.write("# %s\n" % txt)
Expand Down
2 changes: 1 addition & 1 deletion util/make_verinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@
".".join(v), ".".join(v), version
)

open("verinfo.txt", "wb").write(tmpl)
open("verinfo.txt", "w", encoding="utf-8").write(tmpl)

0 comments on commit 141ad3b

Please sign in to comment.