Skip to content

Commit

Permalink
Merge pull request #150 from yosupo06/issue/20
Browse files Browse the repository at this point in the history
add all_combined.cpp to generated zip
  • Loading branch information
yosupo06 authored Mar 6, 2023
2 parents 437f77b + 2f1dab5 commit d50c562
Showing 1 changed file with 17 additions and 0 deletions.
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')

0 comments on commit d50c562

Please sign in to comment.