summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-01-13 05:57:20 -0800
committerStefano Karapetsas <[email protected]>2014-01-13 05:57:20 -0800
commit342daa42359da5edb023cbd6bb6afd4fd63a088c (patch)
tree08f23ffbaab794432dcb18d5bdc554d37e495db3
parent276b5f84da52084c31321cb363f90e2de55242e0 (diff)
parent0ce31a551ded5d0e03a7309a0cfcb38add3d203a (diff)
downloadpython-caja-342daa42359da5edb023cbd6bb6afd4fd63a088c.tar.bz2
python-caja-342daa42359da5edb023cbd6bb6afd4fd63a088c.tar.xz
Merge pull request #12 from infirit/master
Revert "Do not dlopen libpython" + various fixes and cleanups
-rw-r--r--Makefile.am18
-rw-r--r--caja-python.pc.in3
-rw-r--r--configure.ac29
-rw-r--r--docs/Makefile.am38
-rw-r--r--docs/xsl/common.xsl19
-rw-r--r--docs/xsl/devhelp.xsl154
-rwxr-xr-xdocs/xsl/fixxref.py67
-rw-r--r--docs/xsl/html.xsl285
-rw-r--r--docs/xsl/pdf-style.xsl11
-rw-r--r--docs/xsl/pdf.xsl259
-rw-r--r--docs/xsl/ref-html-style.xsl54
-rw-r--r--docs/xsl/style.css10
-rw-r--r--src/Makefile.am27
-rw-r--r--src/caja-python.c6
14 files changed, 944 insertions, 36 deletions
diff --git a/Makefile.am b/Makefile.am
index 1ba7536..0f38bf8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,9 +4,25 @@ if ENABLE_GTK_DOC
SUBDIRS += docs
endif
+ACLOCAL_AMFLAGS = -I m4 -I . ${ACLOCAL_FLAGS}
+
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = caja-python.pc
EXTRA_DIST = caja-python.pc.in
-DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
+DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --with-cajadir='$${libdir}/caja/extensions-2.0-distcheck'
+
+dist-hook:
+ @if test -d "$(srcdir)/.git"; \
+ then \
+ echo Creating ChangeLog && \
+ ( cd "$(top_srcdir)" && \
+ echo '# Generated by Makefile. Do not edit.'; echo; \
+ $(top_srcdir)/missing --run git log --stat ) > ChangeLog.tmp \
+ && mv -f ChangeLog.tmp $(distdir)/ChangeLog \
+ || ( rm -f ChangeLog.tmp ; \
+ echo Failed to generate ChangeLog >&2 ); \
+ else \
+ echo A git clone is required to generate a ChangeLog >&2; \
+ fi
diff --git a/caja-python.pc.in b/caja-python.pc.in
index 280e1dc..0e72f15 100644
--- a/caja-python.pc.in
+++ b/caja-python.pc.in
@@ -3,5 +3,6 @@ Description: Caja-Python Components
Version: @VERSION@
prefix=@prefix@
+datarootdir = @datarootdir@
libdir=${prefix}/lib
-pythondir=${datadir}/caja-python/extensions
+pythondir=@datadir@/caja-python/extensions
diff --git a/configure.ac b/configure.ac
index 9c80db0..0f1d737 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,14 +1,14 @@
-AC_INIT([caja-python], [1.6.0], [http://mate-desktop.org])
+AC_INIT([python-caja], [1.6.0],
+ [https://github.com/mate-desktop/python-caja/issues],
+ [python-caja], [http://mate-desktop.org])
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE(1.10 dist-xz no-dist-gzip)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
-AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .")
-
CAJA_REQUIRED=1.6.0
AC_PROG_CC
@@ -19,15 +19,13 @@ dnl Check for pkgconfig first
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-dnl Check for gtk-doc
-GTK_DOC_CHECK(1.9)
-
-dnl Give error and exit if we dont have pkgconfig
+dnl Give error and exit if we don't have pkgconfig
if test "x$HAVE_PKGCONFIG" = "xno"; then
AC_MSG_ERROR([you need to have pkgconfig installed !])
fi
-AC_PREFIX_DEFAULT([$(pkg-config --variable=prefix libcaja-extension || echo /usr)])
+dnl Check for gtk-doc
+GTK_DOC_CHECK(1.9)
dnl **************************************************
dnl * Check for Python
@@ -71,9 +69,16 @@ AC_DEFINE_UNQUOTED(CAJA_LIBDIR, "$CAJA_LIBDIR", [Caja libdir])
dnl ---------------------------------
dnl Get caja extensions directory
dnl ---------------------------------
-CAJA_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libcaja-extension`
-AC_SUBST(CAJA_EXTENSION_DIR)
-AC_DEFINE_UNQUOTED(CAJA_EXTENSION_DIR, "$CAJA_EXTENSION_DIR", [Caja extensions directory])
+AC_ARG_WITH(cajadir,
+ AS_HELP_STRING([--with-cajadir=DIR],[Installation path for Caja extension @<:@auto@:>@]),
+ [ac_with_cajadir=$withval],
+ [ac_with_cajadir=""])
+if test "${ac_with_cajadir}" = ""; then
+ ac_with_cajadir=`$PKG_CONFIG --variable=extensiondir libcaja-extension`
+fi
+
+AC_MSG_NOTICE([installing caja plugin in ${ac_with_cajadir}])
+AC_SUBST([CAJA_EXTENSION_DIR], [${ac_with_cajadir}])
dnl ---------------------------------
dnl Check for gtk-doc dependencies
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 6416f94..d406f66 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -3,10 +3,10 @@ BUILDDIR = $(top_builddir)/docs
REF_VERSION = $(VERSION)
FULL_VERSION = $(VERSION)
-HTML_STYLE = $(PYGOBJECT_DATADIR)/pygobject/xsl/ref-html-style.xsl
-PDF_STYLE = $(PYGOBJECT_DATADIR)/pygobject/xsl/pdf-style.xsl
+FIXXREF = $(srcdir)/xsl/fixxref.py
+HTML_STYLE = $(srcdir)/xsl/ref-html-style.xsl
-XMLFILES = \
+XML_FILES = \
reference/caja-python-ref.xml \
reference/caja-python-overview.xml \
reference/caja-python-overview-example.xml \
@@ -27,7 +27,7 @@ XMLFILES = \
reference/caja-python-operation-result.xml
HTMLdir = $(datadir)/gtk-doc/html/caja-python
-HTMLFILES = \
+HTML_FILES = \
html/index.html \
html/index.sgml \
html/caja-python-overview.html \
@@ -48,39 +48,55 @@ HTMLFILES = \
html/caja-python-enum-reference.html \
html/enum-caja-python-operation-result.html \
html/caja-python.devhelp
+HTML_DATA = $(HTML_FILES)
-CSS_FILES = $(PYGOBJECT_PYGDOCS)/style.css
+XSL_FILES = \
+ xsl/common.xsl \
+ xsl/devhelp.xsl \
+ xsl/html.xsl \
+ xsl/pdf-style.xsl \
+ xsl/pdf.xsl \
+ xsl/style.css
+XSL_DATA = $(XSL_FILES) $(FIXXREF)
+XSLdir = $(BUILDDIR)/xsl
+
+CSS_FILES = xsl/style.css
CSSdir = $(HTMLdir)
CSS_DATA = $(CSS_FILES)
BUILT_SOURCES = \
reference/builddate.xml \
- $(HTMLFILES)
+ $(HTML_FILES)
CLEANFILES = \
caja-python-ref.* \
reference/builddate.xml \
- $(HTMLFILES)
+ $(HTML_FILES)
EXTRA_DIST = \
- $(XMLFILES)
+ $(XML_FILES) \
+ $(XSL_FILES) \
+ $(FIXXREF) \
+ $(HTML_STYLE)
REFERENCE_DEPS = \
reference \
- $(XMLFILES)
+ $(XML_FILES) \
+ $(XSL_FILES) \
+ $(FIXXREF)
if ENABLE_GTK_DOC
reference/builddate.xml: $(REFERENCE_DEPS)
$(PYTHON) -c 'import datetime; print datetime.date.today()' > $@
-$(HTMLFILES): $(REFERENCE_DEPS)
+$(HTML_FILES): $(REFERENCE_DEPS)
xsltproc --nonet --xinclude -o $(BUILDDIR)/html/ \
--path $(BUILDDIR)/reference:$(srcdir)/reference \
--stringparam gtkdoc.bookname "caja-python" \
--stringparam gtkdoc.version ${REF_VERSION} \
$(HTML_STYLE) $(srcdir)/reference/caja-python-ref.xml
- $(PYGOBJECT_FIXXREF) -i $(PYGOBJECT_PYGDOCS) $(BUILDDIR)/html
+ $(FIXXREF) -i xsl $(BUILDDIR)/html
touch $@
endif
diff --git a/docs/xsl/common.xsl b/docs/xsl/common.xsl
new file mode 100644
index 0000000..606313f
--- /dev/null
+++ b/docs/xsl/common.xsl
@@ -0,0 +1,19 @@
+<?xml version='1.0'?>
+<!DOCTYPE xsl:stylesheet [
+]>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+
+<xsl:template match="parameter">
+ <xsl:choose>
+ <xsl:when test="@role = 'keyword'">
+ <xsl:call-template name="inline.boldmonoseq"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="inline.italicmonoseq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/docs/xsl/devhelp.xsl b/docs/xsl/devhelp.xsl
new file mode 100644
index 0000000..ce27739
--- /dev/null
+++ b/docs/xsl/devhelp.xsl
@@ -0,0 +1,154 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'
+ xmlns="http://www.devhelp.net/book"
+ exclude-result-prefixes="#default">
+
+ <xsl:template name="generate.devhelp">
+ <xsl:call-template name="write.chunk">
+ <xsl:with-param name="filename">
+ <xsl:choose>
+ <xsl:when test="$gtkdoc.bookname">
+ <xsl:value-of select="$gtkdoc.bookname"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>book</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text>.devhelp</xsl:text>
+ </xsl:with-param>
+ <xsl:with-param name="method" select="'xml'"/>
+ <xsl:with-param name="indent" select="'yes'"/>
+ <xsl:with-param name="encoding" select="'utf-8'"/>
+ <xsl:with-param name="content">
+ <xsl:call-template name="devhelp"/>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template name="devhelp">
+ <xsl:variable name="title">
+ <xsl:apply-templates select="." mode="generate.devhelp.toc.title.mode"/>
+ </xsl:variable>
+ <xsl:variable name="link">
+ <xsl:call-template name="href.target"/>
+ </xsl:variable>
+ <xsl:variable name="author">
+ <xsl:if test="articleinfo|bookinfo">
+ <xsl:apply-templates mode="generate.devhelp.authors"
+ select="articleinfo|bookinfo"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:variable name="toc.nodes" select="part|reference|preface|chapter|
+ appendix|article|bibliography|
+ glossary|index|refentry|
+ bridgehead|sect1"/>
+
+ <book title="{$title}" link="{$link}" author="{$author}" name="{$gtkdoc.bookname}" language="python">
+ <xsl:if test="$toc.nodes">
+ <chapters>
+ <xsl:apply-templates select="$toc.nodes"
+ mode="generate.devhelp.toc.mode"/>
+ </chapters>
+ </xsl:if>
+ <functions>
+ <xsl:apply-templates select="//refsect1"
+ mode="generate.devhelp.constructor.index.mode"/>
+ <xsl:apply-templates select="//refsect2"
+ mode="generate.devhelp.index.mode"/>
+ </functions>
+ </book>
+ </xsl:template>
+
+ <xsl:template match="*" mode="generate.devhelp.toc.mode">
+ <xsl:variable name="title">
+ <xsl:apply-templates select="." mode="generate.devhelp.toc.title.mode"/>
+ </xsl:variable>
+ <xsl:variable name="target">
+ <xsl:variable name="anchor" select="title/anchor"/>
+ <xsl:choose>
+ <xsl:when test="$anchor">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$anchor"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="href.target"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <sub name="{$title}" link="{$target}">
+ <xsl:apply-templates select="section|sect1|
+ refentry|refsect|
+ bridgehead|part|chapter"
+ mode="generate.devhelp.toc.mode"/>
+ </sub>
+ </xsl:template>
+
+ <xsl:template match="*" mode="generate.devhelp.index.mode">
+ <xsl:variable name="title" select="title"/>
+ <xsl:variable name="anchor" select="title/anchor"/>
+ <xsl:variable name="target">
+ <xsl:choose>
+ <xsl:when test="$anchor">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$anchor"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="href.target"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <function name="{$title}" link="{$target}"/>
+ </xsl:template>
+
+ <xsl:template match="*" mode="generate.devhelp.constructor.index.mode">
+ <xsl:variable name="title" select="title"/>
+ <xsl:variable name="anchor" select="title/anchor"/>
+ <xsl:variable name="target">
+ <xsl:choose>
+ <xsl:when test="$anchor">
+ <xsl:call-template name="href.target">
+ <xsl:with-param name="object" select="$anchor"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="href.target"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:if test="$title='Constructor'">
+ <xsl:variable name ="constructor" select="programlisting//methodname"/>
+ <function name="{$constructor}" link="{$target}"/>
+ </xsl:if>
+ </xsl:template>
+
+ <!-- get title -->
+ <xsl:template match="article" mode="generate.devhelp.toc.title.mode">
+ <xsl:value-of select="articleinfo/title"/>
+ </xsl:template>
+ <xsl:template match="book" mode="generate.devhelp.toc.title.mode">
+ <xsl:value-of select="bookinfo/title"/>
+ </xsl:template>
+ <xsl:template match="refentry" mode="generate.devhelp.toc.title.mode">
+ <xsl:value-of select="refnamediv/refname"/>
+ </xsl:template>
+ <xsl:template match="*" mode="generate.devhelp.toc.title.mode">
+ <xsl:value-of select="title"/>
+ </xsl:template>
+
+ <!-- generate list of authors ... -->
+ <xsl:template match="articleinfo|bookinfo" mode="generate.devhelp.authors">
+ <xsl:for-each select="authorgroup/author">
+ <xsl:value-of select="firstname"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="surname"/>
+ <xsl:if test="not(last())">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/docs/xsl/fixxref.py b/docs/xsl/fixxref.py
new file mode 100755
index 0000000..f3287b3
--- /dev/null
+++ b/docs/xsl/fixxref.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+# -*- Mode: Python; py-indent-offset: 4 -*-
+
+import getopt
+import os
+import re
+import sys
+
+anchors = {}
+anchor_pat = re.compile(r'''^\s*<ANCHOR\s+id\s*=\s*"([^"]*)"\s+
+ href\s*=\s*"([^"]*)"\s*>''',
+ re.MULTILINE | re.VERBOSE)
+link_pat = re.compile(r'''<PYGTKDOCLINK\s+HREF="([^"]*)"\s*>(.*?)
+ </PYGTKDOCLINK\s*>''', re.DOTALL | re.VERBOSE)
+def scan_index_dir(idir):
+ for root, dirs, files in os.walk(idir):
+ if 'index.sgml' in files:
+ scan_index_file(os.path.join(root, 'index.sgml'))
+ return
+
+def scan_index_file(ifile):
+ buf = open(ifile).read()
+ for id, href in anchor_pat.findall(buf):
+ anchors[id] = href
+
+def fix_xrefs(hdir):
+ for f in os.listdir(hdir):
+ if os.path.splitext(f)[1] == '.html':
+ fix_html_file(os.path.join(hdir, f))
+
+def link_subst(m):
+ id, text = m.groups()
+ if anchors.has_key(id):
+ return '<a\nhref="../' + anchors[id] + '"\n>' + text + '</a>'
+ return text
+
+def fix_html_file(hfile):
+ buf = open(hfile).read()
+ buf = link_pat.sub(link_subst, buf)
+ open(hfile, 'w').write(buf)
+
+def usage(e=None):
+ if e:
+ sys.stderr.write('fixxref.py: %s\n' % e)
+ sys.stderr.write('usage: fixxref.py [-i index-dir] html-dir\n')
+ sys.exit(1)
+
+if __name__ == '__main__':
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "i:h:",
+ ["index-dir=", "html-dir="])
+ except getopt.error, e:
+ usage(e)
+
+ index_dirs = []
+ for opt, arg in opts:
+ if opt in ('-i', '--index-dir'):
+ index_dirs.append(arg)
+
+ if len(args) != 1:
+ usage()
+
+ for idir in index_dirs:
+ scan_index_dir(idir)
+
+ html_dir = args[0]
+ fix_xrefs(html_dir)
diff --git a/docs/xsl/html.xsl b/docs/xsl/html.xsl
new file mode 100644
index 0000000..d8fea78
--- /dev/null
+++ b/docs/xsl/html.xsl
@@ -0,0 +1,285 @@
+<?xml version='1.0'?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY RE "&#10;">
+<!ENTITY nbsp "&#160;">
+]>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+
+<xsl:param name="html.stylesheet">style.css</xsl:param>
+<xsl:param name="use.id.as.filename" select="1"/>
+<xsl:param name="chunk.fast" select="1"/>
+<xsl:param name="chunker.output.encoding" select="'utf-8'"/>
+
+<xsl:param name="linenumbering.extension" select="1"/>
+<xsl:param name="variablelist.as.table" select="1"/>
+
+<xsl:template match="blockquote">
+ <div class="{local-name(.)}">
+ <xsl:if test="@lang or @xml:lang">
+ <xsl:call-template name="language.attribute"/>
+ </xsl:if>
+ <xsl:call-template name="anchor"/>
+
+ <xsl:choose>
+ <xsl:when test="attribution">
+ <table border="0" width="100%"
+ cellspacing="0" cellpadding="0" class="blockquote"
+ summary="Block quote">
+ <tr>
+ <td width="10%" valign="top">&#160;</td>
+ <td width="80%" valign="top">
+ <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
+ </td>
+ <td width="10%" valign="top">&#160;</td>
+ </tr>
+ <tr>
+ <td colspan="2" align="right" valign="top">
+ <xsl:text>--</xsl:text>
+ <xsl:apply-templates select="attribution"/>
+ </td>
+ <td width="10%" valign="top">&#160;</td>
+ </tr>
+ </table>
+ </xsl:when>
+ <xsl:when test="@role = 'properties' or @role = 'prototypes'">
+ <table width="100%" border="0" bgcolor="#E0E0E0">
+ <tr>
+ <td valign="top">
+ <xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
+ </td>
+ </tr>
+ </table>
+ </xsl:when>
+ <xsl:otherwise>
+ <blockquote class="{local-name(.)}">
+ <xsl:apply-templates/>
+ </blockquote>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+</xsl:template>
+
+ <!-- support for Python language for synopsises -->
+ <xsl:template match="classsynopsis
+ |fieldsynopsis
+ |methodsynopsis
+ |constructorsynopsis
+ |destructorsynopsis">
+ <xsl:param name="language">
+ <xsl:choose>
+ <xsl:when test="@language">
+ <xsl:value-of select="@language"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-classsynopsis-language"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <xsl:choose>
+ <xsl:when test="$language='python'">
+ <xsl:apply-templates select="." mode="python"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="classsynopsis" mode="python">
+ <table bgcolor="#D0E0F0" width="100%">
+ <tr><td>
+ <pre class="{name(.)}">
+ <xsl:text>class </xsl:text>
+ <xsl:apply-templates select="ooclass[1]" mode="python"/>
+ <xsl:if test="ooclass[position() &gt; 1]">
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="python"/> <xsl:text>)</xsl:text>
+ </xsl:if>
+ <xsl:text>:&RE;</xsl:text>
+
+ <xsl:apply-templates select="constructorsynopsis
+ |destructorsynopsis
+ |fieldsynopsis
+ |methodsynopsis
+ |classsynopsisinfo" mode="python"/>
+ </pre></td></tr></table>
+ </xsl:template>
+
+ <xsl:template match="classsynopsisinfo" mode="python">
+ <xsl:apply-templates mode="python"/>
+ </xsl:template>
+
+ <xsl:template match="ooclass|oointerface|ooexception" mode="python">
+ <xsl:if test="position() &gt; 1">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <span class="{name(.)}">
+ <xsl:apply-templates mode="python"/>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="modifier" mode="python">
+ <span class="{name(.)}">
+ <xsl:apply-templates mode="python"/>
+ <xsl:text>&nbsp;</xsl:text>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="classname" mode="python">
+ <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <span class="{name(.)}">
+ <xsl:apply-templates mode="python"/>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="interfacename" mode="python">
+ <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <span class="{name(.)}">
+ <xsl:apply-templates mode="python"/>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="exceptionname" mode="python">
+ <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <span class="{name(.)}">
+ <xsl:apply-templates mode="python"/>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="fieldsynopsis" mode="python">
+ <code class="{name(.)}">
+ <xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
+ <xsl:apply-templates mode="python"/>
+ </code>
+ <xsl:call-template name="synop-break"/>
+ </xsl:template>
+
+ <xsl:template match="type" mode="python">
+ <span class="{name(.)}">
+ <xsl:apply-templates mode="python"/>
+ <xsl:text>&nbsp;</xsl:text>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="varname" mode="python">
+ <span class="{name(.)}">
+ <xsl:apply-templates mode="python"/>
+ <xsl:text>&nbsp;</xsl:text>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="initializer" mode="python">
+ <span class="{name(.)}">
+ <xsl:text>=</xsl:text>
+ <xsl:apply-templates mode="python"/>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="void" mode="python">
+ <span class="{name(.)}">
+ <xsl:text>void&nbsp;</xsl:text>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="methodname" mode="python">
+ <span class="{name(.)}">
+ <xsl:apply-templates mode="python"/>
+ </span>
+ </xsl:template>
+
+ <xsl:template match="methodparam" mode="python">
+ <xsl:if test="position() &gt; 1">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <span class="{name(.)}">
+ <xsl:apply-templates mode="python"/>
+ </span>
+ </xsl:template>
+
+ <xsl:template mode="python"
+ match="destructorsynopsis|methodsynopsis">
+
+ <code class="{name(.)}">
+ <xsl:text> def </xsl:text>
+ <xsl:apply-templates select="methodname" mode="python"/>
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="methodparam" mode="python"/>
+ <xsl:text>)</xsl:text>
+ </code>
+ <xsl:call-template name="synop-break"/>
+ </xsl:template>
+
+ <xsl:template mode="python"
+ match="constructorsynopsis">
+
+ <code class="{name(.)}">
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="methodname" mode="python"/>
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="methodparam" mode="python"/>
+ <xsl:text>)</xsl:text>
+ </code>
+ <xsl:call-template name="synop-break"/>
+ </xsl:template>
+
+<!-- this was the original parameter python mode styling
+ <xsl:template match="parameter" mode="python">
+ <span class="{name(.)}">
+ <xsl:apply-templates mode="python"/>
+ </span>
+ </xsl:template>
+-->
+
+ <!-- hack -->
+ <xsl:template match="link" mode="python">
+ <xsl:apply-templates select="."/>
+ </xsl:template>
+
+ <!-- ========================================================= -->
+ <!-- template to output gtkdoclink elements for the unknown targets -->
+
+ <xsl:template match="link">
+ <xsl:choose>
+ <xsl:when test="id(@linkend)">
+ <xsl:apply-imports/>
+ </xsl:when>
+ <xsl:otherwise>
+ <PYGTKDOCLINK HREF="{@linkend}">
+ <xsl:apply-templates/>
+ </PYGTKDOCLINK>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="parameter" mode="python">
+ <span class="{name(.)}">
+ <xsl:choose>
+ <xsl:when test="@role = 'keyword'">
+ <xsl:call-template name="inline.boldmonoseq"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="inline.italicmonoseq"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </span>
+</xsl:template>
+
+<xsl:template match="variablelist">
+ <table border="0" width="100%" bgcolor="#FFECCE">
+ <col align="left" valign="top" width="0*">
+ </col>
+ <tbody>
+ <xsl:apply-templates select="varlistentry" mode="varlist-table"/>
+ </tbody>
+ </table>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/docs/xsl/pdf-style.xsl b/docs/xsl/pdf-style.xsl
new file mode 100644
index 0000000..d4a8e02
--- /dev/null
+++ b/docs/xsl/pdf-style.xsl
@@ -0,0 +1,11 @@
+<?xml version='1.0'?> <!--*- mode: xml -*-->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
+<xsl:include href="common.xsl"/>
+<xsl:include href="pdf.xsl"/>
+
+<xsl:param name="section.autolabel" select="1"/>
+<xsl:param name="section.label.includes.component.label" select="1"/>
+
+</xsl:stylesheet>
diff --git a/docs/xsl/pdf.xsl b/docs/xsl/pdf.xsl
new file mode 100644
index 0000000..375ba40
--- /dev/null
+++ b/docs/xsl/pdf.xsl
@@ -0,0 +1,259 @@
+<?xml version='1.0'?>
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY RE "&#10;">
+<!ENTITY nbsp "&#160;">
+]>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version='1.0'>
+
+<xsl:param name="body.margin.top">0.5in</xsl:param>
+
+<xsl:template name="is.graphic.extension">
+ <xsl:param name="ext"></xsl:param>
+ <xsl:if test="$ext = 'png'
+ or $ext = 'pdf'
+ or $ext = 'jpeg'
+ or $ext = 'gif'
+ or $ext = 'tif'
+ or $ext = 'tiff'
+ or $ext = 'bmp'">1</xsl:if>
+</xsl:template>
+
+ <!-- support for Python language for synopsises -->
+ <xsl:template match="classsynopsis
+ |fieldsynopsis
+ |methodsynopsis
+ |constructorsynopsis
+ |destructorsynopsis">
+ <xsl:param name="language">
+ <xsl:choose>
+ <xsl:when test="@language">
+ <xsl:value-of select="@language"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$default-classsynopsis-language"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
+ <xsl:choose>
+ <xsl:when test="$language='python'">
+ <xsl:apply-templates select="." mode="python"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-imports/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="classsynopsis" mode="python">
+ <fo:block wrap-option='no-wrap'
+ white-space-collapse='false'
+ linefeed-treatment="preserve"
+ xsl:use-attribute-sets="monospace.verbatim.properties"
+ background-color="#E0E0E0">
+ <xsl:text>class </xsl:text>
+ <xsl:apply-templates select="ooclass[1]" mode="python"/>
+ <xsl:if test="ooclass[position() &gt; 1]">
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="ooclass[position() &gt; 1]" mode="python"/>
+ <xsl:text>)</xsl:text>
+ </xsl:if>
+ <xsl:text>&nbsp;:</xsl:text>
+
+ <xsl:apply-templates select="constructorsynopsis
+ |destructorsynopsis
+ |fieldsynopsis
+ |methodsynopsis
+ |classsynopsisinfo" mode="python"/>
+
+ </fo:block>
+ <xsl:text>&RE;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="classsynopsisinfo" mode="python">
+ <xsl:apply-templates mode="python"/>
+ </xsl:template>
+
+ <xsl:template match="ooclass|oointerface|ooexception" mode="python">
+ <xsl:if test="position() &gt; 1">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates mode="python"/>
+ </xsl:template>
+
+ <xsl:template match="modifier" mode="python">
+ <xsl:apply-templates mode="python"/>
+ <xsl:text>&nbsp;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="classname" mode="python">
+ <xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates mode="python"/>
+ </xsl:template>
+
+ <xsl:template match="interfacename" mode="python">
+ <xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates mode="python"/>
+ </xsl:template>
+
+ <xsl:template match="exceptionname" mode="python">
+ <xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates mode="python"/>
+ </xsl:template>
+
+ <xsl:template match="fieldsynopsis" mode="python">
+ <fo:block wrap-option='no-wrap'
+ white-space-collapse='false'
+ linefeed-treatment="preserve"
+ xsl:use-attribute-sets="monospace.verbatim.properties">
+ <xsl:text>&nbsp;&nbsp;&nbsp;&nbsp;</xsl:text>
+ <xsl:apply-templates mode="python"/>
+ <xsl:call-template name="synop-break"/>
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template match="type" mode="python">
+ <xsl:apply-templates mode="python"/>
+ <xsl:text>&nbsp;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="varname" mode="python">
+ <xsl:apply-templates mode="python"/>
+ <xsl:text>&nbsp;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="initializer" mode="python">
+ <xsl:text>=</xsl:text>
+ <xsl:apply-templates mode="python"/>
+ </xsl:template>
+
+ <xsl:template match="void" mode="python">
+ <xsl:text>void&nbsp;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="methodname" mode="python">
+ <xsl:apply-templates mode="python"/>
+ </xsl:template>
+
+ <xsl:template match="methodparam" mode="python">
+ <xsl:if test="position() &gt; 1">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ <xsl:apply-templates mode="python"/>
+ </xsl:template>
+
+ <xsl:template mode="python"
+ match="destructorsynopsis|methodsynopsis">
+
+ <fo:block wrap-option='no-wrap'
+ white-space-collapse='false'
+ linefeed-treatment="preserve"
+ xsl:use-attribute-sets="monospace.verbatim.properties">
+ <xsl:text> def </xsl:text>
+ <xsl:apply-templates select="methodname" mode="python"/>
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="methodparam" mode="python"/>
+ <xsl:text>)</xsl:text>
+<!-- <xsl:call-template name="synop-break"/> -->
+ </fo:block>
+ </xsl:template>
+
+ <xsl:template mode="python"
+ match="constructorsynopsis">
+ <fo:block wrap-option='no-wrap'
+ white-space-collapse='false'
+ linefeed-treatment="preserve"
+ xsl:use-attribute-sets="monospace.verbatim.properties">
+ <xsl:text> </xsl:text>
+ <xsl:apply-templates select="methodname" mode="python"/>
+ <xsl:text>(</xsl:text>
+ <xsl:apply-templates select="methodparam" mode="python"/>
+ <xsl:text>)</xsl:text>
+ </fo:block>
+ </xsl:template>
+
+ <!-- hack -->
+ <xsl:template match="link" mode="python">
+ <xsl:apply-templates select="."/>
+ </xsl:template>
+
+<!--
+<xsl:template match="variablelist" mode="vl.as.blocks">
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+
+ <xsl:if test="title">
+ <xsl:apply-templates select="title" mode="list.title.mode"/>
+ </xsl:if>
+
+ <fo:block id="{$id}"
+ xsl:use-attribute-sets="list.block.spacing"
+ background-color="#FFECCE">
+ <xsl:apply-templates mode="vl.as.blocks"/>
+ </fo:block>
+</xsl:template>
+-->
+
+<!--
+<xsl:template match="variablelist">
+ <fo:table border="0"
+ width="100%"
+ background-color="#FFECCE"
+ table-layout="fixed">
+ <fo:table-column
+ align="left"
+ column-width="20%"
+ column-number="1">
+ </fo:table-column>
+ <fo:table-column
+ align="left"
+ column-width="80%"
+ column-number="2">
+ </fo:table-column>
+ <fo:table-body>
+ <xsl:apply-templates select="varlistentry"/>
+ </fo:table-body>
+ </fo:table>
+</xsl:template>
+
+<xsl:template match="varlistentry">
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block
+ background-color="#FFECCE">
+ <xsl:apply-templates select="term"/>
+ </fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block
+ background-color="#FFECCE">
+ <xsl:apply-templates select="listitem"/>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+</xsl:template>
+
+<xsl:template match="varlistentry/term">
+ <xsl:apply-templates/>
+ <xsl:text>, </xsl:text>
+</xsl:template>
+
+<xsl:template match="varlistentry/term[position()=last()]" priority="2">
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="varlistentry/listitem">
+ <xsl:apply-templates/>
+</xsl:template>
+-->
+
+</xsl:stylesheet>
diff --git a/docs/xsl/ref-html-style.xsl b/docs/xsl/ref-html-style.xsl
new file mode 100644
index 0000000..380e6a6
--- /dev/null
+++ b/docs/xsl/ref-html-style.xsl
@@ -0,0 +1,54 @@
+<?xml version='1.0'?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
+<xsl:include href="common.xsl"/>
+<xsl:include href="html.xsl"/>
+<xsl:include href="devhelp.xsl"/>
+
+ <!-- ========================================================= -->
+ <!-- template to create the index.sgml anchor index -->
+
+ <xsl:template name="generate.index">
+ <xsl:call-template name="write.text.chunk">
+ <xsl:with-param name="filename" select="'index.sgml'"/>
+ <xsl:with-param name="content">
+ <!-- check all anchor and refentry elements -->
+ <xsl:apply-templates select="//anchor|//refentry|//refsect1|//refsect2|//book"
+ mode="generate.index.mode"/>
+ </xsl:with-param>
+ <xsl:with-param name="encoding" select="'utf-8'"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template match="*" mode="generate.index.mode">
+ <xsl:if test="not(@href)">
+ <xsl:if test="@id">
+ <xsl:text>&lt;ANCHOR id=&quot;</xsl:text>
+ <xsl:value-of select="@id"/>
+ <xsl:text>&quot; href=&quot;</xsl:text>
+ <xsl:if test="$gtkdoc.bookname">
+ <xsl:value-of select="$gtkdoc.bookname"/>
+ <xsl:text>/</xsl:text>
+ </xsl:if>
+ <xsl:call-template name="href.target"/>
+ <xsl:text>&quot;&gt;
+ </xsl:text>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:param name="gtkdoc.version" select="''"/>
+ <xsl:param name="gtkdoc.bookname" select="''"/>
+
+ <xsl:param name="refentry.generate.name" select="0"/>
+ <xsl:param name="refentry.generate.title" select="1"/>
+ <xsl:param name="chapter.autolabel" select="0"/>
+
+ <xsl:template match="book|article">
+ <xsl:apply-imports/>
+ <xsl:call-template name="generate.devhelp"/>
+ <xsl:call-template name="generate.index"/>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/docs/xsl/style.css b/docs/xsl/style.css
new file mode 100644
index 0000000..59abc74
--- /dev/null
+++ b/docs/xsl/style.css
@@ -0,0 +1,10 @@
+.programlisting {
+font: monospace;
+background-color: #E0E0E0;
+padding: 5;
+}
+
+pre.synopsis {
+background-color: #E0E0E0;
+padding: 5;
+}
diff --git a/src/Makefile.am b/src/Makefile.am
index f03fe1a..e3d7c3f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,13 +1,3 @@
-AM_CPPFLAGS = \
- -DG_LOG_DOMAIN=\"Caja-Python\" \
- -DDATADIR=\"$(datadir)\" \
- -DLIBDIR=\"$(libdir)\" \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- $(DISABLE_DEPRECATED_CFLAGS) \
- $(CAJA_PYTHON_CFLAGS) \
- $(PYTHON_INCLUDES)
-
caja_extensiondir=$(CAJA_EXTENSION_DIR)
caja_extension_LTLIBRARIES = libcaja-python.la
@@ -18,5 +8,20 @@ libcaja_python_la_SOURCES = \
caja-python-object.c \
caja-python-object.h
-libcaja_python_la_LDFLAGS = -module -avoid-version -no-undefined
+libcaja_python_la_CPPFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ -DG_LOG_DOMAIN=\"Caja-Python\" \
+ -DDATADIR=\"$(datadir)\" \
+ -DLIBDIR=\"$(libdir)\" \
+ -DPYTHON_VERSION=\"$(PYTHON_VERSION)\" \
+ -DPY_LIB_LOC="\"$(PYTHON_LIB_LOC)\"" \
+ $(PYTHON_INCLUDES) \
+ $(AM_CPPFLAGS)
+
+libcaja_python_la_CFLAGS = \
+ $(CAJA_PYTHON_CFLAGS) \
+ $(AM_CFLAGS)
+
+libcaja_python_la_LDFLAGS = -module -avoid-version
libcaja_python_la_LIBADD = $(CAJA_PYTHON_LIBS) $(PYTHON_LIBS)
diff --git a/src/caja-python.c b/src/caja-python.c
index 21e7f42..a6a7478 100644
--- a/src/caja-python.c
+++ b/src/caja-python.c
@@ -155,11 +155,17 @@ static gboolean
caja_python_init_python (void)
{
PyObject *caja;
+ GModule *libpython;
char *argv[] = { "caja", NULL };
if (Py_IsInitialized())
return TRUE;
+ debug("g_module_open " PY_LIB_LOC "/libpython" PYTHON_VERSION "." G_MODULE_SUFFIX ".1.0");
+ libpython = g_module_open(PY_LIB_LOC "/libpython" PYTHON_VERSION "." G_MODULE_SUFFIX ".1.0", 0);
+ if (!libpython)
+ g_warning("g_module_open libpython failed: %s", g_module_error());
+
debug("Py_Initialize");
Py_Initialize();
if (PyErr_Occurred())