Rename hash function name
This commit is contained in:
parent
da0ae0136e
commit
5c63add3b2
|
@ -27,7 +27,7 @@ async def hook(req: Request):
|
|||
pack.pull()
|
||||
pack.collate()
|
||||
pack.compress()
|
||||
pack.hash()
|
||||
pack.hashPack()
|
||||
pack.upload()
|
||||
return "Updated " + pack.gethash()
|
||||
|
||||
|
|
|
@ -49,8 +49,10 @@ class Pack:
|
|||
print("Compressing")
|
||||
shutil.make_archive("files/pack", 'zip', "files/pack")
|
||||
shutil.rmtree("files/pack")
|
||||
print("Compressed")
|
||||
|
||||
def hash(self):
|
||||
def hashPack(self):
|
||||
try:
|
||||
print("Hashing")
|
||||
sha1sum = hashlib.sha1()
|
||||
with open("files/pack.zip", "rb") as pack:
|
||||
|
@ -59,8 +61,12 @@ class Pack:
|
|||
sha1sum.update(block)
|
||||
block = pack.read(2**16)
|
||||
self.hash = sha1sum.hexdigest()
|
||||
print("Write hash")
|
||||
with open("files/hash", 'w') as hashfile:
|
||||
hashfile.write(self.hash)
|
||||
except Exception:
|
||||
print("Failed to hash")
|
||||
|
||||
|
||||
def upload(self):
|
||||
print("Uploading")
|
||||
|
|
|
@ -7,6 +7,6 @@ def test_pack():
|
|||
pack.pull()
|
||||
pack.collate()
|
||||
pack.compress()
|
||||
pack.hash()
|
||||
pack.hashPack()
|
||||
pack.upload()
|
||||
|
||||
|
|
Loading…
Reference in New Issue