← Back to team overview

tieto team mailing list archive

[Branch ~ubuntu-core-dev/debian-installer/ubuntu] Rev 1691: Port help-to-gfxboot.py to Python 3.

 

------------------------------------------------------------
revno: 1691
committer: Colin Watson <cjwatson@xxxxxxxxxxxxx>
branch nick: ubuntu
timestamp: Sat 2012-05-19 02:06:45 +0100
message:
  Port help-to-gfxboot.py to Python 3.
modified:
  build/util/help-to-gfxboot.py
  debian/changelog
  debian/control


--
lp:~ubuntu-core-dev/debian-installer/ubuntu
https://code.launchpad.net/~ubuntu-core-dev/debian-installer/ubuntu

Your team Tieto is subscribed to branch lp:~ubuntu-core-dev/debian-installer/ubuntu.
To unsubscribe from this branch go to https://code.launchpad.net/~ubuntu-core-dev/debian-installer/ubuntu/+edit-subscription
=== modified file 'build/util/help-to-gfxboot.py'
--- build/util/help-to-gfxboot.py	2008-03-03 11:38:51 +0000
+++ build/util/help-to-gfxboot.py	2012-05-19 01:06:45 +0000
@@ -1,4 +1,6 @@
-#! /usr/bin/python
+#! /usr/bin/python3
+
+from __future__ import print_function
 
 import sys
 import textwrap
@@ -6,19 +8,25 @@
 import xml.dom.minidom
 
 if len(sys.argv) < 3:
-    print >>sys.stderr, "Usage: %s help.xml install|live" % sys.argv[0]
+    print("Usage: %s help.xml install|live" % sys.argv[0], file=sys.stderr)
     sys.exit(1)
 
-# Avoid having to do .encode('UTF-8') everywhere. This is a pain; I wish
-# Python supported something like "sys.stdout.encoding = 'UTF-8'".
-def fix_stdout():
-    import codecs
-    sys.stdout = codecs.EncodedFile(sys.stdout, 'UTF-8')
-    def null_decode(input, errors='strict'):
-        return input, len(input)
-    sys.stdout.decode = null_decode
+if sys.version >= '3':
+    # Force encoding to UTF-8 even in non-UTF-8 locales.
+    import io
+    sys.stdout = io.TextIOWrapper(
+        sys.stdout.detach(), encoding="UTF-8", line_buffering=True)
+else:
+    # Avoid having to do .encode('UTF-8') everywhere. This is a pain; I wish
+    # Python supported something like "sys.stdout.encoding = 'UTF-8'".
+    def fix_stdout():
+        import codecs
+        sys.stdout = codecs.EncodedFile(sys.stdout, 'UTF-8')
+        def null_decode(input, errors='strict'):
+            return input, len(input)
+        sys.stdout.decode = null_decode
 
-fix_stdout()
+    fix_stdout()
 
 document = xml.dom.minidom.parse(sys.argv[1])
 mode = sys.argv[2]

=== modified file 'debian/changelog'
--- debian/changelog	2012-05-16 09:49:34 +0000
+++ debian/changelog	2012-05-19 01:06:45 +0000
@@ -1,3 +1,9 @@
+debian-installer (20101020ubuntu141) UNRELEASED; urgency=low
+
+  * Port help-to-gfxboot.py to Python 3.
+
+ -- Colin Watson <cjwatson@xxxxxxxxxx>  Sat, 19 May 2012 02:05:36 +0100
+
 debian-installer (20101020ubuntu140) quantal; urgency=low
 
   * Move to 3.4.0-2 kernels.

=== modified file 'debian/control'
--- debian/control	2012-02-01 00:59:57 +0000
+++ debian/control	2012-05-19 01:06:45 +0000
@@ -9,7 +9,7 @@
 Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-core-dev/debian-installer/ubuntu
 Build-Conflicts: libnewt-pic [mipsel]
 # NOTE: Do not edit the next line by hand. See comment below.
-Build-Depends: debhelper (>= 7.0.0), apt, apt-utils, gnupg, ubuntu-keyring, dctrl-tools, wget, bc, debiandoc-sgml, xsltproc, docbook-xml, docbook-xsl, libbogl-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], lsb-release, glibc-pic, libslang2-pic (>= 2.0.6-4), libnewt-pic (>= 0.52.2-11.3) [!mipsel], libnewt-dev (>= 0.52.2-11.3) [mipsel], libgcc1 [i386 amd64], cramfsprogs [powerpc ia64 mips mipsel armeb armel], genext2fs (>= 1.3-7.1), e2fsprogs, mklibs (>= 0.1.25), genisoimage (>= 9:1.1.10-1ubuntu2) [!s390 !s390x], genromfs [sparc sparc64], hfsutils [powerpc], dosfstools (>= 3.0.9-1ubuntu2) [i386 ia64 m68k amd64 armel armhf], cpio, devio [armeb armel], parted [armel armhf], slugimage (>= 0.10+r58-6) [armeb armel], u-boot-tools [armel armhf], syslinux (>= 2:4.02) [i386 amd64], palo [hppa], elilo [ia64], yaboot [powerpc], aboot (>= 0.9b-2) [alpha], silo [sparc], sparc-utils [sparc sparc64], genisovh [mips], tip22 [mips], colo [mipsel], sibyl [mips mipsel], atari-bootstrap [m68k], vmelilo [m68k], m68k-vme-tftplilo [m68k], amiboot [m68k], emile [m68k], emile-bootblocks [m68k], u-boot-linaro-omap3-beagle [armel armhf], u-boot-linaro-omap4-panda [armel armhf], tofrodos [i386 amd64 kfreebsd-i386 kfreebsd-amd64], mtools [i386 ia64 m68k amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386 armel armhf], po4a [i386 amd64], python [i386 amd64], module-init-tools [i386 armeb armel armhf amd64 alpha hppa ia64 m68k mips mipsel powerpc s390 sh4 sparc sparc64], bf-utf-source [!s390 !s390x], mkvmlinuz [powerpc], openssl [armel], makefs [kfreebsd-i386 kfreebsd-amd64], grub-pc (>= 1.98~20100101-1) [kfreebsd-i386 kfreebsd-amd64 hurd-i386], xorriso [kfreebsd-i386 kfreebsd-amd64 hurd-i386], grub-efi-amd64-bin [amd64], grub-common [amd64], debian-ports-archive-keyring [sh4 sparc64]
+Build-Depends: debhelper (>= 7.0.0), apt, apt-utils, gnupg, ubuntu-keyring, dctrl-tools, wget, bc, debiandoc-sgml, xsltproc, docbook-xml, docbook-xsl, libbogl-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], lsb-release, glibc-pic, libslang2-pic (>= 2.0.6-4), libnewt-pic (>= 0.52.2-11.3) [!mipsel], libnewt-dev (>= 0.52.2-11.3) [mipsel], libgcc1 [i386 amd64], cramfsprogs [powerpc ia64 mips mipsel armeb armel], genext2fs (>= 1.3-7.1), e2fsprogs, mklibs (>= 0.1.25), genisoimage (>= 9:1.1.10-1ubuntu2) [!s390 !s390x], genromfs [sparc sparc64], hfsutils [powerpc], dosfstools (>= 3.0.9-1ubuntu2) [i386 ia64 m68k amd64 armel armhf], cpio, devio [armeb armel], parted [armel armhf], slugimage (>= 0.10+r58-6) [armeb armel], u-boot-tools [armel armhf], syslinux (>= 2:4.02) [i386 amd64], palo [hppa], elilo [ia64], yaboot [powerpc], aboot (>= 0.9b-2) [alpha], silo [sparc], sparc-utils [sparc sparc64], genisovh [mips], tip22 [mips], colo [mipsel], sibyl [mips mipsel], atari-bootstrap [m68k], vmelilo [m68k], m68k-vme-tftplilo [m68k], amiboot [m68k], emile [m68k], emile-bootblocks [m68k], u-boot-linaro-omap3-beagle [armel armhf], u-boot-linaro-omap4-panda [armel armhf], tofrodos [i386 amd64 kfreebsd-i386 kfreebsd-amd64], mtools [i386 ia64 m68k amd64 kfreebsd-i386 kfreebsd-amd64 hurd-i386 armel armhf], po4a [i386 amd64], python3 (>= 3.1) [i386 amd64], module-init-tools [i386 armeb armel armhf amd64 alpha hppa ia64 m68k mips mipsel powerpc s390 sh4 sparc sparc64], bf-utf-source [!s390 !s390x], mkvmlinuz [powerpc], openssl [armel], makefs [kfreebsd-i386 kfreebsd-amd64], grub-pc (>= 1.98~20100101-1) [kfreebsd-i386 kfreebsd-amd64 hurd-i386], xorriso [kfreebsd-i386 kfreebsd-amd64 hurd-i386], grub-efi-amd64-bin [amd64], grub-common [amd64], debian-ports-archive-keyring [sh4 sparc64]
 # This package has the worst Build-Depends in Debian, so it deserves some
 # explanation. Note that this comment can also be used to generate a
 # Build-Depends line, by running the debian/genbuilddeps program.
@@ -151,7 +151,7 @@
 #		mcopy is used to put files onto FAT filesystems w/o
 #		mounting them.
 #	- po4a [i386 amd64]
-#	- python [i386 amd64]
+#	- python3 (>= 3.1) [i386 amd64]
 #		For building gfxboot help texts.
 #
 #	- module-init-tools [i386 armeb armel armhf amd64 alpha hppa ia64 m68k mips mipsel powerpc s390 sh4 sparc sparc64]