~ubuntu-branches/ubuntu/utopic/taskcoach/utopic-proposed

« back to all changes in this revision

Viewing changes to tools/latest.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-08-15 14:54:44 UTC
  • mfrom: (8.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20140815145444-qm2ya2zvy1pyrcl5
Tags: 1.4.0-1ubuntu1
* Merge with Debian; remaining changes:
  - Let the autopkg test depend on language-pack-en.
  - Build-depend on language-pack-en.
* Build using python-wxgtk3.0.
* Don't use /usr/share/pyshared anymore, it's gone.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
19
'''
20
20
 
21
 
import os, re
 
21
import os, re, sys
22
22
 
23
23
def findLatest(path, valid):
24
 
    rx = re.compile('(.*)r(\d+)(.*)')
 
24
    rx = re.compile(r'(.*)(\d+\.\d+\.\d+\.\d+)(.*)')
25
25
 
26
26
    results = dict()
27
27
 
30
30
            mt = rx.search(name)
31
31
            if mt:
32
32
                ls = results.get((mt.group(1), mt.group(3)), [])
33
 
                ls.append(int(mt.group(2)))
 
33
                ls.append(map(int, mt.group(2).split('.')))
34
34
                results[(mt.group(1), mt.group(3))] = ls
35
35
 
36
36
    packages = []
37
37
 
38
38
    for (part1, part3), versions in results.items():
39
39
        versions.sort()
40
 
        packages.append('%sr%d%s' % (part1, versions[-1], part3))
 
40
        packages.append('%s%s%s' % (part1, '.'.join(map(str, versions[-1])), part3))
41
41
 
42
42
    packages.sort()
43
43
 
52
52
    print '<ul>'
53
53
 
54
54
    for pkgname in findLatest(path, isSource):
55
 
        print '<li><a href="http://www.fraca7.net/TaskCoach-packages/%s">%s</a></li>' % (pkgname, pkgname)
 
55
        if path == '.' or path == 'all':
 
56
            print '<li><a href="http://www.fraca7.net/TaskCoach-packages/%s">%s</a></li>' % (pkgname, pkgname)
 
57
        else:
 
58
            print '<li><a href="http://www.fraca7.net/TaskCoach-packages/%s/%s">%s</a></li>' % (path, pkgname, pkgname)
56
59
 
57
60
    print '</ul>'
58
61
 
60
63
    print '<ul>'
61
64
 
62
65
    for pkgname in findLatest(path, lambda x: not isSource(x)):
63
 
        print '<li><a href="http://www.fraca7.net/TaskCoach-packages/%s">%s</a></li>' % (pkgname, pkgname)
 
66
        if path == '.' or path == 'all':
 
67
            print '<li><a href="http://www.fraca7.net/TaskCoach-packages/%s">%s</a></li>' % (pkgname, pkgname)
 
68
        else:
 
69
            print '<li><a href="http://www.fraca7.net/TaskCoach-packages/%s/%s">%s</a></li>' % (path, pkgname, pkgname)
64
70
 
65
71
    print '</ul>'
66
72
 
67
 
def main():
 
73
def main(path):
68
74
    print 'Content-type: text/html'
69
75
    print
70
76
 
71
77
    print '<html><head><title>Latest Task Coach builds</title>'
72
78
    print '<style type="text/css" media="screen">@import "default.css";</style>'
73
79
    print '</head></body>'
74
 
    print '<h1>From Trunk</h1>'
75
 
    listPath('.')
76
 
 
77
 
    for name in os.listdir('branches'):
78
 
        fname = os.path.join('branches', name)
79
 
        if os.path.isdir(fname):
80
 
            print '<h1>From %s</h1>' % name
81
 
            listPath(fname)
 
80
 
 
81
    if path == '.' or path == 'all':
 
82
        print '<h1>New developments (from trunk)</h1>'
 
83
        listPath('.')
 
84
 
 
85
    if path != '.':
 
86
        for name in os.listdir(path):
 
87
            if name.startswith('Release'):
 
88
                fname = os.path.join(path, name)
 
89
                if os.path.isdir(fname):
 
90
                    print '<h1>Bug fixes (from %s)</h1>' % name
 
91
                    listPath(fname)
82
92
 
83
93
    print '<a href="http://www.taskcoach.org/download.html>Back to Task Coach downloads</a>'
84
94
 
85
95
    print '</body></html>'
86
96
 
87
97
if __name__ == '__main__':
88
 
    main()
 
98
    if sys.argv[0].endswith('latest_features.py'):
 
99
        main('.')
 
100
    elif sys.argv[0].endswith('latest_bugfixes.py'):
 
101
        main('branches')
 
102
    else:
 
103
        main('all')
 
104