mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Revert "OP-3682 - extracted sha256 method to lib"
This reverts commit c4854be5
This commit is contained in:
parent
98444762cd
commit
b0c8a47f0f
2 changed files with 21 additions and 22 deletions
|
|
@ -5,7 +5,6 @@ import json
|
|||
import logging
|
||||
import six
|
||||
import platform
|
||||
import hashlib
|
||||
|
||||
from openpype.client import get_project
|
||||
from openpype.settings import get_project_settings
|
||||
|
|
@ -480,21 +479,3 @@ class HostDirmap:
|
|||
log.debug("local sync mapping:: {}".format(mapping))
|
||||
return mapping
|
||||
|
||||
|
||||
def sha256sum(filename):
|
||||
"""Calculate sha256 for content of the file.
|
||||
|
||||
Args:
|
||||
filename (str): Path to file.
|
||||
|
||||
Returns:
|
||||
str: hex encoded sha256
|
||||
|
||||
"""
|
||||
h = hashlib.sha256()
|
||||
b = bytearray(128 * 1024)
|
||||
mv = memoryview(b)
|
||||
with open(filename, 'rb', buffering=0) as f:
|
||||
for n in iter(lambda: f.readinto(mv), 0):
|
||||
h.update(mv[:n])
|
||||
return h.hexdigest()
|
||||
|
|
|
|||
|
|
@ -7,11 +7,10 @@ from pathlib import Path
|
|||
import platform
|
||||
from zipfile import ZipFile
|
||||
from typing import List
|
||||
import hashlib
|
||||
import sys
|
||||
from igniter.bootstrap_repos import OpenPypeVersion
|
||||
|
||||
from openpype.lib.path_tools import sha256sum
|
||||
|
||||
|
||||
class VersionRepacker:
|
||||
|
||||
|
|
@ -46,6 +45,25 @@ class VersionRepacker:
|
|||
|
||||
print("{}{}".format(header, msg))
|
||||
|
||||
@staticmethod
|
||||
def sha256sum(filename):
|
||||
"""Calculate sha256 for content of the file.
|
||||
|
||||
Args:
|
||||
filename (str): Path to file.
|
||||
|
||||
Returns:
|
||||
str: hex encoded sha256
|
||||
|
||||
"""
|
||||
h = hashlib.sha256()
|
||||
b = bytearray(128 * 1024)
|
||||
mv = memoryview(b)
|
||||
with open(filename, 'rb', buffering=0) as f:
|
||||
for n in iter(lambda: f.readinto(mv), 0):
|
||||
h.update(mv[:n])
|
||||
return h.hexdigest()
|
||||
|
||||
@staticmethod
|
||||
def _filter_dir(path: Path, path_filter: List) -> List[Path]:
|
||||
"""Recursively crawl over path and filter."""
|
||||
|
|
@ -86,7 +104,7 @@ class VersionRepacker:
|
|||
nits="%", color="green")
|
||||
for file in file_list:
|
||||
checksums.append((
|
||||
sha256sum(file.as_posix()),
|
||||
VersionRepacker.sha256sum(file.as_posix()),
|
||||
file.resolve().relative_to(self.version_path),
|
||||
file
|
||||
))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue