Commit 69cf5e40 authored by Christophe Fergeau's avatar Christophe Fergeau

Xspice: Use print("") instead of print ""

This allows Xspice to run when using python3 instead of python2
parent 8d344cf4
...@@ -34,7 +34,7 @@ def which(x): ...@@ -34,7 +34,7 @@ def which(x):
candidate = os.path.join(p, x) candidate = os.path.join(p, x)
if os.path.exists(candidate): if os.path.exists(candidate):
return candidate return candidate
print 'Warning: failed to find executable %s' % x print('Warning: failed to find executable %s' % x)
return None return None
if 'XSPICE_ENABLE_GDB' in os.environ: if 'XSPICE_ENABLE_GDB' in os.environ:
...@@ -128,10 +128,10 @@ args, xorg_args = parser.parse_known_args(sys.argv[1:]) ...@@ -128,10 +128,10 @@ args, xorg_args = parser.parse_known_args(sys.argv[1:])
def agents_new_enough(args): def agents_new_enough(args):
for f in [args.vdagent_exec, args.vdagentd_exec]: for f in [args.vdagent_exec, args.vdagentd_exec]:
if not f: if not f:
print 'please specify path to vdagent/vdagentd executables' print('please specify path to vdagent/vdagentd executables')
return False return False
if not os.path.exists(f): if not os.path.exists(f):
print 'error: file not found ', f print('error: file not found ', f)
return False return False
for f in [args.vdagent_exec, args.vdagentd_exec]: for f in [args.vdagent_exec, args.vdagentd_exec]:
...@@ -169,11 +169,11 @@ def tls_files(args): ...@@ -169,11 +169,11 @@ def tls_files(args):
# and it isn't supplied spice will still abort, and Xorg with it. # and it isn't supplied spice will still abort, and Xorg with it.
for key, filename in tls_files(args).items(): for key, filename in tls_files(args).items():
if not os.path.exists(filename): if not os.path.exists(filename):
print "missing %s - %s does not exist" % (key, filename) print("missing %s - %s does not exist" % (key, filename))
sys.exit(1) sys.exit(1)
def error(msg, exit_code=1): def error(msg, exit_code=1):
print "Xspice: %s" % msg print("Xspice: %s" % msg)
sys.exit(exit_code) sys.exit(exit_code)
if not args.xorg: if not args.xorg:
...@@ -319,7 +319,7 @@ for arg in xorg_args: ...@@ -319,7 +319,7 @@ for arg in xorg_args:
if arg.startswith(":"): if arg.startswith(":"):
display = arg display = arg
if not display: if not display:
print "Error: missing display on line (i.e. :3)" print("Error: missing display on line (i.e. :3)")
raise SystemExit raise SystemExit
os.environ ['DISPLAY'] = display os.environ ['DISPLAY'] = display
...@@ -343,7 +343,7 @@ time.sleep(2) ...@@ -343,7 +343,7 @@ time.sleep(2)
retpid,rc = os.waitpid(xorg.pid, os.WNOHANG) retpid,rc = os.waitpid(xorg.pid, os.WNOHANG)
if retpid != 0: if retpid != 0:
print "Error: X server is not running" print("Error: X server is not running")
else: else:
if args.vdagent_enabled and args.vdagent_launch: if args.vdagent_enabled and args.vdagent_launch:
# XXX use systemd --user for this? # XXX use systemd --user for this?
...@@ -361,4 +361,4 @@ else: ...@@ -361,4 +361,4 @@ else:
xorg.wait() xorg.wait()
except KeyboardInterrupt: except KeyboardInterrupt:
# Catch Ctrl-C as that is the common way of ending this script # Catch Ctrl-C as that is the common way of ending this script
print "Keyboard Interrupt" print("Keyboard Interrupt")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment