]> code.ossystems Code Review - meta-freescale.git/blob
8974e5db54b820c51bacb71e35cda9d26f36a146
[meta-freescale.git] /
1 From aa8e341e73c288b77a5187e3676a2bbb6588b705 Mon Sep 17 00:00:00 2001
2 From: Jose Fonseca <jfonseca@vmware.com>
3 Date: Mon, 29 Apr 2019 06:41:49 +0100
4 Subject: [PATCH 4/4] scripts: Tie a few more Python 2 to 3 conversion loose
5  ends.
6
7 Upstream-Status: Backport [https://github.com/apitrace/apitrace/commit/f527924cca45591966139eae8c2fefb4a9a0f947]
8
9 (cherry picked from commit f527924cca45591966139eae8c2fefb4a9a0f947)
10 Signed-off-by: Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>
11 ---
12  scripts/jsonextractimages.py | 10 +++++-----
13  scripts/profileshader.py     |  2 +-
14  2 files changed, 6 insertions(+), 6 deletions(-)
15
16 diff --git a/scripts/jsonextractimages.py b/scripts/jsonextractimages.py
17 index 785e32db..ac20c23d 100755
18 --- a/scripts/jsonextractimages.py
19 +++ b/scripts/jsonextractimages.py
20 @@ -34,7 +34,7 @@ import base64
21  import sys
22  
23  
24 -pngSignature = "\x89\x50\x4E\x47\x0D\x0A\x1A\x0A"
25 +pngSignature = b"\x89\x50\x4E\x47\x0D\x0A\x1A\x0A"
26  
27  
28  def dumpSurfaces(state, memberName):
29 @@ -46,13 +46,13 @@ def dumpSurfaces(state, memberName):
30              extName = 'png'
31          else:
32              magic = data[:2]
33 -            if magic in ('P1', 'P4'):
34 +            if magic in (b'P1', b'P4'):
35                  extName = 'pbm'
36 -            elif magic in ('P2', 'P5'):
37 +            elif magic in (b'P2', b'P5'):
38                  extName = 'pgm'
39 -            elif magic in ('P3', 'P6'):
40 +            elif magic in (b'P3', b'P6'):
41                  extName = 'ppm'
42 -            elif magic in ('Pf', 'PF'):
43 +            elif magic in (b'Pf', b'PF'):
44                  extName = 'pfm'
45              else:
46                  sys.stderr.write('warning: unsupport Netpbm format %s\n' % magic)
47 diff --git a/scripts/profileshader.py b/scripts/profileshader.py
48 index c6c1c935..7e8637eb 100755
49 --- a/scripts/profileshader.py
50 +++ b/scripts/profileshader.py
51 @@ -92,7 +92,7 @@ def process(stream, groupField):
52          id = str(group[0]).rjust(maxGroupLen)
53          draw = str(group[1]['draws']).rjust(12)
54          dura = str(group[1]['duration']).rjust(18)
55 -        perCall = str(group[1]['duration'] / group[1]['draws']).rjust(12)
56 +        perCall = str(group[1]['duration'] // group[1]['draws']).rjust(12)
57          longest = str(group[1]['longest']).rjust(11)
58          print("| %s | %s | %s | %s | %s |" % (id, draw, dura, perCall, longest))
59  
60 -- 
61 2.17.1
62