Merge lp:~arjan-s/openlp/check_dependencies_fix into lp:openlp

Proposed by Arjan Schrijver
Status: Merged
Approved by: Andreas Preikschat
Approved revision: 2140
Merged at revision: 2142
Proposed branch: lp:~arjan-s/openlp/check_dependencies_fix
Merge into: lp:openlp
Diff against target: 34 lines (+8/-9)
1 file modified
scripts/check_dependencies.py (+8/-9)
To merge this branch: bzr merge lp:~arjan-s/openlp/check_dependencies_fix
Reviewer Review Type Date Requested Status
Andreas Preikschat (community) Approve
Raoul Snyman Approve
Review via email: mp+141931@code.launchpad.net

Description of the change

fixed bug #1095699 'check_dependencies.py fails on version numbers with letters'
When version numbers are of type 'str', everything after the first non-numerical character is dropped, so '0.8.0b2' becomes '0.8.0'.

To post a comment you must log in.
2139. By Jonathan Corwin

Fix import of settings.

- QSettings exports the 'general' group as '%General' but appears in some circumstances (Linux?) to struggle to import this again. Try and compensate.

- Support the import of the 'players' section

- Change the setting group validation to skip those it doesn't know. Just test for an expected setting earlier instead. Also fix the error message.

Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

There's a better way of doing this. I know Python has a built-in module that deals with version numbers, though I can't think of the name right now.

Revision history for this message
Meinert Jordan (m2j) wrote :

from distutils.version import StrictVersion

2140. By Arjan Schrijver

fixed bug #1095699 'check_dependencies.py fails on version numbers with letters'

Revision history for this message
Arjan Schrijver (arjan-s) wrote :

m2j, thank you. I've updated the branch with the correct fix. I used LooseVersion instead of StrictVersion because the Python version on my machine (2.7.3.final.0) is not correct according to StrictVersion.

Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) :
review: Approve
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

NOTE: when you are working on a bug, then assign yourself to the bug. When committing your changes add --fixes lp:<bug-number> to the command line (this linnks your branch to the bug report)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/check_dependencies.py'
2--- scripts/check_dependencies.py 2012-12-29 20:56:56 +0000
3+++ scripts/check_dependencies.py 2013-01-07 09:26:21 +0000
4@@ -38,6 +38,7 @@
5 """
6 import os
7 import sys
8+from distutils.version import LooseVersion
9
10 is_win = sys.platform.startswith('win')
11
12@@ -89,15 +90,13 @@
13 w = sys.stdout.write
14
15 def check_vers(version, required, text):
16- if type(version) is str:
17- version = version.split('.')
18- version = map(int, version)
19- if type(required) is str:
20- required = required.split('.')
21- required = map(int, required)
22- w(' %s >= %s ... ' % (text, '.'.join(map(str, required))))
23- if version >= required:
24- w('.'.join(map(str, version)) + os.linesep)
25+ if type(version) is not str:
26+ version = '.'.join(map(str, version))
27+ if type(required) is not str:
28+ required = '.'.join(map(str, required))
29+ w(' %s >= %s ... ' % (text, required))
30+ if LooseVersion(version) >= LooseVersion(required):
31+ w(version + os.linesep)
32 return True
33 else:
34 w('FAIL' + os.linesep)