-
Notifications
You must be signed in to change notification settings - Fork 0
/
template_update.py
36 lines (28 loc) · 1.11 KB
/
template_update.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import argparse
import shutil
import os
iter_path = "iterations"
template_folder = "pMQseJPcaH"
def get_argparser():
parser = argparse.ArgumentParser(description='OpenReview venue management')
parser.add_argument('--month', required=True, help='which month?')
parser.add_argument('--full_copy', action='store_true', help='when creating new, otherwise only need to copy template')
return parser
if __name__ == '__main__':
args = get_argparser().parse_args()
os.chdir(os.path.join(os.getcwd(), iter_path))
if args.month == "all":
years = os.listdir()
years.remove(template_folder)
months = [os.path.join(y,m) for y in years for m in os.listdir(y)]
# months = [a for a in os.listdir() if os.path.isdir(a)]
else:
months = [args.month]
print(months)
for month in months:
if not os.path.exists(month) or args.full_copy:
print("Performing full copy")
shutil.copytree(template_folder, month)
else:
print("Performing template copy")
shutil.copy(os.path.join(template_folder, "index.html"), month)