5
5
from docutils .core import publish_doctree
6
6
import sys
7
7
8
+ dist_url = "http://dist.plone.org/release/%s/versions.cfg"
8
9
9
- def pullVersions (versionsFile ):
10
+
11
+ def pullVersions (versionNumber ):
10
12
try :
11
13
from ordereddict import OrderedDict
12
14
packageVersions = OrderedDict ()
13
15
except ImportError :
14
16
print "Unable to find OrderedDict"
15
17
packageVersions = {}
18
+ url = dist_url % versionNumber
19
+ versionsFile = urllib .urlopen (url )
16
20
for line in versionsFile :
17
21
line = line .strip ().replace (" " , "" )
18
22
if line and not (line .startswith ('#' ) or line .startswith ('[' )):
@@ -23,6 +27,7 @@ def pullVersions(versionsFile):
23
27
pass
24
28
else :
25
29
packageVersions [package ] = version
30
+ print "Parsed %s" % url
26
31
return packageVersions
27
32
28
33
@@ -43,7 +48,7 @@ def getSourceLocation(packageName):
43
48
url = value [0 ].split ()[1 ]
44
49
else :
45
50
variable = value [1 ][2 :- 1 ].split ()[0 ].split (':' )
46
-
51
+
47
52
section , option = variable
48
53
value [1 ] = config .get (section , option )
49
54
url = '' .join (value [1 :])
@@ -55,39 +60,22 @@ def getSourceLocation(packageName):
55
60
url = url .replace ('git:' , 'https:' )
56
61
url = url .replace ('.git' , '' )
57
62
return url , branch
58
- # sources = {}
59
- # for line in sourcesFile:
60
- # line = line.strip().replace(" ","")
61
- # for t in ['svn','git']:
62
- # line = line.replace("=%s" % t,";;")
63
-
64
- # if line and not (line.startswith('#') or line.startswith('[')):
65
- # try:
66
- # package, location = line.split(";;")
67
- # sources[package] = location
68
- # except ValueError:
69
- # print line
70
63
return "" , ""
71
64
72
65
73
66
def main (argv ):
74
67
priorVersionNumber = sys .argv [1 ]
75
68
currentVersionNumber = sys .argv [2 ]
76
69
77
- dist_url = "http://dist.plone.org/release/%s/versions.cfg"
78
- priorVersionsFile = urllib .urlopen (dist_url % priorVersionNumber )
79
- priorVersions = pullVersions (priorVersionsFile )
80
-
81
- currentVersionsFile = urllib .urlopen (dist_url % currentVersionNumber )
82
- currentVersions = pullVersions (currentVersionsFile )
70
+ priorVersions = pullVersions (priorVersionNumber )
71
+ currentVersions = pullVersions (currentVersionNumber )
83
72
84
- # sourcesFile = open("sources.cfg", "r")
85
- # sources = pullSources #pullSources(sourcesFile)
86
73
outputStr = ""
87
74
for package , version in currentVersions .iteritems ():
88
75
if package in priorVersions :
89
76
priorVersion = priorVersions [package ]
90
77
if version > priorVersion :
78
+ print "%s has a newer version" % package
91
79
packageChange = u"%s: %s %s %s" % (package , priorVersion , u"\u2192 " , version )
92
80
outputStr += u"\n " + packageChange + u"\n " + u"-" * len (packageChange ) + "\n "
93
81
source , branch = getSourceLocation (package )
0 commit comments