misc python3 fixes

This commit is contained in:
Wojtek Porczyk 2017-01-26 18:26:06 +01:00
parent 9f7ba53eec
commit 1be75d9c83
7 changed files with 9 additions and 7 deletions

View File

@ -91,7 +91,7 @@ class Volume(object):
self.pool = str(pool)
self.internal = internal
self.removable = removable
self.revisions_to_keep = revisions_to_keep
self.revisions_to_keep = int(revisions_to_keep)
self.rw = rw
self.save_on_stop = save_on_stop
self._size = int(size)

View File

@ -129,7 +129,7 @@ class FilePool(qubes.storage.Pool):
stdout=subprocess.PIPE)
result = p.communicate()
m = re.match(r'^(/dev/loop\d+):\s', result[0])
m = re.match(r'^(/dev/loop\d+):\s', result[0].decode())
if m is not None:
loop_dev = m.group(1)

View File

@ -317,7 +317,7 @@ def init_cache(log=logging.getLogger('qube.storage.lvm')):
result = {}
for line in out.splitlines():
line = line.strip()
line = line.decode().strip()
pool_name, pool_lv, name, size, usage_percent, attr = line.split(',', 5)
if '' in [pool_name, pool_lv, name, size, usage_percent]:
continue

View File

@ -660,7 +660,7 @@ class SystemTestsMixin(object):
try:
volumes = subprocess.check_output(
['sudo', 'lvs', '--noheadings', '-o', 'vg_name,name',
'--separator', '/'])
'--separator', '/']).decode()
if ('/' + prefix) not in volumes:
return
subprocess.check_call(['sudo', 'lvremove', '-f'] +

View File

@ -19,8 +19,8 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
import io
import os
import StringIO
import sys
import tempfile
import unittest
@ -111,7 +111,7 @@ class TC_00_qvm_run(qubes.tests.SystemTestsMixin, qubes.tests.QubesTestCase):
@unittest.skip('expected error')
def test_005_colour_output(self):
sys.stdout = StringIO.StringIO()
sys.stdout = io.StringIO()
qubes.tools.qvm_run.main(
self.sharedopts + ['--colour-output', '32', self.vm1.name, 'true'])
self.assertEqual('\033[0;32m\033[0m', sys.stdout.getvalue())

View File

@ -400,7 +400,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
maxmem = qubes.property('maxmem', type=int,
setter=_setter_positive_int,
default=(lambda self: min(self.app.host.memory_total / 1024 / 2, 4000)),
default=(lambda self:
int(min(self.app.host.memory_total / 1024 / 2, 4000))),
doc='''Maximum amount of memory available for this VM (for the purpose
of the memory balancer).''')

View File

@ -85,6 +85,7 @@ Requires: createrepo
Requires: gnome-packagekit
Requires: cronie
Requires: bsdtar
Requires: python3-jinja2
# for qubes-hcl-report
Requires: dmidecode
Requires: PyQt4