Merge lp:~dobey/ubuntuone-installer/proper-series into lp:ubuntuone-installer

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 7
Merged at revision: 11
Proposed branch: lp:~dobey/ubuntuone-installer/proper-series
Merge into: lp:ubuntuone-installer
Diff against target: 46 lines (+25/-1)
1 file modified
ubuntuone/installer/gui.py (+25/-1)
To merge this branch: bzr merge lp:~dobey/ubuntuone-installer/proper-series
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Review via email: mp+71601@code.launchpad.net

Commit message

Check that we're on Ubuntu, and get series info from /etc/lsb-release

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1 with an asterisk on the print.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone/installer/gui.py'
--- ubuntuone/installer/gui.py 2011-08-04 22:06:31 +0000
+++ ubuntuone/installer/gui.py 2011-08-15 19:42:16 +0000
@@ -32,6 +32,10 @@
32 inline_callbacks = old_callbacks32 inline_callbacks = old_callbacks
3333
3434
35class UnsupportedDistribution(BaseException):
36 """Exception for when on an unsupported distribution."""
37
38
35class Window(Gtk.Window):39class Window(Gtk.Window):
36 """The main dialog to use."""40 """The main dialog to use."""
3741
@@ -174,10 +178,30 @@
174178
175 def __get_series(self):179 def __get_series(self):
176 """Get the series we're running on."""180 """Get the series we're running on."""
177 return 'natty'181 on_ubuntu = False
182 series = None
183
184 def get_value(keypair):
185 return keypair.split('=')[1].strip()
186
187 try:
188 with open('/etc/lsb-release', 'r') as f:
189 for line in f.readlines():
190 if line.startswith('DISTRIB_ID'):
191 on_ubuntu = get_value(line) == u'Ubuntu'
192 if line.startswith('DISTRIB_CODENAME'):
193 series = get_value(line)
194 if not on_ubuntu or series is None:
195 raise UnsupportedDistribution(
196 'This distribution is not supported by Ubuntu One.')
197 except (OSError, IOError, UnsupportedDistribution), error:
198 self.__got_error(error)
199
200 return series
178201
179 def __got_error(self, error):202 def __got_error(self, error):
180 """Got an error trying to set up Ubuntu One."""203 """Got an error trying to set up Ubuntu One."""
204 print error
181 Gtk.main_quit()205 Gtk.main_quit()
182206
183 @inline_callbacks207 @inline_callbacks

Subscribers

People subscribed via source and target branches

to all changes: