summaryrefslogtreecommitdiff
path: root/c-to-xml.py
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.net>2012-10-31 00:24:14 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2012-10-31 17:39:53 +0000
commitf76c9d0bacf3f1c070416b5d8a39b516721c005e (patch)
treea3d919a76179af1e2788373a7c37c3fe699ecc93 /c-to-xml.py
parentcad6cfe02a1a69d691de342b967fb7b6e33db0fb (diff)
plugin docs: make misc pythons scripts work with python3
- print is a function now - foo.has_key(bar) -> bar in foo - raise err, text -> raise err(text) - uncode strings vs. bytes https://bugzilla.gnome.org/show_bug.cgi?id=563903
Diffstat (limited to 'c-to-xml.py')
-rw-r--r--c-to-xml.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/c-to-xml.py b/c-to-xml.py
index 397c112..7a7a35b 100644
--- a/c-to-xml.py
+++ b/c-to-xml.py
@@ -5,6 +5,8 @@
Convert a C program to valid XML to be included in docbook
"""
+from __future__ import print_function, unicode_literals
+
import sys
import os
from xml.sax import saxutils
@@ -22,13 +24,13 @@ def main():
content = open(source, "r").read()
# print header
- print '<?xml version="1.0"?>'
- print '<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">'
- print
- print '<programlisting>'
+ print ('<?xml version="1.0"?>')
+ print ('<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">')
+ print ()
+ print ('<programlisting>')
# print content
- print saxutils.escape(content).encode('UTF-8')
- print '</programlisting>'
+ print (saxutils.escape(content))
+ print ('</programlisting>')
main()