Skip to content

Commit da23355

Browse files
committed
qemu: Fix escape sequence warnings
Use raw strings to fix escape sequence warnings such as: lib/qemu.py:121: SyntaxWarning: invalid escape sequence '\(' self.cpuinfo = ['IBM pSeries \(emulated by qemu\)']
1 parent ab17a88 commit da23355

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

lib/qemu.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,19 @@ def apply_defaults(self):
9393

9494
if self.cpuinfo is None:
9595
if self.machine_is('pseries'):
96-
self.cpuinfo = ['IBM pSeries \(emulated by qemu\)']
96+
self.cpuinfo = [r'IBM pSeries \(emulated by qemu\)']
9797
elif self.machine_is('powernv'):
98-
self.cpuinfo = ['IBM PowerNV \(emulated by qemu\)']
98+
self.cpuinfo = [r'IBM PowerNV \(emulated by qemu\)']
9999
elif self.machine == 'mac99':
100-
self.cpuinfo = ['PowerMac3,1 MacRISC MacRISC2 Power Macintosh']
100+
self.cpuinfo = [r'PowerMac3,1 MacRISC MacRISC2 Power Macintosh']
101101
elif self.machine == 'g3beige':
102-
self.cpuinfo = ['AAPL,PowerMac G3 MacRISC']
102+
self.cpuinfo = [r'AAPL,PowerMac G3 MacRISC']
103103
elif self.machine == 'bamboo':
104-
self.cpuinfo = ['PowerPC 44x Platform']
104+
self.cpuinfo = [r'PowerPC 44x Platform']
105105
elif self.machine == 'ppce500':
106-
self.cpuinfo = ['QEMU ppce500']
106+
self.cpuinfo = [r'QEMU ppce500']
107107
if self.cpu:
108-
self.cpuinfo.insert(0, f'cpu\s+: {self.cpu}')
108+
self.cpuinfo.insert(0, f'cpu\\s+: {self.cpu}')
109109

110110
if self.qemu_path is None:
111111
if self.machine_is('pseries') or self.machine_is('powernv'):
@@ -153,7 +153,7 @@ def apply_defaults(self):
153153
if 'ubuntu' in self.cloud_image:
154154
self.prompt = 'root@ubuntu:~#'
155155
elif 'fedora' in self.cloud_image:
156-
self.prompt = '\[root@fedora ~\]#'
156+
self.prompt = r'\[root@fedora ~\]#'
157157
elif 'debian' in self.cloud_image:
158158
self.prompt = 'root@debian:~#'
159159

@@ -289,7 +289,7 @@ def cmd(self):
289289

290290
def qemu_monitor_shutdown(p):
291291
p.send('\x01c') # invoke qemu monitor
292-
p.expect('\(qemu\)')
292+
p.expect(r'\(qemu\)')
293293
p.send('quit')
294294

295295

@@ -327,7 +327,7 @@ def get_root_disk(fname):
327327
def get_qemu_version(emulator):
328328
p = PexpectHelper()
329329
p.spawn('%s --version' % emulator, quiet=True)
330-
p.expect('QEMU emulator version (([0-9]+)\.([0-9]+)[^\n]*)')
330+
p.expect(r'QEMU emulator version (([0-9]+)\.([0-9]+)[^\n]*)')
331331
full, major, minor = p.matches()
332332
return (int(major), int(minor), full.strip())
333333

0 commit comments

Comments
 (0)