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

Contents of /src/packages/genarchbar.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download) (as text)
Thu Feb 19 01:49:53 2004 UTC (10 years, 8 months ago) by marduk
Branch point for: packages_g_o, MAIN
File MIME type: text/x-python
Initial revision

1 marduk 1.1 #!/usr/bin/python -OO
2    
3    
4     """genarchbar.py"""
5    
6     import config
7     import os
8    
9     def genarchbar(base=config.FEHOME,arch='',branch=''):
10     if arch == '':
11     switch = 'selected'
12     else:
13     switch = 'unselected'
14     if switch == 'selected':
15     colspan = len(config.ARCHLIST)
16     else:
17     colspan = len(config.ARCHLIST) - 2
18     s = ('<table class="archnav" border="0" cellpadding="0" cellspacing="0">\n'
19     '<tr><td colspan="%s" class="%s"><a href="%s">all platforms</a></td>\n'
20     % (colspan,switch,base))
21     if arch != '':
22     if branch == 'stable':
23     switch = 'selected'
24     click = os.path.join("archs",arch)
25     else:
26     switch = 'unselected'
27     click = os.path.join("archs",arch,"stable")
28     s = '''%s<td class="%s"><a href="%s%s/">stable</a></td>''' % (s,switch,base,click)
29     if branch == 'testing':
30     switch = 'selected'
31     click = os.path.join("archs",arch)
32     else:
33     switch = 'unselected'
34     click = os.path.join("archs",arch,"testing")
35     s = '''%s<td class="%s"><a href="%s%s/">testing</a></td></tr>\n''' % (s,switch,base,click)
36     s = '''%s<tr>''' % s
37     percent = 100/len(config.ARCHLIST)
38     for arch2 in config.ARCHLIST:
39     if arch2 == arch:
40     switch = 'selected'
41     click = ''
42     else:
43     switch = 'unselected'
44     click = os.path.join("archs",arch2)
45     s = ('%s<td class="%s" width="%s%%"><a href="%s%s/">%s</a></td>\n'
46     % (s,switch,percent,base,click,arch2))
47    
48     s = '''%s</tr>\n</table>\n\n''' % s
49     return s
50    
51     if __name__ == '__main__':
52     symlinks = ['altmenu.html','head.html','index.shtml','menu.html']
53     for arch in [''] + config.ARCHLIST:
54     for branch in ('','stable','testing'):
55     outdir = os.path.join(config.LOCALHOME,"archs",arch,branch)
56     os.system('mkdir -p "%s"' % outdir)
57     if arch != '':
58     for l in symlinks:
59     command ='ln -s %s/archs/%s %s/' % (
60     config.LOCALHOME,l,outdir)
61     print command
62     os.system(command)
63     outfile = os.path.join(outdir,"archnav.html")
64     s = genarchbar(config.FEHOME,arch,branch)
65     open(outfile,'w').write(s)

  ViewVC Help
Powered by ViewVC 1.1.20