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