Skip to content
Snippets Groups Projects

Properly compute files hashes during models publication

Merged Yoann Schneider requested to merge fix-publication-paths into master
6 files
+ 11
6
Compare changes
  • Side-by-side
  • Inline
Files
6
@@ -50,10 +50,14 @@ def create_archive(path: DirPath) -> Tuple[Path, Hash, FileSize, Hash]:
# Create an uncompressed tar archive with all the needed files
# Files hierarchy ifs kept in the archive.
file_list = []
with tarfile.open(path_to_tar_archive, "w") as tar:
tar.add(path)
file_list = [member for member in tar.getnames() if os.path.isfile(member)]
for p in path.glob("**/*"):
x = p.relative_to(path)
tar.add(p, arcname=x, recursive=False)
# Only keep files when computing the hash
if p.is_file():
file_list.append(p)
# Sort by path
file_list.sort()
Loading