From 5ebd5cb4b52962c576c5b9f2f75cd053b8dc552c Mon Sep 17 00:00:00 2001 From: emkael Date: Sun, 21 Nov 2021 18:01:29 +0100 Subject: Zipping hand record files --- boards/generate.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'boards') diff --git a/boards/generate.py b/boards/generate.py index 86c7ca5..1ab2f62 100644 --- a/boards/generate.py +++ b/boards/generate.py @@ -1,6 +1,7 @@ import json, os, re, subprocess, sys from datetime import datetime from pathlib import Path +from zipfile import ZipFile DEAL_CONVERT_PATH = os.environ.get('LIGA_BOARDS_DEAL_CONVERT_PATH') @@ -41,6 +42,19 @@ def ensure_pdf(source_id, config_name): deal_convert(str(source_path), [str(target_path)]) return target_path + +def ensure_zip(source_id, config_name, source_files): + target_path = Path('output') / config_name / 'files' / (source_id + '.zip') + if target_path.exists(): + return target_path + print('Target path %s does not exist, generating' % (target_path), file=sys.stderr) + target_path.parent.mkdir(parents=True, exist_ok=True) + with ZipFile(target_path, 'w') as zip_file: + for source_file in source_files: + zip_file.write(source_file, arcname=source_file.name) + return target_path + + output_files = [] config_dir = Path('config') -- cgit v1.2.3