[cpl-plugin-vimos] 01/02: Remove cpl.Recipe._recipe after use to avoid crashes.

Ole Streicher olebole-guest at alioth.debian.org
Thu Nov 7 15:44:50 UTC 2013


This is an automated email from the git hooks/post-receive script.

olebole-guest pushed a commit to branch debian
in repository cpl-plugin-vimos.

commit 0866173cbc43ea6837675fb6a381f08ba8cb9285
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Thu Nov 7 16:40:36 2013 +0100

    Remove cpl.Recipe._recipe after use to avoid crashes.
---
 debian/create_sphinx.py |   43 +++++++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 18 deletions(-)

diff --git a/debian/create_sphinx.py b/debian/create_sphinx.py
index c6578a5..f0da93b 100644
--- a/debian/create_sphinx.py
+++ b/debian/create_sphinx.py
@@ -135,10 +135,10 @@ html_theme = 'sphinxdoc'
 pipeline = sys.argv[1]
 
 cpl.Recipe.path = "recipes"
-recipes = [ cpl.Recipe(name) for name, version in cpl.Recipe.list() ]
+recipes = [ name for name, version in cpl.Recipe.list() ]
 oca = file(os.path.join("calib", "gasgano", "config", pipeline + ".oca")).read()
-recipes_oca = [recipe for recipe in recipes if recipe.__name__ in oca]
-recipes_x = [recipe for recipe in recipes if not recipe.__name__ in oca]
+recipes_oca = [name for name in recipes if name in oca]
+recipes_x = [name for name in recipes if not name in oca]
 
 def par(recipe, template, delimiter = "", count = None):
     return delimiter.join(template.format(
@@ -195,43 +195,50 @@ def rstpage(recipe, template):
         pars_example2 = par(recipe, '"{par}":{default}', ', ', 2)
     )
 
-
-for recipe in recipes_oca + recipes_x:
+version = ""
+for name in recipes_oca + recipes_x:
+    recipe = cpl.Recipe(name)
     f = open(os.path.join("sphinx",
                           fname_template.format(recipe = recipe.__name__)), "w")
     f.write(rstpage(recipe, rst_template))
     f.close()
+    version = recipe.__version__
+    del recipe._recipe
 
 if len(recipes_oca) > 0 and len(recipes_x) > 0:
     toc_recipes = "Standard recipes\n----------------\n"
 
-toc_recipes += "\n\n".join(":data:`{recipe}`\n   {synopsis}".format(
-    recipe = recipe.__name__,
-    synopsis = recipe.description[0]
-) for recipe in recipes_oca)
+for name in recipes_oca:
+    recipe = cpl.Recipe(name)
+    toc_recipes += "\n:data:`{recipe}`\n   {synopsis}\n".format(
+        recipe = recipe.__name__,
+        synopsis = recipe.description[0])
+    del recipe._recipe
 
 if len(recipes_oca) > 0 and len(recipes_x) > 0:
-    toc_recipes += "\n\nAdditional recipes\n--------------------\n"
+    toc_recipes += "\nAdditional recipes\n--------------------\n"
 
-toc_recipes += "\n\n".join(":data:`{recipe}`\n   {synopsis}".format(
-    recipe = recipe.__name__,
-    synopsis = recipe.description[0]
-) for recipe in recipes_x)
+for name in recipes_x:
+    recipe = cpl.Recipe(name)
+    toc_recipes += "\n:data:`{recipe}`\n   {synopsis}\n".format(
+        recipe = recipe.__name__,
+        synopsis = recipe.description[0])
+    del recipe._recipe
 
 toc = "\n".join("   {recipe}".format(
-    recipe = recipe.__name__
-) for recipe in recipes_oca + recipes_x)
+    recipe = name
+) for name in recipes_oca + recipes_x)
 
 f = open(os.path.join("sphinx", "index.rst"), "w")
 f.write(index_template.format(toctree = toc,
                               recipes = toc_recipes,
                               pipeline = pipeline,
                               PIPELINE = pipeline.upper(),
-                              version = recipes[0].__version__))
+                              version = version))
 f.close()
 
 f = open(os.path.join("sphinx", "conf.py"), "w")
 f.write(conf_template.format(PIPELINE = pipeline.upper(),
-                             version = recipes[0].__version__))
+                             version = version))
 f.close()
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cpl-plugin-vimos.git



More information about the debian-science-commits mailing list