Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add all_combined.cpp to generated zip #150

Merged
merged 2 commits into from
Mar 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tools/generate_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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')