Merge lp:~gz/udd/fix_launchpadlib_version_check into lp:udd

Proposed by Martin Packman
Status: Merged
Merged at revision: 630
Proposed branch: lp:~gz/udd/fix_launchpadlib_version_check
Merge into: lp:udd
Diff against target: 19 lines (+9/-1)
1 file modified
udd/lpapi.py (+9/-1)
To merge this branch: bzr merge lp:~gz/udd/fix_launchpadlib_version_check
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) Approve
Review via email: mp+124250@code.launchpad.net

Description of the change

I was lazy when adding the launchpadlib version check and didn't do it properly. This branch fixes that, but is still too lazy to pull it out to a seperate testable function.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'udd/lpapi.py'
2--- udd/lpapi.py 2012-08-17 10:16:14 +0000
3+++ udd/lpapi.py 2012-09-13 16:27:25 +0000
4@@ -15,7 +15,15 @@
5 from bzrlib.trace import mutter
6
7 import launchpadlib
8-if launchpadlib.__version__ < "1.9.0":
9+
10+def _try_int(s):
11+ """Convert to integer if possible, otherwise return unchanged"""
12+ try:
13+ return int(s)
14+ except ValueError:
15+ return s
16+
17+if tuple(map(_try_int, launchpadlib.__version__.split("."))) < (1, 9, 0):
18 raise ImportError("Version of launchpadlib %s less than 1.9.0" %
19 launchpadlib.__version__)
20

Subscribers

People subscribed via source and target branches