-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean.py
executable file
·42 lines (31 loc) · 1.09 KB
/
clean.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
37
38
39
40
41
42
#!/usr/bin/python
import os;
import sys;
import argparse;
import shutil;
def main():
parser = argparse.ArgumentParser();
parser.add_argument("--rebuild", dest = "rebuild", action = "store_true");
parser.add_argument("--no-rebuild", dest = "rebuild", action = "store_false");
parser.set_defaults(rebuild = False);
args = parser.parse_args();
rebuild = args.rebuild;
# Recursivly clean all the binary directories.
list_clean = list();
path_cur = os.getcwd();
path_build = os.path.join(path_cur, "build");
if os.path.isdir(path_build) == True:
shutil.rmtree(path_build);
path_bin_plg = os.path.join(path_cur, "bin", "plugin");
if os.path.isdir(path_bin_plg) == True:
shutil.rmtree(path_bin_plg);
path_bin_eng = os.path.join(path_cur, "bin", "engine");
if os.path.isdir(path_bin_eng) == True:
shutil.rmtree(path_bin_eng);
# Create the build folder if necessary.
if rebuild == True:
if os.path.isdir(path_build) == False:
os.makedirs(path_build);
return;
if __name__ == "__main__":
main();