Merge lp:~xnox/system-service/python3 into lp:system-service

Proposed by Dimitri John Ledkov
Status: Needs review
Proposed branch: lp:~xnox/system-service/python3
Merge into: lp:system-service
Diff against target: 197 lines (+31/-29)
8 files modified
UbuntuSystemService/backend.py (+7/-10)
UbuntuSystemService/utils.py (+3/-3)
backend/system-service-d (+4/-4)
debian/changelog (+6/-0)
debian/compat (+1/-1)
debian/control (+7/-6)
debian/rules (+1/-1)
setup.py (+2/-4)
To merge this branch: bzr merge lp:~xnox/system-service/python3
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Michael Vogt Pending
Review via email: mp+192805@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :

LGTM, except this bit:

65 - print (model, layout, variant, options)
66 + print((model, layout, variant, options))

which I assume is an overzealous 2to3 artifact. I'll revert that, and otherwise upload. Thanks!

review: Approve
Revision history for this message
Martin Pitt (pitti) wrote :

Ignore me, it was actually printing a tuple in the 2.x version as well, so this is fine.

Revision history for this message
Martin Pitt (pitti) wrote :

I tested this with trying to set a proxy in control-center's Network tab, and applying system-wide. This stopped working with this branch.

$ sudo /usr/lib/system-service/system-service-d
Traceback (most recent call last):
  File "/usr/lib/system-service/system-service-d", line 22, in <module>
    from UbuntuSystemService.backend import ServiceBackend
ImportError: No module named UbuntuSystemService.backend

Seems you forgot to update the shebangs?

review: Needs Fixing
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Yeap, forgot to port the wrapper script that launches the service. Now ported that and checked that it operates without crash / tracebacks.

Revision history for this message
Martin Pitt (pitti) wrote :

Didn't test again, but this looks good now, thank you!

review: Approve

Unmerged revisions

76. By Dimitri John Ledkov

Clean-up unused imports

75. By Dimitri John Ledkov

port system-service-d to python3.

74. By Dimitri John Ledkov

Port to python3.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UbuntuSystemService/backend.py'
2--- UbuntuSystemService/backend.py 2011-11-30 12:22:10 +0000
3+++ UbuntuSystemService/backend.py 2014-12-07 01:38:31 +0000
4@@ -1,11 +1,8 @@
5-import sys
6-import gobject
7 import dbus
8 import dbus.service
9 import dbus.mainloop.glib
10 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
11 import os
12-import subprocess
13 import apt_pkg
14 import struct
15 import fcntl
16@@ -110,7 +107,7 @@
17 return self._ftp_proxy()
18 elif proxy_type == "socks":
19 return self._socks_proxy()
20- raise UnknownProxyTypeError, "proxy_type '%s' is unknown in get_proxy" % proxy_type
21+ raise UnknownProxyTypeError("proxy_type '%s' is unknown in get_proxy" % proxy_type)
22
23
24 def _write_apt_proxy(self, proxy_type, new_proxy):
25@@ -219,11 +216,11 @@
26 "com.ubuntu.systemservice.setproxy"):
27 if not authWithPolicyKit(sender, conn,
28 "org.gnome.gconf.defaults.set-system"):
29- raise PermissionDeniedError, "Permission denied by policy"
30+ raise PermissionDeniedError("Permission denied by policy")
31
32 # check if something supported is set
33 if not proxy_type in self.SUPPORTED_PROXIES:
34- raise UnknownProxyTypeError, "proxy_type '%s' is unknown in set_proxy" % proxy_type
35+ raise UnknownProxyTypeError("proxy_type '%s' is unknown in set_proxy" % proxy_type)
36
37 # set (or reset)
38 if new_proxy == "" or new_proxy is None:
39@@ -281,7 +278,7 @@
40 "com.ubuntu.systemservice.setnoproxy"):
41 if not authWithPolicyKit(sender, conn,
42 "org.gnome.gconf.defaults.set-system"):
43- raise PermissionDeniedError, "Permission denied by policy"
44+ raise PermissionDeniedError("Permission denied by policy")
45
46 # set (or reset)
47 if new_no_proxy == "" or new_no_proxy is None:
48@@ -327,11 +324,11 @@
49 if not authWithPolicyKit(sender, conn,
50 "org.gnome.gconf.defaults.set-system"):
51
52- raise PermissionDeniedError, "Permission denied by policy"
53+ raise PermissionDeniedError("Permission denied by policy")
54
55 # apply
56 if not set_keyboard_to_etc(model, layout, variant, options):
57- print "could not write keyboard to /etc"
58+ print("could not write keyboard to /etc")
59 return False
60 return True
61
62@@ -384,5 +381,5 @@
63 #print "set_keyboard: ", model, layout, variant, options
64 if not authWithPolicyKit(sender, conn,
65 "com.ubuntu.systemservice.ispkgsystemlocked"):
66- raise PermissionDeniedError, "Permission denied by policy"
67+ raise PermissionDeniedError("Permission denied by policy")
68 return self._is_package_system_locked()
69
70=== modified file 'UbuntuSystemService/utils.py'
71--- UbuntuSystemService/utils.py 2013-09-18 17:57:15 +0000
72+++ UbuntuSystemService/utils.py 2014-12-07 01:38:31 +0000
73@@ -59,9 +59,9 @@
74 options = line.split("=")[1].strip('"\n')
75
76 f.close()
77- print (model, layout, variant, options)
78+ print((model, layout, variant, options))
79 except Exception:
80- print "Couldn't read ", CONSOLE_SETUP_DEFAULT
81+ print("Couldn't read ", CONSOLE_SETUP_DEFAULT)
82
83 return (model, layout, variant, options)
84
85@@ -93,7 +93,7 @@
86 # verify the settings
87 if not verify_keyboard_settings(model, layout, variant, options):
88 #print "verify_keyboard failed"
89- raise InvalidKeyboardTypeError, "Invalid keyboard set"
90+ raise InvalidKeyboardTypeError("Invalid keyboard set")
91
92 # FIXME: what to do if not os.path.exists(CONSOLE_SETUP_DEFAULT)
93 content = []
94
95=== modified file 'backend/system-service-d'
96--- backend/system-service-d 2013-03-26 20:32:13 +0000
97+++ backend/system-service-d 2014-12-07 01:38:31 +0000
98@@ -1,4 +1,4 @@
99-#!/usr/bin/python
100+#!/usr/bin/python3
101
102 # (c) 2008 Canonical Ltd.
103 #
104@@ -17,12 +17,12 @@
105 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
106
107 import dbus
108-import gobject
109+from gi.repository import GLib
110
111 from UbuntuSystemService.backend import ServiceBackend
112
113 if __name__ == "__main__":
114 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
115 server = ServiceBackend()
116- gobject.MainLoop().run()
117-
118+ loop = GLib.MainLoop()
119+ loop.run()
120
121=== modified file 'debian/changelog'
122--- debian/changelog 2013-09-18 17:57:15 +0000
123+++ debian/changelog 2014-12-07 01:38:31 +0000
124@@ -1,3 +1,9 @@
125+ubuntu-system-service (0.3.0) UNRELEASED; urgency=low
126+
127+ * Port to python3.
128+
129+ -- Dmitrijs Ledkovs <xnox@ubuntu.com> Sun, 27 Oct 2013 01:35:30 +0000
130+
131 ubuntu-system-service (0.2.5) saucy; urgency=low
132
133 * SECURITY UPDATE: possible privilege escalation via policykit UID lookup
134
135=== modified file 'debian/compat'
136--- debian/compat 2011-06-10 06:50:04 +0000
137+++ debian/compat 2014-12-07 01:38:31 +0000
138@@ -1,1 +1,1 @@
139-7
140+9
141
142=== modified file 'debian/control'
143--- debian/control 2013-03-26 20:32:13 +0000
144+++ debian/control 2014-12-07 01:38:31 +0000
145@@ -4,20 +4,21 @@
146 Maintainer: Michael Vogt <mvo@ubuntu.com>
147 Build-Depends: debhelper (>= 7.0.50~),
148 dh-translations,
149- python-distutils-extra,
150- python (>= 2.6.6-3~),
151+ python3-distutils-extra,
152+ python3 (>= 2.6.6-3~),
153+ dh-python,
154 intltool
155-X-Python-Version: >= 2.7
156+X-Python3-Version: >= 3.2
157 Standards-Version: 3.9.2
158 Vcs-Bzr: lp:system-service
159 Vcs-Browser: http://bazaar.launchpad.net/~ubuntu-core-dev/system-service/ubuntu
160
161 Package: ubuntu-system-service
162 Architecture: all
163-Depends: ${python:Depends},
164+Depends: ${python3:Depends},
165 ${misc:Depends},
166- python-apt (>= 0.7.0),
167- python-dbus,
168+ python3-apt (>= 0.7.0),
169+ python3-dbus,
170 policykit-1
171 Breaks: gnome-settings-daemon (<< 3.6.4-0ubuntu8),
172 indicator-datetime (<< 12.10.3daily13.03.07)
173
174=== modified file 'debian/rules'
175--- debian/rules 2011-06-10 06:50:04 +0000
176+++ debian/rules 2014-12-07 01:38:31 +0000
177@@ -1,4 +1,4 @@
178 #!/usr/bin/make -f
179
180 %:
181- dh "$@" --with translations,python2
182+ dh "$@" --with translations,python3 --buildsystem=pybuild
183
184=== modified file 'setup.py'
185--- setup.py 2013-03-26 20:32:13 +0000
186+++ setup.py 2014-12-07 01:38:31 +0000
187@@ -1,8 +1,6 @@
188-#!/usr/bin/env python
189+#!/usr/bin/env python3
190
191-from distutils.core import setup, Extension
192-import glob
193-import os
194+from distutils.core import setup
195 from DistUtilsExtra.command import *
196
197 setup(name='system-service',

Subscribers

People subscribed via source and target branches