File: 0001-Fix-python3-compatibility-by-decoding-bytes-to-strin.patch

package info (click to toggle)
gerritlib 0.8.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 196 kB
  • sloc: python: 381; makefile: 129
file content (30 lines) | stat: -rw-r--r-- 1,018 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 83cb9c5e5a85737481128a0b04a5cc15fa0c2e9b Mon Sep 17 00:00:00 2001
From: Filip Pytloun <filip@pytloun.cz>
Date: Wed, 13 Dec 2017 15:48:15 +0100
Subject: Fix python3 compatibility by decoding bytes to string

---
 gerritlib/gerrit.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gerritlib/gerrit.py b/gerritlib/gerrit.py
index 5730aac..cf3cedf 100644
--- a/gerritlib/gerrit.py
+++ b/gerritlib/gerrit.py
@@ -408,12 +408,16 @@ class Gerrit(object):
         stdin, stdout, stderr = client.exec_command(command)
 
         out = stdout.read()
+        if type(out) == bytes:
+            out = out.decode()
         self.log.debug("SSH received stdout:\n%s" % out)
 
         ret = stdout.channel.recv_exit_status()
         self.log.debug("SSH exit status: %s" % ret)
 
         err = stderr.read()
+        if type(err) == bytes:
+            err = err.decode()
         self.log.debug("SSH received stderr:\n%s" % err)
         if ret:
             raise Exception("Gerrit error executing %s" % command)