Merge lp://qastaging/~jml/pkgme-devportal/levenshtein into lp://qastaging/pkgme-devportal
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Jonathan Lange | ||||
Approved revision: | 75 | ||||
Merged at revision: | 65 | ||||
Proposed branch: | lp://qastaging/~jml/pkgme-devportal/levenshtein | ||||
Merge into: | lp://qastaging/pkgme-devportal | ||||
Diff against target: |
133 lines (+71/-18) 2 files modified
devportalbinary/binary.py (+58/-15) devportalbinary/tests/test_binary.py (+13/-3) |
||||
To merge this branch: | bzr merge lp://qastaging/~jml/pkgme-devportal/levenshtein | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Vogt (community) | Approve | ||
Review via email:
|
Commit message
Guess main binary using levenshtein distance rather than exact matching
Description of the change
Based on lp:~mvo/pkgme-devportal/lp1026952-levenshtein
Addresses bug 1026952 by using Levenshtein distance (i.e. minimum number
of edits) rather than looking for a binary with the exact name as the package)
Differences between this & mvo's branch:
* Drops the exact name matching altogether, as Levenshtein gets us this
* Ignores case when calculating distance
* Includes a definition of Levenshtein distance in the docstring for the
function, to aid the ignorant
And two other completely unnecessary changes:
* Extracts the 'rank' inner function to be '_rank_executable'
* No whitespace at the end of lines
Thanks,
jml
This looks great, one leftover:
47 + # levenshtein distance, the "2" here is arbirtary
should get removed then this can land.