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
=== modified file 'UbuntuSystemService/backend.py'
--- UbuntuSystemService/backend.py 2011-11-30 12:22:10 +0000
+++ UbuntuSystemService/backend.py 2014-12-07 01:38:31 +0000
@@ -1,11 +1,8 @@
1import sys
2import gobject
3import dbus1import dbus
4import dbus.service2import dbus.service
5import dbus.mainloop.glib3import dbus.mainloop.glib
6dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) 4dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
7import os5import os
8import subprocess
9import apt_pkg6import apt_pkg
10import struct7import struct
11import fcntl8import fcntl
@@ -110,7 +107,7 @@
110 return self._ftp_proxy()107 return self._ftp_proxy()
111 elif proxy_type == "socks": 108 elif proxy_type == "socks":
112 return self._socks_proxy()109 return self._socks_proxy()
113 raise UnknownProxyTypeError, "proxy_type '%s' is unknown in get_proxy" % proxy_type110 raise UnknownProxyTypeError("proxy_type '%s' is unknown in get_proxy" % proxy_type)
114111
115112
116 def _write_apt_proxy(self, proxy_type, new_proxy):113 def _write_apt_proxy(self, proxy_type, new_proxy):
@@ -219,11 +216,11 @@
219 "com.ubuntu.systemservice.setproxy"):216 "com.ubuntu.systemservice.setproxy"):
220 if not authWithPolicyKit(sender, conn,217 if not authWithPolicyKit(sender, conn,
221 "org.gnome.gconf.defaults.set-system"):218 "org.gnome.gconf.defaults.set-system"):
222 raise PermissionDeniedError, "Permission denied by policy"219 raise PermissionDeniedError("Permission denied by policy")
223 220
224 # check if something supported is set221 # check if something supported is set
225 if not proxy_type in self.SUPPORTED_PROXIES:222 if not proxy_type in self.SUPPORTED_PROXIES:
226 raise UnknownProxyTypeError, "proxy_type '%s' is unknown in set_proxy" % proxy_type223 raise UnknownProxyTypeError("proxy_type '%s' is unknown in set_proxy" % proxy_type)
227 224
228 # set (or reset)225 # set (or reset)
229 if new_proxy == "" or new_proxy is None:226 if new_proxy == "" or new_proxy is None:
@@ -281,7 +278,7 @@
281 "com.ubuntu.systemservice.setnoproxy"):278 "com.ubuntu.systemservice.setnoproxy"):
282 if not authWithPolicyKit(sender, conn,279 if not authWithPolicyKit(sender, conn,
283 "org.gnome.gconf.defaults.set-system"):280 "org.gnome.gconf.defaults.set-system"):
284 raise PermissionDeniedError, "Permission denied by policy"281 raise PermissionDeniedError("Permission denied by policy")
285 282
286 # set (or reset)283 # set (or reset)
287 if new_no_proxy == "" or new_no_proxy is None:284 if new_no_proxy == "" or new_no_proxy is None:
@@ -327,11 +324,11 @@
327 if not authWithPolicyKit(sender, conn,324 if not authWithPolicyKit(sender, conn,
328 "org.gnome.gconf.defaults.set-system"):325 "org.gnome.gconf.defaults.set-system"):
329326
330 raise PermissionDeniedError, "Permission denied by policy"327 raise PermissionDeniedError("Permission denied by policy")
331 328
332 # apply329 # apply
333 if not set_keyboard_to_etc(model, layout, variant, options):330 if not set_keyboard_to_etc(model, layout, variant, options):
334 print "could not write keyboard to /etc"331 print("could not write keyboard to /etc")
335 return False332 return False
336 return True333 return True
337334
@@ -384,5 +381,5 @@
384 #print "set_keyboard: ", model, layout, variant, options381 #print "set_keyboard: ", model, layout, variant, options
385 if not authWithPolicyKit(sender, conn, 382 if not authWithPolicyKit(sender, conn,
386 "com.ubuntu.systemservice.ispkgsystemlocked"):383 "com.ubuntu.systemservice.ispkgsystemlocked"):
387 raise PermissionDeniedError, "Permission denied by policy"384 raise PermissionDeniedError("Permission denied by policy")
388 return self._is_package_system_locked()385 return self._is_package_system_locked()
389386
=== modified file 'UbuntuSystemService/utils.py'
--- UbuntuSystemService/utils.py 2013-09-18 17:57:15 +0000
+++ UbuntuSystemService/utils.py 2014-12-07 01:38:31 +0000
@@ -59,9 +59,9 @@
59 options = line.split("=")[1].strip('"\n')59 options = line.split("=")[1].strip('"\n')
6060
61 f.close()61 f.close()
62 print (model, layout, variant, options)62 print((model, layout, variant, options))
63 except Exception:63 except Exception:
64 print "Couldn't read ", CONSOLE_SETUP_DEFAULT64 print("Couldn't read ", CONSOLE_SETUP_DEFAULT)
6565
66 return (model, layout, variant, options)66 return (model, layout, variant, options)
6767
@@ -93,7 +93,7 @@
93 # verify the settings93 # verify the settings
94 if not verify_keyboard_settings(model, layout, variant, options):94 if not verify_keyboard_settings(model, layout, variant, options):
95 #print "verify_keyboard failed"95 #print "verify_keyboard failed"
96 raise InvalidKeyboardTypeError, "Invalid keyboard set"96 raise InvalidKeyboardTypeError("Invalid keyboard set")
9797
98 # FIXME: what to do if not os.path.exists(CONSOLE_SETUP_DEFAULT)98 # FIXME: what to do if not os.path.exists(CONSOLE_SETUP_DEFAULT)
99 content = []99 content = []
100100
=== modified file 'backend/system-service-d'
--- backend/system-service-d 2013-03-26 20:32:13 +0000
+++ backend/system-service-d 2014-12-07 01:38:31 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/python1#!/usr/bin/python3
22
3# (c) 2008 Canonical Ltd.3# (c) 2008 Canonical Ltd.
4#4#
@@ -17,12 +17,12 @@
17# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.17# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1818
19import dbus19import dbus
20import gobject20from gi.repository import GLib
2121
22from UbuntuSystemService.backend import ServiceBackend22from UbuntuSystemService.backend import ServiceBackend
2323
24if __name__ == "__main__":24if __name__ == "__main__":
25 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) 25 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
26 server = ServiceBackend()26 server = ServiceBackend()
27 gobject.MainLoop().run()27 loop = GLib.MainLoop()
2828 loop.run()
2929
=== modified file 'debian/changelog'
--- debian/changelog 2013-09-18 17:57:15 +0000
+++ debian/changelog 2014-12-07 01:38:31 +0000
@@ -1,3 +1,9 @@
1ubuntu-system-service (0.3.0) UNRELEASED; urgency=low
2
3 * Port to python3.
4
5 -- Dmitrijs Ledkovs <xnox@ubuntu.com> Sun, 27 Oct 2013 01:35:30 +0000
6
1ubuntu-system-service (0.2.5) saucy; urgency=low7ubuntu-system-service (0.2.5) saucy; urgency=low
28
3 * SECURITY UPDATE: possible privilege escalation via policykit UID lookup9 * SECURITY UPDATE: possible privilege escalation via policykit UID lookup
410
=== modified file 'debian/compat'
--- debian/compat 2011-06-10 06:50:04 +0000
+++ debian/compat 2014-12-07 01:38:31 +0000
@@ -1,1 +1,1 @@
1719
22
=== modified file 'debian/control'
--- debian/control 2013-03-26 20:32:13 +0000
+++ debian/control 2014-12-07 01:38:31 +0000
@@ -4,20 +4,21 @@
4Maintainer: Michael Vogt <mvo@ubuntu.com>4Maintainer: Michael Vogt <mvo@ubuntu.com>
5Build-Depends: debhelper (>= 7.0.50~),5Build-Depends: debhelper (>= 7.0.50~),
6 dh-translations,6 dh-translations,
7 python-distutils-extra,7 python3-distutils-extra,
8 python (>= 2.6.6-3~),8 python3 (>= 2.6.6-3~),
9 dh-python,
9 intltool10 intltool
10X-Python-Version: >= 2.711X-Python3-Version: >= 3.2
11Standards-Version: 3.9.212Standards-Version: 3.9.2
12Vcs-Bzr: lp:system-service13Vcs-Bzr: lp:system-service
13Vcs-Browser: http://bazaar.launchpad.net/~ubuntu-core-dev/system-service/ubuntu14Vcs-Browser: http://bazaar.launchpad.net/~ubuntu-core-dev/system-service/ubuntu
1415
15Package: ubuntu-system-service16Package: ubuntu-system-service
16Architecture: all17Architecture: all
17Depends: ${python:Depends},18Depends: ${python3:Depends},
18 ${misc:Depends},19 ${misc:Depends},
19 python-apt (>= 0.7.0),20 python3-apt (>= 0.7.0),
20 python-dbus,21 python3-dbus,
21 policykit-122 policykit-1
22Breaks: gnome-settings-daemon (<< 3.6.4-0ubuntu8),23Breaks: gnome-settings-daemon (<< 3.6.4-0ubuntu8),
23 indicator-datetime (<< 12.10.3daily13.03.07)24 indicator-datetime (<< 12.10.3daily13.03.07)
2425
=== modified file 'debian/rules'
--- debian/rules 2011-06-10 06:50:04 +0000
+++ debian/rules 2014-12-07 01:38:31 +0000
@@ -1,4 +1,4 @@
1#!/usr/bin/make -f1#!/usr/bin/make -f
22
3%:3%:
4 dh "$@" --with translations,python24 dh "$@" --with translations,python3 --buildsystem=pybuild
55
=== modified file 'setup.py'
--- setup.py 2013-03-26 20:32:13 +0000
+++ setup.py 2014-12-07 01:38:31 +0000
@@ -1,8 +1,6 @@
1#!/usr/bin/env python1#!/usr/bin/env python3
22
3from distutils.core import setup, Extension3from distutils.core import setup
4import glob
5import os
6from DistUtilsExtra.command import *4from DistUtilsExtra.command import *
75
8setup(name='system-service',6setup(name='system-service',

Subscribers

People subscribed via source and target branches