qubes: py3k related fixes
This commit is contained in:
parent
9c5c70fe25
commit
570cbe5225
@ -30,7 +30,7 @@ import qubes.ext
|
||||
|
||||
|
||||
# "LVDS connected 1024x768+0+0 (normal left inverted right) 304mm x 228mm"
|
||||
REGEX_OUTPUT = re.compile(r'''
|
||||
REGEX_OUTPUT = re.compile(rb'''
|
||||
(?x) # ignore whitespace
|
||||
^ # start of string
|
||||
(?P<output>[A-Za-z0-9\-]*)[ ] # LVDS VGA etc
|
||||
@ -58,7 +58,7 @@ def get_monitor_layout():
|
||||
|
||||
for line in subprocess.Popen(
|
||||
['xrandr', '-q'], stdout=subprocess.PIPE).stdout:
|
||||
if not line.startswith("Screen") and not line.startswith(" "):
|
||||
if not line.startswith(b"Screen") and not line.startswith(b" "):
|
||||
output_params = REGEX_OUTPUT.match(line).groupdict()
|
||||
if output_params['width']:
|
||||
phys_size = ""
|
||||
@ -109,9 +109,9 @@ class GUI(qubes.ext.Extension):
|
||||
# get owner of X11 session
|
||||
session_owner = None
|
||||
for line in subprocess.check_output(['xhost']).splitlines():
|
||||
if line == 'SI:localuser:root':
|
||||
if line == b'SI:localuser:root':
|
||||
pass
|
||||
elif line.startswith('SI:localuser:'):
|
||||
elif line.startswith(b'SI:localuser:'):
|
||||
session_owner = line.split(":")[2]
|
||||
if session_owner is not None:
|
||||
data_dir = os.path.expanduser(
|
||||
@ -277,7 +277,7 @@ class GUI(qubes.ext.Extension):
|
||||
pipe = vm.run('QUBESRPC qubes.SetMonitorLayout dom0',
|
||||
passio_popen=True, wait=True)
|
||||
|
||||
pipe.stdin.write(''.join(layout))
|
||||
pipe.stdin.write(''.join(layout).encode())
|
||||
pipe.stdin.close()
|
||||
pipe.wait()
|
||||
|
||||
|
@ -327,7 +327,7 @@ class Storage(object):
|
||||
volume = self.vm.volumes[volume]
|
||||
self.get_pool(volume).resize(volume, size)
|
||||
if self.vm.is_running():
|
||||
self.vm.run_service('qubes.ResizeDisk', input=volume.name,
|
||||
self.vm.run_service('qubes.ResizeDisk', input=volume.name.encode(),
|
||||
user='root', wait=True)
|
||||
|
||||
def create(self):
|
||||
|
@ -1203,7 +1203,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
|
||||
# Note : User root is redefined to SYSTEM in the Windows agent code
|
||||
p = self.run('QUBESRPC qubes.WaitForSession none',
|
||||
user="root", passio_popen=True, gui=False, wait=True)
|
||||
p.communicate(input=self.default_user)
|
||||
p.communicate(input=self.default_user.encode())
|
||||
|
||||
def create_on_disk(self, pool=None, pools=None):
|
||||
'''Create files needed for VM.
|
||||
|
Loading…
Reference in New Issue
Block a user