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

Contents of /src/packages/weeks.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3.4.1 - (hide annotations) (download) (as text)
Sun Dec 31 20:21:29 2006 UTC (7 years, 7 months ago) by marduk
Branch: v1_3
Changes since 1.3: +2 -2 lines
File MIME type: text/x-python
Make date comparision compatible with MySQL 5 (and the SQL standard).

1 marduk 1.3.4.1 #!/usr/bin/python
2 marduk 1.1
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 marduk 1.2 NUM_EXPANDED_DAYS = 2
12 marduk 1.1 DAYS = ('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday')
13    
14     def get_dayname(day):
15 marduk 1.2 return DAYS[day[6]]
16 marduk 1.1
17     def get_days_ebuilds(day):
18 marduk 1.2 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 marduk 1.3 'license, '
28     'is_masked '
29 marduk 1.2 'FROM ebuild,package '
30 marduk 1.3.4.1 'WHERE DATE(when_found) = "%s-%02d-%02d" '
31 marduk 1.2 'AND ebuild.name = package.name '
32     'AND ebuild.category = package.category '
33     'ORDER BY when_found DESC' %
34     (day[0],day[1],day[2]))
35     #print query
36     c.execute(query)
37     results = c.fetchall()
38     return results
39 marduk 1.1
40 marduk 1.3 today = int(time.time())
41 marduk 1.1 db = ebuilddb.db_connect()
42     for day in range(today,today - (7*SECS_PER_DAY),-SECS_PER_DAY):
43 marduk 1.2 #print day
44     gmtime = time.gmtime(day)
45     dayname = get_dayname(gmtime)
46     print ('<a href="%sdaily/%s/%02d/%02d/">%s</a>:<br>'
47     % (config.FEHOME,gmtime[0],gmtime[1],gmtime[2],dayname))
48     results = get_days_ebuilds(gmtime)
49     #print results
50     ebuilds = [ gentoo.query_to_dict(i) for i in results ]
51     #ebuilds.sort(ebuild_sort)
52     if day < (today - NUM_EXPANDED_DAYS*SECS_PER_DAY):
53     continue
54 marduk 1.3 for ebuild in ebuilds[:100]:
55 marduk 1.2 print ('. <a class="altlink" title="%s" href="%sebuilds/?%s-%s">%s %s</a><br>' %
56     (escape(ebuild['description']),
57     config.FEHOME,
58     ebuild['name'],
59     ebuild['version'],
60     ebuild['name'],
61     ebuild['version']))
62     print '<br>'

  ViewVC Help
Powered by ViewVC 1.1.20