[cpl-plugin-uves] 01/01: Put parameter section only if there are parameters
Ole Streicher
olebole-guest at moszumanska.debian.org
Thu Dec 12 11:18:09 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-uves.
commit 53a26e96b01cce3fa464ecac7d98ac4dcdd04039
Author: Ole Streicher <debian at liska.ath.cx>
Date: Mon Dec 9 11:27:29 2013 +0100
Put parameter section only if there are parameters
---
debian/create_sphinx.py | 66 +++++++++++++++++++++++++++----------------------
1 file changed, 36 insertions(+), 30 deletions(-)
diff --git a/debian/create_sphinx.py b/debian/create_sphinx.py
index f43a505..c99d4b8 100644
--- a/debian/create_sphinx.py
+++ b/debian/create_sphinx.py
@@ -33,30 +33,7 @@ Constructor
import cpl
{recipe} = cpl.Recipe("{recipe}")
-Parameters
-----------
-
-{pars}
-
-The following code snippet shows the default settings for the available
-parameters.
-
-::
-
- import cpl
- {recipe} = cpl.Recipe("{recipe}")
-
-{pars_example1}
-
-You may also set or overwrite some or all parameters by the recipe
-parameter `param`, as shown in the following example:
-
-::
-
- import cpl
- {recipe} = cpl.Recipe("{recipe}")
- [...]
- res = {recipe}( ..., param = {{{pars_example2}}})
+{parameters}
.. seealso:: `cpl.Recipe <http://packages.python.org/python-cpl/recipe.html>`_
for more information about the recipe object.
@@ -124,6 +101,32 @@ Support Department <usd-help at eso.org>`_, describing:
* whether the problem is repeatable.
'''
+rst_partemplate = '''Parameters
+----------
+
+{pars}
+
+The following code snippet shows the default settings for the available
+parameters.
+
+::
+
+ import cpl
+ {recipe} = cpl.Recipe("{recipe}")
+
+{pars_example1}
+
+You may also set or overwrite some or all parameters by the recipe
+parameter `param`, as shown in the following example:
+
+::
+
+ import cpl
+ {recipe} = cpl.Recipe("{recipe}")
+ [...]
+ res = {recipe}( ..., param = {{{pars_example2}}})
+'''
+
conf_template = '''project = u'{PIPELINE} pipeline'
version = '{version}'
release = '{version}'
@@ -183,7 +186,7 @@ def get_description(s):
o += [ s ]
return "\n".join(o)
-def rstpage(recipe, template):
+def rstpage(recipe, template, partemplate):
return template.format(
recipe = recipe.__name__,
version = recipe.__version__,
@@ -193,16 +196,19 @@ def rstpage(recipe, template):
author = recipe.__author__,
license = recipe.__copyright__,
pipeline = pipeline,
- pars = par(recipe, par_template),
- pars_example1 = par(recipe, ' {recipe}.param.{par} = {default}\n'),
- pars_example2 = par(recipe, '"{par}":{default}', ', ', 2)
+ parameters = partemplate.format(
+ recipe = recipe.__name__,
+ pars = par(recipe, par_template),
+ pars_example1 = par(recipe,
+ ' {recipe}.param.{par} = {default}\n'),
+ pars_example2 = par(recipe, '"{par}":{default}', ', ', 2)
+ ) if len(recipe.param) > 0 else ''
)
-
for recipe in recipes_oca + recipes_x:
f = open(os.path.join("sphinx",
fname_template.format(recipe = recipe.__name__)), "w")
- f.write(rstpage(recipe, rst_template))
+ f.write(rstpage(recipe, rst_template, rst_partemplate))
f.close()
if len(recipes_oca) > 0 and len(recipes_x) > 0:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cpl-plugin-uves.git
More information about the debian-science-commits
mailing list