mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-09 06:14:05 +01:00
test: Make runnable with python3
This commit is contained in:
parent
dcb5045d8f
commit
31ce761469
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import gobject
|
||||
from gi.repository import GLib
|
||||
|
||||
import dbus
|
||||
import dbus.service
|
||||
@ -24,12 +24,13 @@ class Agent(dbus.service.Object):
|
||||
response = {}
|
||||
|
||||
if not self.passphrase:
|
||||
print "Service credentials requested, type cancel to cancel"
|
||||
args = raw_input('Answer: ')
|
||||
print("Service credentials requested, type cancel to cancel")
|
||||
args = input('Answer: ')
|
||||
|
||||
for arg in args.split():
|
||||
if arg.startswith("cancel"):
|
||||
response["Error"] = arg
|
||||
|
||||
if arg.startswith("Passphrase="):
|
||||
passphrase = arg.replace("Passphrase=", "", 1)
|
||||
response["Passphrase"] = passphrase
|
||||
@ -43,10 +44,9 @@ class Agent(dbus.service.Object):
|
||||
in_signature='o',
|
||||
out_signature='s')
|
||||
def RequestPassphrase(self, path):
|
||||
print "RequestPassphrase (%s)" % (path)
|
||||
print("RequestPassphrase (%s)" % (path))
|
||||
|
||||
response = {}
|
||||
|
||||
response.update(self.input_passphrase())
|
||||
|
||||
if response.has_key("Error"):
|
||||
@ -54,21 +54,19 @@ class Agent(dbus.service.Object):
|
||||
raise Canceled("canceled")
|
||||
return
|
||||
|
||||
print "returning (%s)" % (response["Passphrase"])
|
||||
|
||||
print("returning (%s)" % (response["Passphrase"]))
|
||||
return response["Passphrase"]
|
||||
|
||||
@dbus.service.method("net.connman.iwd.Agent",
|
||||
in_signature='', out_signature='')
|
||||
def Cancel(self):
|
||||
print "Cancel"
|
||||
|
||||
print("Cancel")
|
||||
|
||||
def print_usage():
|
||||
print "Usage:"
|
||||
print "For WPA input:"
|
||||
print "%s Passphrase=<passphrase>" % (sys.argv[0])
|
||||
print "Help: %s help" % (sys.argv[0])
|
||||
print("Usage:")
|
||||
print("For WPA input:")
|
||||
print("%s Passphrase=<passphrase>" % (sys.argv[0]))
|
||||
print("Help: %s help" % (sys.argv[0]))
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
@ -94,7 +92,7 @@ if __name__ == '__main__':
|
||||
try:
|
||||
manager.RegisterAgent(path)
|
||||
except:
|
||||
print "Cannot register iwd agent."
|
||||
print("Cannot register iwd agent.")
|
||||
|
||||
mainloop = gobject.MainLoop()
|
||||
mainloop = GLib.MainLoop()
|
||||
mainloop.run()
|
||||
|
Loading…
Reference in New Issue
Block a user