-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolution.py
executable file
·82 lines (67 loc) · 2.22 KB
/
Solution.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import pickle
from PhonyEntity import *
from FileEntity import *
from Project import *
import settings
class Solution:
def __init__(self, path):
# self.m_target_pres_dict = {}
self.m_projectFilesPathList = []
self.m_path = path
def show(self):
print "project files:"
for f in self.m_target_pres_dict.keys():
print f
def loadPrjList(self):
f = open('PROJECTFILES')
for line in f:
prjName = line.strip(' \n\t')
if not len(prjName) == 0:
self.m_projectFilesPathList.append(prjName)
f.close()
def savePrjList(self):
f = open('PROJECTFILES', 'w')
for prj in self.m_projectFilesPathList:
f.write(prj)
f.write('\n')
# f.writelines(self.m_sourceFilesPathList)
f.close()
def load(self):
f = open(self.m_path, "r")
self.loadPrjList()
# self.m_target_pres_dict = pickle.load(f)
f.close()
def save(self):
f = open(self.m_path, "w")
self.savePrjList()
# pickle.dump(self.m_target_pres_dict, f)
f.close()
def addProject(self, project):
for f in self.m_projectFilesPathList:
if f == project:
return False
self.m_projectFilesPathList.append(project)
return True
def removeProject(self, project):
for f in self.m_projectFilesPathList:
if f == project:
self.m_projectFilesPathList.remove(project)
return True
return False
def build(self):
#global verbose
# todo: projects dependences
sln_absdir = os.path.dirname(self.m_path)
for prj_relpath in self.m_projectFilesPathList:
prj_abspath = os.path.abspath(prj_relpath)
prj_reldir = os.path.dirname(prj_relpath)
prj_absdir = os.path.dirname(prj_abspath)
if settings.verbose:
print "Entering directory " + prj_absdir
os.chdir(prj_absdir)
prj = Project(prj_abspath)
prj.load()
prj.build()
if settings.verbose:
print "Leaving directory " + prj_absdir
os.chdir(sln_absdir)