1
0

Scrittura md5 più pythonica.

This commit is contained in:
Emiliano Vavassori 2022-04-08 01:56:04 +02:00
parent 076d5389d6
commit b5edfce8ab

View File

@ -115,10 +115,8 @@ class Build(object):
# Build stays false, and we go to the next arch # Build stays false, and we go to the next arch
continue continue
if res.stdout: if res.stdout and len(res.stdout.strip("\n")) > 0:
# All good, the command was executed fine. # 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.") print(f"Build for {self.version} found.")
self.built[arch] = True self.built[arch] = True
@ -294,7 +292,10 @@ class Build(object):
# For any built arch, find out if a file exist. # For any built arch, find out if a file exist.
if not os.path.exists(f"{item}.md5"): if not os.path.exists(f"{item}.md5"):
# Build checksum # 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): def publish(self):