/[gentoo]/src/packages/weeks.py
Gentoo

Contents of /src/packages/weeks.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download) (as text)
Sun Mar 7 04:30:57 2004 UTC (10 years, 5 months ago) by marduk
Branch: MAIN
Changes since 1.1: +42 -39 lines
File MIME type: text/x-python
Ok, this really fixes bug #43395
--marduk

1 #!/usr/bin/python -OO
2
3 import time
4 import MySQLdb
5 from cgi import escape
6 import ebuilddb
7 import config
8 import gentoo
9
10 SECS_PER_DAY = 86400
11 NUM_EXPANDED_DAYS = 2
12 DAYS = ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday')
13
14 def get_dayname(day):
15 return DAYS[day[6]]
16
17 def get_days_ebuilds(day):
18 c = db.cursor()
19 query = ('SELECT ebuild.category, '
20 'ebuild.name, '
21 'version, '
22 'when_found, '
23 'description, '
24 'changelog, '
25 'arch, '
26 'homepage, '
27 'license '
28 'FROM ebuild,package '
29 'WHERE SUBSTRING(when_found FROM 1 FOR 8) = "%s%02d%02d" '
30 'AND ebuild.name = package.name '
31 'AND ebuild.category = package.category '
32 'ORDER BY when_found DESC' %
33 (day[0],day[1],day[2]))
34 #print query
35 c.execute(query)
36 results = c.fetchall()
37 return results
38
39 today = time.time()
40 db = ebuilddb.db_connect()
41 for day in range(today,today - (7*SECS_PER_DAY),-SECS_PER_DAY):
42 #print day
43 gmtime = time.gmtime(day)
44 dayname = get_dayname(gmtime)
45 print ('<a href="%sdaily/%s/%02d/%02d/">%s</a>:<br>'
46 % (config.FEHOME,gmtime[0],gmtime[1],gmtime[2],dayname))
47 results = get_days_ebuilds(gmtime)
48 #print results
49 ebuilds = [ gentoo.query_to_dict(i) for i in results ]
50 #ebuilds.sort(ebuild_sort)
51 if day < (today - NUM_EXPANDED_DAYS*SECS_PER_DAY):
52 continue
53 for ebuild in ebuilds:
54 print ('. <a class="altlink" title="%s" href="%sebuilds/?%s-%s">%s %s</a><br>' %
55 (escape(ebuild['description']),
56 config.FEHOME,
57 ebuild['name'],
58 ebuild['version'],
59 ebuild['name'],
60 ebuild['version']))
61 print '<br>'

  ViewVC Help
Powered by ViewVC 1.1.20