[cpl-plugin-uves] 25/42: Generate manpages for all recipes
Ole Streicher
olebole-guest at moszumanska.debian.org
Mon Dec 2 09:48:13 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 ca83773ed582e1dffb531c52bcd6d54af81f7863
Author: Ole Streicher <debian at liska.ath.cx>
Date: Thu Oct 24 22:10:27 2013 +0200
Generate manpages for all recipes
---
debian/control | 2 +-
debian/cpl-plugin.manpages.in | 2 +
debian/create_manpage.py | 97 +++++++++++++++++++++++++++++++++++++++++++
debian/rules | 13 ++++--
4 files changed, 110 insertions(+), 4 deletions(-)
diff --git a/debian/control b/debian/control
index f882cf9..ec0c09f 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: science
Priority: optional
Maintainer: Debian Science Maintainers <debian-science-maintainers at lists.alioth.debian.org>
Uploaders: Ole Streicher <debian at liska.ath.cx>
-Build-Depends: debhelper (>= 9), dh-autoreconf, libcpl-dev (>= 5.3.1)
+Build-Depends: debhelper (>= 9), dh-autoreconf, libcpl-dev (>= 5.3.1), python, python-cpl
Standards-Version: 3.9.4
Homepage: http://www.eso.org/sci/software/pipelines/template
Vcs-Git: git://git.debian.org/git/debian-science/packages/cpl-plugin-template.git
diff --git a/debian/cpl-plugin.manpages.in b/debian/cpl-plugin.manpages.in
new file mode 100644
index 0000000..d6cc88c
--- /dev/null
+++ b/debian/cpl-plugin.manpages.in
@@ -0,0 +1,2 @@
+man/*.7
+
diff --git a/debian/create_manpage.py b/debian/create_manpage.py
new file mode 100644
index 0000000..a885071
--- /dev/null
+++ b/debian/create_manpage.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+
+import cpl
+import os
+import sys
+
+man_template = '''.TH {NAME} "{section}" "{version}" "{name}" "{pipeline} recipes"
+.SH NAME
+{name} \\- {synopsis}
+
+.SH SYNOPSIS
+esorex
+.B {name}
+[OPTIONS] FILE.sof
+
+.SH DESCRIPTION
+{description}
+
+.SH OPTIONS
+{options}
+.PP
+Note that it is possible to create a configuration file containing these
+options, along with suitable default values. Please refer to the details
+provided by the 'esorex --help' command.
+
+.SH SEE ALSO
+{seealso}
+
+.SH VERSION
+{name} {version}
+
+.SH BUGS
+Please report any problems to {email}.
+
+.SH AUTHOR
+{author}
+
+.SH LICENSE
+{license}
+'''
+
+opt_template = '''.TP
+\\fB\\-\\-{name}\\fR \\fI<{type}>\\fR
+{description}. The full name of this option for the EsoRex configuration
+file is \\fB{fullname}\\fR [default={default}].
+'''
+
+fname_template ="{name}.{section}"
+
+section = 7
+pipeline = sys.argv[1]
+
+cpl.Recipe.path = "recipes"
+recipes = cpl.Recipe.list()
+
+def options(recipe):
+ opt = ""
+ for p in recipe.param:
+ opt += opt_template.format(name = p.name,
+ fullname = p.fullname,
+ type = p.type.__name__,
+ description = p.__doc__,
+ default = p.default)
+ return opt
+
+def seealso(recipe):
+ s = "esorex (1)"
+ for name,v in recipes:
+ if (name != recipe.__name__):
+ s += ", {name} ({section})".format(name = name,
+ section=section)
+ return s
+
+def manpage(recipe):
+ description = recipe.description[1] \
+ .replace("\n", "\n.br\n") \
+ .replace("-", "\\-")
+ return man_template.format(name = recipe.__name__,
+ NAME = recipe.__name__.upper(),
+ section = section,
+ version = recipe.__version__,
+ synopsis = recipe.description[0],
+ description = description,
+ seealso = seealso(recipe),
+ email = recipe.__email__,
+ author = recipe.__author__,
+ license = recipe.__copyright__,
+ pipeline = pipeline,
+ options = options(recipe))
+
+for name, version in recipes:
+ recipe = cpl.Recipe(name)
+ f = open(os.path.join("man",
+ fname_template.format(name = name,
+ section=section)), "w")
+ f.write(manpage(recipe))
+ f.close()
diff --git a/debian/rules b/debian/rules
index 3f7584f..b02bf80 100755
--- a/debian/rules
+++ b/debian/rules
@@ -15,10 +15,10 @@ get-orig-source:
debian_files:
if [ -d calib/cal ] ; then \
- dfiles=".install -calib.install" ; \
+ dfiles=".install .manpages -calib.install" ; \
else \
cp -f debian/README.Debian.in debian/README.Debian ; \
- dfiles=".install -calib.postinst -calib.prerm -calib.lintian-overrides" ; \
+ dfiles=".install .manpages -calib.postinst -calib.prerm -calib.lintian-overrides" ; \
fi ; \
for f in $$dfiles ; do \
sed "s/__VERSION__/$(VERSION)/g;s/__PIPELINE__/${PIPELINE}/g" \
@@ -29,14 +29,21 @@ debian_files:
override_dh_install: debian_files
dh_install
+override_dh_installman:
+ mkdir -p man
+ python debian/create_manpage.py ${PIPELINE}
+ dh_installman
+
override_dh_clean:
dh_clean
rm -f debian/${DEBPKGNAME}.install \
+ debian/${DEBPKGNAME}.manpages \
debian/${DEBPKGNAME}-calib.lintian-overrides \
debian/${DEBPKGNAME}-calib.install \
debian/${DEBPKGNAME}-calib.postinst \
debian/${DEBPKGNAME}-calib.prerm \
- debian/README.Debian
+ debian/README.Debian \
+ man
override_dh_auto_configure:
dh_auto_configure -- --prefix=/usr/
--
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