diff --git a/loaih/__init__.py b/loaih/__init__.py index ee99036..7519b15 100644 --- a/loaih/__init__.py +++ b/loaih/__init__.py @@ -49,12 +49,12 @@ class Build(object): # If the build was called by queried name, build from latest release available but build with the most generic name myver = str.join('.', self.version.split('.')[0:2]) self.genappversion = myver + self.languagepart + self.helppart - self.genappimagefilename[u'x86'] = self.appname + '-' + self.genappversion + self.languagepart + self.helppart + '-x86.AppImage' - self.genappimagefilename[u'x86_64'] = self.appname + '-' + self.genappversion + self.languagepart + self.helppart + '-x86_64.AppImage' + self.genappimagefilename[u'x86'] = self.appname + '-' + self.genappversion + '-x86.AppImage' + self.genappimagefilename[u'x86_64'] = self.appname + '-' + self.genappversion + '-x86_64.AppImage' self.appversion = self.version + self.languagepart + self.helppart - self.appimagefilename[u'x86'] = self.appname + '-' + self.version + self.languagepart + self.helppart + '-x86.AppImage' - self.appimagefilename[u'x86_64'] = self.appname + '-' + self.version + self.languagepart + self.helppart + '-x86_64.AppImage' + self.appimagefilename[u'x86'] = self.appname + '-' + self.appversion + '-x86.AppImage' + self.appimagefilename[u'x86_64'] = self.appname + '-' + self.appversion + '-x86_64.AppImage' def check(self, storage_path): @@ -77,20 +77,23 @@ class Build(object): for arch in self.arch: # For generalized builds, we need to check if there are .ver file # and it contains the specific version found. - res = subprocess.check_output("find {path} -name {appimage}'".format( + res = subprocess.run("find {path} -name {appimage}'".format( path = self.storage_path, appimage = self.genappimagefilename[arch] + '.ver' - ), shell=True).decode('utf-8').strip('\n') - for file in res: - if self.version in open(file, 'r').read(): - self.built = True + ), shell=True, capture_output=True) + if res.stdout: + # All good, the command was executed fine. + for file in res.stdout.decode('utf-8').strip('\n').split('\n'): + if self.version in open(file, 'r').read(): + self.built = True - res = subprocess.check_output("find {path} -name '{appimage}'".format( + res = subprocess.run("find {path} -name '{appimage}'".format( path = self.storage_path, appimage = self.appimagefilename[arch] - ), shell=True).decode('utf-8').strip('\n') - if len(res) > 1: - self.built = True + ), shell=True, capture_output=True) + if res.stdout: + if len(res.stdout.decode('utf-8').strip('\n')) > 1: + self.built = True if self.built: print("The requested AppImage already exists on storage. I'll skip downloading, building and moving the results.")