Commit 496b37b7 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Merge branch 'refactor' of into refactor

parents 0bd45bac 8a4b0a14
from typing import Dict
import zipfile
import tarfile
import os.path
import sys
from nomad import config
names: Dict[str, bool] = dict()
def add_upload(tf, upload):
files = [
os.path.join(config.fs.public, upload[0:2], upload, base)
for base in ['', '']]
for f in files:
with zipfile.ZipFile(f) as zf:
for zipinfo in zf.infolist():
name = zipinfo.filename
if name not in names:
names[name] = True
with as bf:
tarinfo = tarfile.TarInfo(name)
tarinfo.size = zipinfo.file_size
tf.addfile(tarinfo, bf)
target = sys.argv[1]
with tarfile.TarFile(target, 'x') as tf:
for upload in sys.argv[2:]:
print('adding upload %s' % upload)
add_upload(tf, upload)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment