-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphoton-diff.py
More file actions
73 lines (61 loc) · 1.75 KB
/
photon-diff.py
File metadata and controls
73 lines (61 loc) · 1.75 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
import json
from xml.etree import ElementTree as et
import os
print(os.__file__)
tree = et.parse("/Volumes/Ajith/manifest-old.xml")
root = tree.getroot()
packageGroups = root.find('packageGroups')
group = packageGroups.find('group')
packages = group.findall('package')
existing_ph5 = {}
for package in packages:
try:
if '.ph5' in package.attrib['version']:
existing_ph5[package.attrib['name']] = package.attrib['version']
except KeyError as e:
print(package.attrib)
tree = et.parse("/Volumes/Ajith/manifest-latest.xml")
root = tree.getroot()
packageGroups = root.find('packageGroups')
group = packageGroups.find('group')
packages = group.findall('package')
latest_ph5 = {}
for package in packages:
if '.ph5' in package.attrib['version']:
latest_ph5[package.attrib['name']] = package.attrib['version']
print("Photon packages changed...")
latest_new = []
latest = []
i = 0
for key, version in latest_ph5.items():
if key not in existing_ph5:
i=i+1
latest_new.append(key + "=" + version)
else:
if version != existing_ph5[key]:
i=i+1
latest.append(key + "=" + version)
print(i)
existing = []
removed = []
i = 0
for key, version in existing_ph5.items():
if key not in latest_ph5:
i=i+1
removed.append(key + "=" + version)
else:
if version != latest_ph5[key]:
i=i+1
existing.append(key + "=" + version)
latest.sort()
existing.sort()
for i in range(0, len(latest)):
print(existing[i] + " -> " + latest[i])
if latest_new:
print("\nNew packages:")
for i in range(0, len(latest_new)):
print(latest_new[i])
if removed:
print("\nRemoved packages:")
for i in range(0, len(removed)):
print(removed[i])