-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
60 lines (45 loc) · 1.53 KB
/
setup.py
File metadata and controls
60 lines (45 loc) · 1.53 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# on command prompt just type:
# python setup.py yyyy dd
import sys
import os
os.system("") # enable ansi escape code
year = ""
day = ""
###########################################################
# check valid command
###########################################################
if len(sys.argv) < 3:
print("\033[33mMissing arguments (aaaa - dd)\033[37m")
exit()
else:
year, day = sys.argv[1], sys.argv[2]
###########################################################
# if not created yet create input txt file
###########################################################
if (os.path.exists(f"{year}\input\d{day}.txt")):
print(f"\033[33mIl file d{day}.txt è presente nella cartella {year}\input.\033[37m")
else:
with open(f"{year}\input\d{day}.txt", 'w') as f:
f.write('')
###########################################################
# if not created yet create .cpp file
###########################################################
if (os.path.exists(f"{year}\d{day}.cpp")):
print(f"\033[33mIl file d{day}.cpp è presente nella cartella {year}.\033[37m")
else:
with open(f"{year}\d{day}.cpp", 'w') as f:
f.write(f"""
#include <iostream>
#include <vector>
#include <map>
#include "../libcpp/io.cpp"
#include "../libcpp/slice.cpp"
#include "../libcpp/parse.cpp"
#include "../libcpp/grids.cpp"
#include "../libcpp/convert.cpp"
using namespace std;
int main()
{{
std::vector<std::string> file = import_file( "input/d{day}.txt" );
return 0;
}}""")