[telepathy-python/master] Set python encoding header to utf-8 in generated sources.
Jonny Lamb
jonny.lamb at collabora.co.uk
Fri Jun 12 03:33:22 PDT 2009
http://www.python.org/dev/peps/pep-0263/ states the default encoding
is ascii. Since utf-8 characters are being generated (for example, ©),
we need to tell python the encoding of the file.
Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
---
tools/python-constants-generator.xsl | 3 ++-
tools/python-errors-generator.xsl | 2 +-
tools/python-interfaces-generator.xsl | 3 ++-
tools/spec-to-python.xsl | 3 +--
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/tools/python-constants-generator.xsl b/tools/python-constants-generator.xsl
index 2865af9..3822cd7 100644
--- a/tools/python-constants-generator.xsl
+++ b/tools/python-constants-generator.xsl
@@ -62,7 +62,8 @@
<xsl:apply-templates match="node"/>
</xsl:template>
- <xsl:template match="/tp:spec">"""List of constants, generated from the Telepathy spec version <xsl:value-of select="tp:version"/><xsl:text>
+ <xsl:template match="/tp:spec"># -*- coding: utf-8 -*-
+"""List of constants, generated from the Telepathy spec version <xsl:value-of select="tp:version"/><xsl:text>
</xsl:text><xsl:for-each select="tp:copyright">
<xsl:value-of select="."/><xsl:text>
diff --git a/tools/python-errors-generator.xsl b/tools/python-errors-generator.xsl
index 7441c7c..360507e 100644
--- a/tools/python-errors-generator.xsl
+++ b/tools/python-errors-generator.xsl
@@ -17,7 +17,7 @@ class <xsl:value-of select="translate(@name, '. ', '')"/>(DBusException):
<xsl:apply-templates match="node"/>
</xsl:template>
- <xsl:template match="/">
+ <xsl:template match="/"># -*- coding: utf-8 -*-
<xsl:apply-templates select="//tp:errors"/>
</xsl:template>
diff --git a/tools/python-interfaces-generator.xsl b/tools/python-interfaces-generator.xsl
index 1b80212..ff0f9c4 100644
--- a/tools/python-interfaces-generator.xsl
+++ b/tools/python-interfaces-generator.xsl
@@ -18,7 +18,8 @@
<xsl:apply-templates match="node"/>
</xsl:template>
- <xsl:template match="/tp:spec">"""List of interfaces, generated from the Telepathy spec version <xsl:value-of select="tp:version"/><xsl:text>
+ <xsl:template match="/tp:spec"># -*- coding: utf-8 -*-
+"""List of interfaces, generated from the Telepathy spec version <xsl:value-of select="tp:version"/><xsl:text>
</xsl:text><xsl:for-each select="tp:copyright">
<xsl:value-of select="."/><xsl:text>
diff --git a/tools/spec-to-python.xsl b/tools/spec-to-python.xsl
index 2fd6456..26ae249 100644
--- a/tools/spec-to-python.xsl
+++ b/tools/spec-to-python.xsl
@@ -51,8 +51,7 @@ class <xsl:value-of select="translate(/node/@name, '/_', '')"/>(<xsl:value-of se
pass
</xsl:template>
- <xsl:template match="/">
- <xsl:if test="node/interface[not(@tp:causes-havoc)]">
+ <xsl:template match="/"><xsl:if test="node/interface[not(@tp:causes-havoc)]"># -*- coding: utf-8 -*-
# Generated from the Telepathy spec
"""<xsl:for-each select="node/tp:copyright">
<xsl:apply-templates/><xsl:text>
--
1.5.6.5
More information about the telepathy-commits
mailing list