From b5edfce8abbdd98f8631256feed557117e669b5b Mon Sep 17 00:00:00 2001 From: Emiliano Vavassori Date: Fri, 8 Apr 2022 01:56:04 +0200 Subject: [PATCH] =?UTF-8?q?Scrittura=20md5=20pi=C3=B9=20pythonica.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- loaih/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/loaih/__init__.py b/loaih/__init__.py index 62b4c32..e49ff35 100644 --- a/loaih/__init__.py +++ b/loaih/__init__.py @@ -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):