Merge lp:~yuningdodo/usb-creator/usb-creator.lp1208129-detect-os-version-with-regex into lp:usb-creator
Proposed by
Yu Ning
Status: | Merged |
---|---|
Approved by: | Mathieu Trudel-Lapierre |
Approved revision: | 463 |
Merged at revision: | 464 |
Proposed branch: | lp:~yuningdodo/usb-creator/usb-creator.lp1208129-detect-os-version-with-regex |
Merge into: | lp:usb-creator |
Diff against target: |
29 lines (+8/-4) 1 file modified
usbcreator/install.py (+8/-4) |
To merge this branch: | bzr merge lp:~yuningdodo/usb-creator/usb-creator.lp1208129-detect-os-version-with-regex |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mathieu Trudel-Lapierre | Approve | ||
Review via email:
|
Description of the change
* usbcreator/
To post a comment you must log in.
Seems like that regex would be bugged, and would match with the full version number including point release with group(0) (full match), and only match the last block satisfying "\d+\." for group(1). You can work around this by modifying it a bit: ((\d+\.)\d+)+?
This further passes a quick unscientific test with a full .disk/info line:
Previously:
In [2]: m = re.search( "(\d+\. )+\d+", "Ubuntu 15.04.1 \"Vivid Vervet\" - Alpha amd64 (20150224.3)")
In [3]: m.group(0)
Out[3]: '15.04.1'
In [4]: m.group(1)
Out[4]: '04.'
With changes:
In [5]: m = re.search( "((\d+\ .)\d+)+ ?", "Ubuntu 15.04.1 \"Vivid Vervet\" - Alpha amd64 (20150224.3)")
In [6]: m.group(0)
Out[6]: '15.04'
In [7]: m.group(1)
Out[7]: '15.04'