summaryrefslogtreecommitdiff
path: root/boards
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2021-11-21 18:01:29 +0100
committeremkael <emkael@tlen.pl>2021-11-21 18:01:29 +0100
commit5ebd5cb4b52962c576c5b9f2f75cd053b8dc552c (patch)
treeb30124a65b858bf1d5c54dde6c1c00fcbcdda466 /boards
parentcb812f5d51da792d840afa6687545487c30f3c9a (diff)
Zipping hand record files
Diffstat (limited to 'boards')
-rw-r--r--boards/generate.py14
1 files changed, 14 insertions, 0 deletions
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')