Blame SOURCES/0002-Do-not-use-Python-version-3.patch

f35dbb
From ac19a179deba767a6edafc8477ae168652039f5e Mon Sep 17 00:00:00 2001
f35dbb
From: Richard Hughes <richard@hughsie.com>
f35dbb
Date: Wed, 6 Jun 2018 12:10:59 +0100
f35dbb
Subject: [PATCH 2/4] Do not use Python version 3
f35dbb
f35dbb
---
f35dbb
 contrib/firmware-packager/firmware-packager |  2 +-
f35dbb
 data/installed-tests/hardware.py            |  2 +-
f35dbb
 libfwupd/generate-version-script.py         |  2 +-
f35dbb
 po/make-images                              | 23 +++++++++++----------
f35dbb
 po/test-deps                                |  2 +-
f35dbb
 5 files changed, 16 insertions(+), 15 deletions(-)
f35dbb
f35dbb
diff --git a/contrib/firmware-packager/firmware-packager b/contrib/firmware-packager/firmware-packager
f35dbb
index 23e543ce..23658e6c 100755
f35dbb
--- a/contrib/firmware-packager/firmware-packager
f35dbb
+++ b/contrib/firmware-packager/firmware-packager
f35dbb
@@ -1,4 +1,4 @@
f35dbb
-#!/usr/bin/env python3
f35dbb
+#!/usr/bin/env python
f35dbb
 #
f35dbb
 # Copyright (C) 2017 Max Ehrlich max.ehr@gmail.com
f35dbb
 #
f35dbb
diff --git a/data/installed-tests/hardware.py b/data/installed-tests/hardware.py
f35dbb
index 026b5086..d79529ce 100755
f35dbb
--- a/data/installed-tests/hardware.py
f35dbb
+++ b/data/installed-tests/hardware.py
f35dbb
@@ -1,4 +1,4 @@
f35dbb
-#!/usr/bin/python3
f35dbb
+#!/usr/bin/python
f35dbb
 # pylint: disable=wrong-import-position,too-many-locals,unused-argument,wrong-import-order
f35dbb
 #
f35dbb
 # Copyright (C) 2017 Richard Hughes <richard@hughsie.com>
f35dbb
diff --git a/libfwupd/generate-version-script.py b/libfwupd/generate-version-script.py
f35dbb
index a2dff9ba..e94c16c2 100755
f35dbb
--- a/libfwupd/generate-version-script.py
f35dbb
+++ b/libfwupd/generate-version-script.py
f35dbb
@@ -1,4 +1,4 @@
f35dbb
-#!/usr/bin/env python3
f35dbb
+#!/usr/bin/env python
f35dbb
 # pylint: disable=invalid-name,missing-docstring
f35dbb
 #
f35dbb
 # Copyright (C) 2017 Richard Hughes <richard@hughsie.com>
f35dbb
diff --git a/po/make-images b/po/make-images
f35dbb
index 9f5bd4bc..de9254f7 100755
f35dbb
--- a/po/make-images
f35dbb
+++ b/po/make-images
f35dbb
@@ -1,4 +1,4 @@
f35dbb
-#!/usr/bin/env python3
f35dbb
+#!/usr/bin/env python
f35dbb
 """ This thing rasterizes text for use later """
f35dbb
 
f35dbb
 # pylint: disable=wrong-import-position,too-many-locals,unused-argument
f35dbb
@@ -80,11 +80,11 @@ class Rasterizer:
f35dbb
             PangoCairo.context_set_font_options(pctx, fo)
f35dbb
 
f35dbb
             attrs = Pango.AttrList()
f35dbb
-            length = len(bytes(string, "utf8"))
f35dbb
+            length = len(string)
f35dbb
             items = Pango.itemize(pctx, string, 0, length, attrs, None)
f35dbb
             gs = Pango.GlyphString()
f35dbb
             Pango.shape(string, length, items[0].analysis, gs)
f35dbb
-            del img, cctx, pctx, layout
f35dbb
+            #del img, cctx, pctx, layout
f35dbb
 
f35dbb
             def find_size(fs, f, data):
f35dbb
                 """ find our size, I hope... """
f35dbb
@@ -102,11 +102,11 @@ class Rasterizer:
f35dbb
             log = data['log']
f35dbb
             ink = data['ink']
f35dbb
 
f35dbb
-            height = math.ceil(max(ink.height, log.height) / Pango.SCALE)
f35dbb
-            width = math.ceil(max(ink.width, log.width) / Pango.SCALE)
f35dbb
+            height = int(math.ceil(max(ink.height, log.height) / Pango.SCALE))
f35dbb
+            width = int(math.ceil(max(ink.width, log.width) / Pango.SCALE))
f35dbb
 
f35dbb
-            x = -math.ceil(log.x / Pango.SCALE)
f35dbb
-            y = -math.ceil(log.y / Pango.SCALE)
f35dbb
+            x = int(-math.ceil(log.x / Pango.SCALE))
f35dbb
+            y = int(-math.ceil(log.y / Pango.SCALE))
f35dbb
 
f35dbb
             img = cairo.ImageSurface(cairo.FORMAT_RGB24, width, height)
f35dbb
             cctx = cairo.Context(img)
f35dbb
@@ -129,7 +129,7 @@ class Rasterizer:
f35dbb
                 tmpname = filename[len(os.environ['DESTDIR']):]
f35dbb
             except KeyError:
f35dbb
                 tmpname = filename[len(os.environ['MESON_BUILD_ROOT']):]
f35dbb
-            print("Writing %s                    " % (tmpname,), end='\r')
f35dbb
+            print("Writing %s                    " % (tmpname,))
f35dbb
             def make_dir(d):
f35dbb
                 """ make our parent dir and then our own dir """
f35dbb
                 if os.access(d, os.O_RDWR):
f35dbb
@@ -167,7 +167,9 @@ class Rasterizer:
f35dbb
                 nameinfo.update({'width': width,
f35dbb
                                  'height': height,
f35dbb
                                  'suffix': 'bmp'})
f35dbb
-                filename = self.pattern.format_map(nameinfo)
f35dbb
+                filename = self.pattern
f35dbb
+                for key in nameinfo:
f35dbb
+                    filename = filename.replace('{' + key + '}', str(nameinfo[key]))
f35dbb
                 render_one(lang, string, width, height, filename)
f35dbb
         print("")
f35dbb
 
f35dbb
@@ -177,7 +179,6 @@ if __name__ == '__main__':
f35dbb
     if len(sys.argv) != 4:
f35dbb
         usage(1)
f35dbb
 
f35dbb
-    label = os.fsencode(sys.argv[1]).decode('utf-8')
f35dbb
-    r = Rasterizer(label=label, modir=sys.argv[2],
f35dbb
+    r = Rasterizer(label=sys.argv[1], modir=sys.argv[2],
f35dbb
                    linguas=sys.argv[3])
f35dbb
     r.render()
f35dbb
diff --git a/po/test-deps b/po/test-deps
f35dbb
index cc8c9fd0..4d2be2da 100755
f35dbb
--- a/po/test-deps
f35dbb
+++ b/po/test-deps
f35dbb
@@ -1,4 +1,4 @@
f35dbb
-#!/usr/bin/env python3
f35dbb
+#!/usr/bin/env python
f35dbb
 """ Check dependencies needed for rasterization """
f35dbb
 
f35dbb
 """
f35dbb
-- 
f35dbb
2.17.1
f35dbb