libreoffice: update to 24.8.4.2
[oi-userland.git] / components / network / avahi / patches / 23-py3-avahi-bookmarks.patch
blobe9122f5f950e8985edcbd0803f3ea196131264bf
1 --- avahi-0.7/avahi-python/avahi-bookmarks.in.~1~ 2017-07-10 13:14:59.119370306 +0000
2 +++ avahi-0.7/avahi-python/avahi-bookmarks.in 2020-01-21 12:02:49.998355203 +0000
3 @@ -17,12 +17,17 @@
4 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
5 # USA.
7 +from __future__ import print_function
8 import sys, getopt, os
10 try:
11 - import avahi, gobject, dbus
12 -except ImportError:
13 - print "Sorry, to use this tool you need to install Avahi and python-dbus."
14 + import gi
15 + gi.require_version('Gtk', '3.0')
16 + from gi.repository import GObject
18 + import avahi, dbus
19 +except:
20 + print("Sorry, to use this tool you need to install Avahi and python-dbus.")
21 sys.exit(1)
23 try:
24 @@ -95,7 +100,7 @@
25 else:
26 t += '<ul style="padding: 0px; margin: 20px; list-style-type: none">'
28 - for k, v in self.services.iteritems():
29 + for k, v in self.services.items():
31 if v[3] == 80:
32 port = ''
33 @@ -138,16 +143,16 @@
35 def usage(retval = 0):
37 - print "%s [options]\n" % sys.argv[0]
38 - print " -h --help Show this help"
39 - print " -c --cgi Run as a CGI instead of as a server (default to server"
40 - print " unless environment variable GATEWAY_INTERFACE is set)"
41 - print " -t --timeout MS Specify the max time for CGI browsing (default %u)" % timeout
42 - print " -p --port PORT Specify the port to use (default %u)" % port
43 - print " -a --address ADDRESS Specify the address to bind to (default %s)" % address
44 - print " -H --host-names Show links with real hostnames"
45 - print " -A --addresses Show links with numeric IP addresses"
46 - print " -d --domain DOMAIN Specify the domain to browse"
47 + print("%s [options]\n" % sys.argv[0])
48 + print(" -h --help Show this help")
49 + print(" -c --cgi Run as a CGI instead of as a server (default to server")
50 + print(" unless environment variable GATEWAY_INTERFACE is set)")
51 + print(" -t --timeout MS Specify the max time for CGI browsing (default %u)" % timeout)
52 + print(" -p --port PORT Specify the port to use (default %u)" % port)
53 + print(" -a --address ADDRESS Specify the address to bind to (default %s)" % address)
54 + print(" -H --host-names Show links with real hostnames")
55 + print(" -A --addresses Show links with numeric IP addresses")
56 + print(" -d --domain DOMAIN Specify the domain to browse")
57 sys.exit(retval)
59 try:
60 @@ -181,20 +186,20 @@
61 domain = a
63 if use_CGI is None:
64 - use_CGI = os.environ.has_key("GATEWAY_INTERFACE")
65 + use_CGI = "GATEWAY_INTERFACE" in os.environ
67 if use_CGI:
68 cgi = AvahiBookmarks(use_host_names)
70 - mainloop = gobject.MainLoop()
71 - gobject.timeout_add(timeout, mainloop.quit)
72 + mainloop = GObject.MainLoop()
73 + GObject.timeout_add(timeout, mainloop.quit)
75 try:
76 mainloop.run()
77 except KeyboardInterrupt:
78 pass
80 - print 'Content-type: text/html\n\n' + cgi.render_html()
81 + print('Content-type: text/html\n\n' + cgi.render_html())
83 else:
84 try:
85 @@ -203,8 +208,8 @@
86 from twisted.internet import reactor
87 from twisted.web import server, resource
88 except ImportError:
89 - print "Sorry, to use this tool as a server you need to install twisted and twisted.web.\n"
90 - sys.exit(1)
91 + print("Sorry, to use this tool as a server you need to install twisted and twisted.web.\n")
92 + sys.exit(1)
94 class AvahiBookmarksServer(AvahiBookmarks, resource.Resource):
95 isLeaf = True
96 @@ -219,7 +224,7 @@
97 site = server.Site(AvahiBookmarksServer(use_host_names))
98 reactor.listenTCP(port, site, interface=address)
100 - print "Now point your web browser to http://%s:%u/!" % (address, port)
101 + print("Now point your web browser to http://%s:%u/!" % (address, port))
103 try:
104 reactor.run()