Ancora qualche correzione al codice per generare checksum.
This commit is contained in:
parent
7013318188
commit
059518ccbf
|
@ -382,21 +382,24 @@ class Build(loaih.RemoteBuild):
|
||||||
os.chdir(self.appnamedir)
|
os.chdir(self.appnamedir)
|
||||||
for arch in self.arch:
|
for arch in self.arch:
|
||||||
for item in [ self.appimagefilename[arch], self.zsyncfilename[arch] ]:
|
for item in [ self.appimagefilename[arch], self.zsyncfilename[arch] ]:
|
||||||
# For any built arch, find out if a file exist.
|
if self.built[arch]:
|
||||||
self.__create_checksum__(item)
|
# For any built arch, find out if a file exist.
|
||||||
|
self.__create_checksum__(item)
|
||||||
|
|
||||||
|
|
||||||
def __create_checksum__(self, file):
|
def __create_checksum__(self, file):
|
||||||
"""Internal function to create checksum file."""
|
"""Internal function to create checksum file."""
|
||||||
|
|
||||||
checksum = hashlib.md5()
|
checksum = hashlib.md5()
|
||||||
|
fullpath = os.path.join(self.appnamedir, file)
|
||||||
|
|
||||||
with open(os.path.join(self.appnamedir, file), 'rb') as readfile:
|
if os.path.exists(fullpath):
|
||||||
for chunk in iter(lambda: readfile.read(4096), b""):
|
with open(os.path.join(self.appnamedir, file), 'rb') as readfile:
|
||||||
checksum.update(chunk)
|
for chunk in iter(lambda: readfile.read(4096), b""):
|
||||||
|
checksum.update(chunk)
|
||||||
|
|
||||||
with open(f"{file}.md5", 'w', encoding='utf-8') as csfile:
|
with open(f"{file}.md5", 'w', encoding='utf-8') as csfile:
|
||||||
csfile.write(checksum.hexdigest())
|
csfile.write(checksum.hexdigest())
|
||||||
|
|
||||||
|
|
||||||
def publish(self):
|
def publish(self):
|
||||||
|
|
Loading…
Reference in New Issue