fixed truncate

This commit is contained in:
Giovanni Harting 2021-06-04 17:06:07 +02:00
parent 6af405ca14
commit 2fb7387cf8
2 changed files with 2 additions and 2 deletions

View File

@ -195,7 +195,7 @@ def is_package_failed(package: str, ver: LegacyVersion, repo: str):
if s[0] == package:
if ver > LegacyVersion(s[1]):
with failed_l, open(os.path.join(config["basedir"]["repo"], repo + "_failed.txt")) as f:
with failed_l, open(os.path.join(config["basedir"]["repo"], repo + "_failed.txt"), "r+") as f:
d = f.readlines()
f.seek(0)
f.truncate()

View File

@ -32,8 +32,8 @@ def increase_pkgrel(pkgbuild_file: str, parsed: dict = None) -> None:
parsed = parse_pkgbuild(pkgbuild_file)
with open(pkgbuild_file, "r+", errors='ignore') as p:
pkgbuild_str = p.read()
p.truncate(0)
p.seek(0)
p.truncate(0)
pkgbuild_str = regex_pkgrel.sub("pkgrel=" + parsed["pkgrel"] + ".1", pkgbuild_str)
p.write(pkgbuild_str)