From 0fe53e857b4ec705762494ebe1906d2843a17800 Mon Sep 17 00:00:00 2001 From: Kohei Morita Date: Mon, 6 Mar 2023 02:55:10 +0900 Subject: [PATCH] add all_combined.cpp to generated zip --- tools/generate_zip.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/generate_zip.py b/tools/generate_zip.py index 4f256d5..283de5d 100755 --- a/tools/generate_zip.py +++ b/tools/generate_zip.py @@ -3,16 +3,31 @@ from logging import Logger, basicConfig, getLogger from os import getenv from pathlib import Path +from subprocess import run import zipfile logger: Logger = getLogger(__name__) +combined_cpp_main = """ +int main() { + // write your code here + return 0; +} +""" + if __name__ == "__main__": basicConfig( format="%(asctime)s [%(levelname)s] %(message)s", datefmt="%H:%M:%S", level=getenv('LOG_LEVEL', 'INFO'), ) + + # generate all_combined.cpp + run(['../expander.py', '../atcoder/all', '--lib', '..']) + with open('combined.cpp', 'a') as f: + f.writelines(combined_cpp_main) + + # generate zip with zipfile.ZipFile('ac-library.zip', 'w') as zipf: langs = ['en', 'ja'] for lang in langs: @@ -27,4 +42,6 @@ for f in (Path('..') / 'atcoder').glob('*'): zipf.write(f, f.relative_to(Path('..'))) + zipf.write('combined.cpp', 'all_combined.cpp'); + zipf.write('../expander.py', 'expander.py')