Merge lp:~albertomilone/jockey/pkg-version-ubuntu into lp:~ubuntu-core-dev/jockey/ubuntu

Proposed by Alberto Milone
Status: Needs review
Proposed branch: lp:~albertomilone/jockey/pkg-version-ubuntu
Merge into: lp:~ubuntu-core-dev/jockey/ubuntu
Diff against target: 201 lines (+54/-3)
10 files modified
data/handlers/nvidia.py (+7/-0)
debian/changelog (+14/-1)
gtk/jockey-gtk (+1/-1)
jockey/backend.py (+1/-0)
jockey/handlers.py (+9/-0)
jockey/oslib.py (+11/-0)
jockey/ui.py (+5/-1)
kde/jockey-kde (+2/-0)
tests/backend.py (+2/-0)
tests/handlers.py (+2/-0)
To merge this branch: bzr merge lp:~albertomilone/jockey/pkg-version-ubuntu
Reviewer Review Type Date Requested Status
Martin Pitt Disapprove
Review via email: mp+23191@code.launchpad.net

Description of the change

This branch completes support for retrieving the package version (this is not mandatory and is currently used only by the nvidia handler) which, together with the code in the pkg-version branch, allows us to fix LP: #543176

To post a comment you must log in.
Revision history for this message
Martin Pitt (pitti) wrote :
review: Disapprove

Unmerged revisions

415. By Alberto Milone

* jockey/oslib.py:
  - Implement the package_version() method so that we
    can get the version of a package from apt.
* data/handlers/nvidia.py:
  - Implement the pkg_version() method so that we can
    show the version of the driver instead of being
    limited to the information carried by the version
    attribute. For example, in the case of the
    nvidia-current package, self.version is an
    unlocalised and therefore rather confusing string
    i.e. current when it should really be something
    like 195 (LP: #543176).

414. By Alberto Milone

Merge from trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/handlers/nvidia.py'
2--- data/handlers/nvidia.py 2010-04-10 21:01:07 +0000
3+++ data/handlers/nvidia.py 2010-04-11 19:12:20 +0000
4@@ -40,6 +40,7 @@
5
6 self._module_alias = 'nvidia'
7 self._recommended = None
8+ self._pkg_version = None
9 self._do_rebind = False
10 self._alternatives = Alternatives('gl_conf')
11 self.version = version
12@@ -115,6 +116,12 @@
13 self._recommended = self.package == nd.selectDriver()
14 return self._recommended
15
16+ def pkg_version(self):
17+ if self._pkg_version == None:
18+ self._pkg_version = OSLib.inst.package_version(self.package)
19+ self._pkg_version = self._pkg_version and self._pkg_version.split('.')[0]
20+ return self._pkg_version
21+
22 def enabled(self):
23 # See if nvidia (e.g. nvidia-current) is the current alternative
24 target_alternative = self._alternatives.get_alternative_by_name(self.package)
25
26=== modified file 'debian/changelog'
27--- debian/changelog 2010-04-10 21:01:07 +0000
28+++ debian/changelog 2010-04-11 19:12:20 +0000
29@@ -6,8 +6,21 @@
30 its alias are not blacklisted. This prevents Jockey from claiming
31 that the installation of nvidia driver failed when when it
32 didn't (LP: #552653).
33+ * Get support for pkg_version() from trunk.
34+ * jockey/oslib.py:
35+ - Implement the package_version() method so that we
36+ can get the version of a package from apt.
37+ * data/handlers/nvidia.py:
38+ - Implement the pkg_version() method so that we can
39+ show the version of the driver instead of being
40+ limited to the information carried by the "version"
41+ attribute. For example, in the case of the
42+ "nvidia-current" package, self.version is an
43+ unlocalised and therefore rather confusing string
44+ i.e. "current" when it should really be something
45+ like "195" (LP: #543176).
46
47- -- Alberto Milone <alberto.milone@canonical.com> Sat, 10 Apr 2010 22:54:28 +0200
48+ -- Alberto Milone <alberto.milone@canonical.com> Sun, 11 Apr 2010 19:12:37 +0200
49
50 jockey (0.5.8-0ubuntu6) lucid; urgency=low
51
52
53=== modified file 'gtk/jockey-gtk'
54--- gtk/jockey-gtk 2010-02-02 00:21:04 +0000
55+++ gtk/jockey-gtk 2010-04-11 19:12:20 +0000
56@@ -181,7 +181,7 @@
57 indicator = jockey.ui.AbstractUI.ui_notification(self, None, None)
58 print 'GTK ui_notification: got appindicator'
59 menu = gtk.Menu()
60- item = gtk.MenuItem('Install Drivers')
61+ item = gtk.MenuItem(self.string_install_drivers)
62 menu.append(item)
63 item.show()
64 item.connect('activate', lambda widget: self.ui_show_main())
65
66=== modified file 'jockey/backend.py'
67--- jockey/backend.py 2010-03-11 16:32:22 +0000
68+++ jockey/backend.py 2010-04-11 19:12:20 +0000
69@@ -237,6 +237,7 @@
70 'changed': str(h.changed()),
71 'recommended': str(h.recommended()),
72 'announce': str(h.announce),
73+ 'pkg_version': str(h.pkg_version()),
74 }
75 for f in ['description', 'rationale', 'can_change']:
76 v = getattr(h, f)()
77
78=== modified file 'jockey/handlers.py'
79--- jockey/handlers.py 2010-02-02 00:21:04 +0000
80+++ jockey/handlers.py 2010-04-11 19:12:20 +0000
81@@ -77,6 +77,7 @@
82 self.version = None
83 self.repository = None
84 self._recommended = False
85+ self._pkg_version = None
86
87 def _package_defaults(self):
88 '''Set fallback name/description/freeness from package.'''
89@@ -190,6 +191,14 @@
90 version of a driver is provided, then it should return False.
91 '''
92 return self._recommended
93+
94+ def pkg_version(self):
95+ '''Return the package version of a certain driver.
96+
97+ This method should return the package version retrieved by the package
98+ manager.
99+ '''
100+ return self._pkg_version
101
102 def available(self):
103 '''Return if the conditions to use this handler on the system are met.
104
105=== modified file 'jockey/oslib.py'
106--- jockey/oslib.py 2010-03-22 14:55:16 +0000
107+++ jockey/oslib.py 2010-04-11 19:12:20 +0000
108@@ -172,6 +172,17 @@
109
110 raise ValueError, 'package %s does not exist' % package
111
112+ def package_version(self, package):
113+ '''Return the version of a given package.'''
114+
115+ out = self._apt_show(package)
116+ if out:
117+ for l in out.splitlines():
118+ if l.startswith('Version:'):
119+ s = l.split()[-1]
120+ return s.strip()
121+ return None
122+
123 def package_files(self, package):
124 '''Return a list of files shipped by a package.
125
126
127=== modified file 'jockey/ui.py'
128--- jockey/ui.py 2010-03-26 16:41:03 +0000
129+++ jockey/ui.py 2010-04-11 19:12:20 +0000
130@@ -170,6 +170,7 @@
131 # this is used when one version of a driver is recommended over others
132 self.string_recommended = self._('Recommended')
133 self.string_license_dialog_title = self._('License Text for Device Driver')
134+ self.string_install_drivers = self._('Install Drivers')
135
136 def main_window_title(self):
137 '''Return an appropriate translated window title.
138@@ -242,7 +243,10 @@
139 result = handler_info['name']
140 result = self._(result)
141 if 'version' in handler_info:
142- result += ' (%s)' % (self._('version %s') % handler_info['version'])
143+ if 'pkg_version' in handler_info:
144+ result += ' (%s)' % (self._('version %s') % handler_info['pkg_version'])
145+ else:
146+ result += ' (%s)' % (self._('version %s') % handler_info['version'])
147 if bool(handler_info['recommended']):
148 result += ' [%s]' % self.string_recommended
149 return result
150
151=== modified file 'kde/jockey-kde'
152--- kde/jockey-kde 2010-03-20 21:36:17 +0000
153+++ kde/jockey-kde 2010-04-11 19:12:20 +0000
154@@ -94,6 +94,8 @@
155
156 # connect signals
157 self.mw.connect(self.mw.buttonBox, SIGNAL('rejected()'), self.on_buttonBox_rejected)
158+ self.mw.connect(self.mw, SIGNAL('rejected()'), self.on_buttonBox_rejected) # A minor hack, but since we now exit with sys.exit( ) - we will avoid a Segmentation fault
159+ # This is not the best fix, but is 100x better than no fix.
160 self.mw.connect(self.mw.buttonBox, SIGNAL('helpRequested()'),
161 self.on_buttonBox_helpRequested)
162
163
164=== modified file 'tests/backend.py'
165--- tests/backend.py 2009-09-21 11:21:44 +0000
166+++ tests/backend.py 2010-04-11 19:12:20 +0000
167@@ -122,6 +122,7 @@
168 'changed': 'False',
169 'recommended': 'False',
170 'announce': 'True',
171+ 'pkg_version': 'None',
172 })
173
174 def test_set_enabled(self):
175@@ -333,6 +334,7 @@
176 'package': 'mesa-vanilla',
177 'recommended': 'False',
178 'announce': 'True',
179+ 'pkg_version': 'None',
180 })
181
182 def test_handler_files(self):
183
184=== modified file 'tests/handlers.py'
185--- tests/handlers.py 2009-04-01 08:26:35 +0000
186+++ tests/handlers.py 2010-04-11 19:12:20 +0000
187@@ -132,6 +132,7 @@
188 self.assert_(h.free())
189 self.assert_(h.enabled())
190 self.assertEqual(h.recommended(), False)
191+ self.assertEqual(h.pkg_version(), None)
192 self.assert_(h.used())
193 self.assertEqual(h.available(), None)
194
195@@ -166,6 +167,7 @@
196 self.failIf(h.free())
197 self.assert_(h.enabled())
198 self.assertEqual(h.recommended(), False)
199+ self.assertEqual(h.pkg_version(), None)
200 self.failIf(h.used())
201 self.assertEqual(h.available(), None)
202

Subscribers

People subscribed via source and target branches

to all changes: