return ld
-def generate_pkgpage(pkg, cfg, db, template, addenum_dir):
+def generate_pkgpage(pkg, cfg, db, template, addenum_dir, extracts_dir):
+ print pkg
# local binding for ease of use
pkgdb = db[pkg]
# do nothing if there is not at least the very basic stuff
underline = '*' * (len(title) + 2)
title = '%s\n %s\n%s' % (underline, title, underline)
+ ex_dir = None
+ if 'sv' in pkgdb['main']:
+ ex_dir = os.path.join(extracts_dir, pkgdb['main']['sv'].split()[0])
+ if not os.path.exists(ex_dir):
+ ex_dir = None
page = template.render(
pkg=pkg,
title=title,
assure_unicode(pkgdb['main']['long_description'])),
cfg=cfg,
db=pkgdb,
- fulldb=db)
+ fulldb=db,
+ extracts_dir=ex_dir,
+ op=os.path)
# the following can be replaced by something like
# {% include "sidebar.html" ignore missing %}
# in the template whenever jinja 2.2 becomes available
sl.close()
-def write_pkgpages(jinja_env, cfg, db, outdir, addenum_dir):
+def write_pkgpages(jinja_env, cfg, db, outdir, addenum_dir, extracts_dir):
create_dir(outdir)
create_dir(os.path.join(outdir, 'pkgs'))
# and now each individual package page
pkg_template = jinja_env.get_template('pkg.rst')
for p in db.keys():
- page = generate_pkgpage(p, cfg, db, pkg_template, addenum_dir)
+ page = generate_pkgpage(p, cfg, db, pkg_template, addenum_dir, extracts_dir)
# when no page is available skip this package
if page is None:
continue
op.add_option("--pkgaddenum", action="store", dest="addenum_dir",
type="string", default=None, help="None")
+ op.add_option("--extracts", action="store", dest="extracts_dir",
+ type="string", default=None, help="None")
+
def main():
op = OptionParser(version="%prog 0.0.2")
jinja_env = Environment(loader=PackageLoader('neurodebian', 'templates'))
# generate package pages and TOC and write them to files
- write_pkgpages(jinja_env, cfg, db, opts.outdir, opts.addenum_dir)
+ write_pkgpages(jinja_env, cfg, db, opts.outdir, opts.addenum_dir, opts.extracts_dir)
write_sourceslist(jinja_env, cfg, opts.outdir)
<p><a href="{{ db.main.homepage }}">
<img border="0" src="../_static/go-home.png" title="Go to {{ pkg }} homepage" /></a>
+ {%- if extracts_dir -%}
+ {%- if op.exists(op.join(extracts_dir, 'copyright')) -%}
+ <a href="../debian/extracts/{{ db.main.sv.split()[0] }}/copyright">
+ <img border="0" src="../_static/legal.png" title="Copyright information for this package" /></a>
+ {%- endif -%}
+ {%- if op.exists(op.join(extracts_dir, 'changelog')) -%}
+ <a href="../debian/extracts/{{ db.main.sv.split()[0] }}/changelog">
+ <img border="0" src="../_static/debian-changelog.png" title="Debian changelog of this software" /></a>
+ {%- endif -%}
+ {%- if op.exists(op.join(extracts_dir, 'README.Debian')) -%}
+ <a href="../debian/extracts/{{ db.main.sv.split()[0] }}/README.Debian">
+ <img border="0" src="../_static/info.png" title="Information on Debian-specific aspects of this software" /></a>
+ {%- endif -%}
+ {%- endif -%}
{%- if cfg.has_option("nitrc ids", pkg) -%}
<a href="http://www.nitrc.org/project?group_id={{ cfg.get("nitrc ids", pkg) }}">
<img border="0" src="../_static/nitrc_listed.png" title="See the entry on nitrc.org" /></a>