diff options
Diffstat (limited to 'boards')
-rw-r--r-- | boards/generate.py | 14 |
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') |