[gtk-doc] mkman: split into wrapper and module
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] mkman: split into wrapper and module
- Date: Fri, 31 Mar 2017 18:51:44 +0000 (UTC)
commit 177b28e3361aa262a7ca66a28efcd13eb4c29912
Author: Stefan Sauer <ensonic users sf net>
Date: Fri Mar 31 20:51:05 2017 +0200
mkman: split into wrapper and module
Makefile.am | 6 ++-
gtkdoc-mkman.in | 119 +++++++++++++++++++-------------------------------
gtkdoc/config.py.in | 10 ++++-
gtkdoc/mkman.py | 74 +++++++++++++++++++++++++++++++
4 files changed, 132 insertions(+), 77 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 75e8373..4c20b34 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,7 +38,8 @@ pylibdatadir = $(datadir)/gtk-doc/python/gtkdoc
pylibdata_DATA = \
gtkdoc/__init__.py \
gtkdoc/check.py \
- gtkdoc/config.py
+ gtkdoc/config.py \
+ gtkdoc/mkman.py
pkgconfigdir = $(datadir)/pkgconfig
pkgconfig_DATA = gtk-doc.pc
@@ -78,7 +79,8 @@ CLEANFILES = \
gtkdoc-rebasec \
gtkdoc/__init__.pyc \
gtkdoc/check.pyc \
- gtkdoc/config.pyc
+ gtkdoc/config.pyc \
+ gtkdoc/mkman.pyc
DISTCLEANFILES = \
gtkdoc-check \
diff --git a/gtkdoc-mkman.in b/gtkdoc-mkman.in
index ebb9c3a..e2b9192 100644
--- a/gtkdoc-mkman.in
+++ b/gtkdoc-mkman.in
@@ -1,75 +1,46 @@
#!@PYTHON@
-
-# Support both Python 2 and 3
-from __future__ import print_function
-
-import os, sys, argparse, subprocess
-from glob import glob
-
-version = '@VERSION@'
-xsltproc = '@XSLTPROC@'
-
-parser = argparse.ArgumentParser(description='gtkdoc-mkman version %s - generate documentation in man
format' % version)
-
-parser.add_argument('--verbose', default=False, action='store_true',
- help='Print extra output while processing')
-parser.add_argument('--path', default='',
- help='Extra source directories')
-parser.add_argument('version', default=False, action='store_true',
- help='Print the version of this program')
-parser.add_argument('args', nargs=2,
- help='MODULE DRIVER_FILE')
-parser.add_argument('--uninstalled', action='store_true', default=False,
- help='???')
-
-options = parser.parse_args()
-if options.version:
- print(version)
- sys.exit(0)
-
-module=options.args[0]
-document=options.args[1]
-if options.verbose:
- quiet = '0'
-else:
- quiet = '1'
-
-if options.uninstalled:
- # this does not work from buiddir!=srcdir
- gtkdocdir=os.path.split(sys.argv[0])[0]
- #echo "uninstalled, gtkdocdir=$gtkdocdir"
-else:
- # the first vars are needed to resolve datadir
- prefix='@prefix@'
- datarootdir="@datarootdir@".replace('${prefix}', prefix)
- datadir="@datadir@".replace('${datarootdir}', datarootdir)
- gtkdocdir=os.path.join(datadir, 'gtk-doc/data')
-
-# we could do "$path_option $PWD "
-# to avoid needing rewriting entities that are copied from the header
-# into docs under xml
-if options.path == '':
- path_arg=[]
-else:
- path_arg=[path_option, options.path]
-
-# would it make sense to create man pages only for certain refentries
-# e.g. for tools
-# see http://bugzilla.gnome.org/show_bug.cgi?id=467488
-subprocess.check_call([xsltproc] + path_arg +[
- '--nonet',
- '--xinclude',
- '--stringparam',
- 'gtkdoc.bookname',
- module,
- '--stringparam',
- 'gtkdoc.version',
- version,
- '--stringparam',
- 'chunk.quietly ',
- quiet,
- '--stringparam',
- 'chunker.output.quiet',
- quiet,
- 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
- document])
+# -*- python; coding: utf-8 -*-
+#
+# gtk-doc - GTK DocBook documentation generator.
+# Copyright (C) 1998 Owen Taylor
+# 2001-2005 Damon Chaplin
+# 2009-2017 Stefan Sauer
+# 2017 Jussi Pakkanen
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+import argparse, sys
+sys.path.append('@PYTHON_PACKAGE_DIR@')
+
+from gtkdoc import config, mkman
+
+if __name__== '__main__':
+ parser = argparse.ArgumentParser(
+ description='gtkdoc-mkman version %s - generate documentation in man format' % config.version)
+ parser.add_argument('--version', action='version', version=config.version)
+ parser.add_argument('--verbose', default=False, action='store_true',
+ help='Print extra output while processing')
+ parser.add_argument('--path', default='',
+ help='Extra source directories')
+ parser.add_argument('args', nargs=2,
+ help='MODULE DRIVER_FILE')
+ # TODO: only for testing, replace with env-var
+ parser.add_argument('--uninstalled', action='store_true', default=False,
+ help='???')
+
+ options = parser.parse_args()
+
+ sys.exit(mkman.run(options))
\ No newline at end of file
diff --git a/gtkdoc/config.py.in b/gtkdoc/config.py.in
index 4286b8f..30d959e 100644
--- a/gtkdoc/config.py.in
+++ b/gtkdoc/config.py.in
@@ -1 +1,9 @@
-version = "@VERSION@"
\ No newline at end of file
+version = "@VERSION@"
+
+# tools
+xsltproc = '@XSLTPROC@'
+
+# configured directories
+prefix='@prefix@'
+datarootdir="@datarootdir@".replace('${prefix}', prefix)
+datadir="@datadir@".replace('${datarootdir}', datarootdir)
diff --git a/gtkdoc/mkman.py b/gtkdoc/mkman.py
new file mode 100644
index 0000000..b3fca8f
--- /dev/null
+++ b/gtkdoc/mkman.py
@@ -0,0 +1,74 @@
+#!@PYTHON@
+# -*- python; coding: utf-8 -*-
+#
+# gtk-doc - GTK DocBook documentation generator.
+# Copyright (C) 1998 Owen Taylor
+# 2001-2005 Damon Chaplin
+# 2009-2017 Stefan Sauer
+# 2017 Jussi Pakkanen
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+# Support both Python 2 and 3
+from __future__ import print_function
+
+import os, sys, argparse, subprocess
+from glob import glob
+
+from . import config
+
+
+def run(options):
+ module = options.args[0]
+ document = options.args[1]
+ if options.verbose:
+ quiet = '0'
+ else:
+ quiet = '1'
+
+ if options.uninstalled:
+ # TODO: this does not work from buiddir!=srcdir
+ gtkdocdir = os.path.split(sys.argv[0])[0]
+ else:
+ gtkdocdir = os.path.join(config.datadir, 'gtk-doc/data')
+
+ # we could do "$path_option $PWD " to avoid needing rewriting entities that
+ # are copied from the header into docs under xml
+ if options.path == '':
+ path_arg = []
+ else:
+ path_arg = [path_option, options.path]
+
+ # would it make sense to create man pages only for certain refentries
+ # e.g. for tools
+ # see http://bugzilla.gnome.org/show_bug.cgi?id=467488
+ return subprocess.call([config.xsltproc] + path_arg + [
+ '--nonet',
+ '--xinclude',
+ '--stringparam',
+ 'gtkdoc.bookname',
+ module,
+ '--stringparam',
+ 'gtkdoc.version',
+ config.version,
+ '--stringparam',
+ 'chunk.quietly ',
+ quiet,
+ '--stringparam',
+ 'chunker.output.quiet',
+ quiet,
+ 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
+ document])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]