The version identifier was previously compared alphabetically, which fails for e.g. "dev" < "alpha".
Implement proper version comparison by introducing a Version class (inherited from tuple).
This omits the dot before the version identifier. Avoids setuptools warning about version normalization for alpha, beta and rc versions.
Note that it is still ".dev1", this is also according to PEP 440.
For Picard versions support the version identifiers 'alpha', 'beta' and 'rc' again (in addition to 'final' and 'dev'). This used to be supported, but got lost at some point
Long version strings will be e.g. 2.3.0beta2. If the shortened string is generated the idenfitiers for alpha and beta will be shortened to 'a' and 'b' (e.g. 2.3.0b2). This confirms to pre-release versioning is defined in PEP 440.
- list of versions as tuples
- constant calculated from picard.api_versions
- add tests
- skip tests if not enough elements (previous code didn't make sense anyway)
Add a config for isort (https://github.com/timothycrosley/isort)
Run isort -rc . and make import style consistent across files
Add a note about `isort` in CONTRIBUTING.md
- fix typo in method name
- make comment more explicit
- test the case where only one element is in the list
- ignore 0 element case (should test skip(), but 2.6 lacks it)
With those changes they can be used to parse plugin API versions too.
Test cases were modified accordingly.
Main changes:
```python
>>> version_from_string("1.0")
(1, 0, 0, 'final', 0)
>>> version_from_string("1.0.1")
(1, 0, 1, 'final', 0)
```
version_info was renamed PICARD_VERSION
version_string was renamed PICARD_VERSION_STR
short version string is stored in PICARD_VERSION_STR_SHORT (for display)
Hooks can be created to handle upgrades (ie. options renaming), see config.register_upgrade_hook() and config.run_upgrade_hooks()