-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdiff.py
More file actions
executable file
·104 lines (73 loc) · 1.72 KB
/
diff.py
File metadata and controls
executable file
·104 lines (73 loc) · 1.72 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#! /usr/bin/env python
import os
import PackRatConfig as PRconfig
def checkDiff(PL,SL):
li = []
for part in PL:
i = 0
for par in SL:
if part[1] in par:
i = 1
if i == 0:
li.append(part[0])
return li
def main():
piman = open(PRconfig.path+"/manifest.txt")
servman = open(PRconfig.path+"/temp/manifest.txt")
if piman.readline() == servman.readline():
return 0
else:
newman = "go"
piman.close()
servman.close()
piman = open(PRconfig.path+"/manifest.txt")
servman = open(PRconfig.path+"/temp/manifest.txt")
piL = []
svL = []
PL = []
SL = []
ln = []
RealPull = []
for line in piman:
piL.append(line)
del piL[0]
for line in servman:
svL.append(line)
del svL[0]
for obj in piL:
PL.append(obj.split("|"))
for obj in svL:
SL.append(obj.split("|"))
toDelete = checkDiff(PL,SL)
toPull = checkDiff(SL,PL)
for thing in toDelete:
if thing in toPull:
toDelete.remove(thing)
# for c in toDelete:
# if os.path.exists(c):
# os.remove(c)
# print "===>Deleted ", c ,"\n"
NewFi = open(PRconfig.path+"/neededFiles.txt", "w")
for item in toPull:
ln.append(item.split("/"))
# for item in ln:
# while len(item) > 4:
# del item[4]
for item in ln:
if len(item) > 3:
for index in range(3,len(item)):
os.system("mkdir "+item[index])
RealPull.append('/'.join(item))
for item in RealPull:
NewFi.write(item)
NewFi.write("\n")
NewFi.write(PRconfig.path+"/manifest.txt\n")
for c in toDelete:
if os.path.exists(c):
os.remove(c)
print "===>Deleted ", c ,"\n"
piman.close()
servman.close()
NewFi.close()
return 0
main()