]> git.donarmstrong.com Git - neurodebian.git/commitdiff
Put icon links to extracts from DSCs (README, changelog, copyright)
authorNeuroDebian Wizard <neurodebian@pymvpa.org>
Thu, 6 Jan 2011 16:44:59 +0000 (11:44 -0500)
committerNeuroDebian Wizard <neurodebian@pymvpa.org>
Thu, 6 Jan 2011 16:44:59 +0000 (11:44 -0500)
Makefile
neurodebian/dde.py
neurodebian/templates/pkg.rst
sphinx/_static/changelog.png [new file with mode: 0644]
sphinx/_static/debian-changelog.png [new file with mode: 0644]
sphinx/_static/info.png [new file with mode: 0644]
sphinx/_static/legal.png [new file with mode: 0644]

index dd9097c32b44ee5a94a517bb6a7621a89d5b40ca..4f37cf71ae3b7012393a60c6a02db4bc7fabd198 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,7 @@ source-stamp: build/db.db
                --db build/db.db \
                --outdir build/src \
                --pkgaddenum pkgs \
+               --extracts /home/www/neuro.debian.net/www/debian/extracts \
                commandisirrelevant
        rm -f html-stamp
        touch $@
index c93814b11b8c6f97fa3be1b38be906e2190cc0b1..4325e90961280e8280f71aa6a919e2c596443b84 100755 (executable)
@@ -583,7 +583,8 @@ def convert_longdescr(ld):
     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
@@ -593,6 +594,11 @@ def generate_pkgpage(pkg, cfg, db, template, addenum_dir):
     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,
@@ -600,7 +606,9 @@ def generate_pkgpage(pkg, cfg, db, template, addenum_dir):
                 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
@@ -650,7 +658,7 @@ def write_sourceslist(jinja_env, cfg, outdir):
     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'))
 
@@ -675,7 +683,7 @@ def write_pkgpages(jinja_env, cfg, db, outdir, addenum_dir):
     # 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
@@ -710,6 +718,9 @@ def prepOptParser(op):
     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")
@@ -773,7 +784,7 @@ def main():
     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)
 
index 5290b0a72e2717681515fc4c6ed18a773ab8d738..17af598d543c2247f94bd1d59690da281fc2dc99 100644 (file)
@@ -12,6 +12,20 @@ External links:
 
   <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>
diff --git a/sphinx/_static/changelog.png b/sphinx/_static/changelog.png
new file mode 100644 (file)
index 0000000..9330fe5
Binary files /dev/null and b/sphinx/_static/changelog.png differ
diff --git a/sphinx/_static/debian-changelog.png b/sphinx/_static/debian-changelog.png
new file mode 100644 (file)
index 0000000..f776990
Binary files /dev/null and b/sphinx/_static/debian-changelog.png differ
diff --git a/sphinx/_static/info.png b/sphinx/_static/info.png
new file mode 100644 (file)
index 0000000..9361915
Binary files /dev/null and b/sphinx/_static/info.png differ
diff --git a/sphinx/_static/legal.png b/sphinx/_static/legal.png
new file mode 100644 (file)
index 0000000..08fc8e1
Binary files /dev/null and b/sphinx/_static/legal.png differ