Scrittura md5 più pythonica.

This commit is contained in:
Emiliano Vavassori 2022-04-08 01:56:04 +02:00
parent 076d5389d6
commit b5edfce8ab
1 changed files with 7 additions and 6 deletions

View File

@ -115,12 +115,10 @@ class Build(object):
# Build stays false, and we go to the next arch
continue
if res.stdout:
if res.stdout and len(res.stdout.strip("\n")) > 0:
# All good, the command was executed fine.
for file in res.stdout.strip('\n').split('\n'):
if self.version in open(file, 'r').read():
print(f"Build for {self.version} found.")
self.built[arch] = True
print(f"Build for {self.version} found.")
self.built[arch] = True
if self.built[arch]:
print(f"The requested AppImage already exists on storage for {arch}. I'll skip downloading, building and moving the results.")
@ -294,7 +292,10 @@ class Build(object):
# For any built arch, find out if a file exist.
if not os.path.exists(f"{item}.md5"):
# Build checksum
subprocess.run(shlex.split(f"md5sum {item} > {item}.md5"))
checksum = subprocess.run(shlex.split(f"md5sum {item}"), capture_output=True, text=True, encoding='utf-8')
if checksum.stdout:
with open(f"{item}.md5", 'w+') as f:
f.write(checksum.stdout)
def publish(self):