Commit Graph

29 Commits

Author SHA1 Message Date
Laurent Monin
8af9db4d94 Remove now unused Version.to_string()
- `v.to_string(short=False)` was replaced by `str(v)`
- `v.to_string(short=True)` was replaced by `v.short_str()`
2024-04-01 12:13:11 +02:00
Laurent Monin
e5b28f21a5 Replace Version.to_string(short=True) by Version.short_str() 2024-04-01 12:10:05 +02:00
Laurent Monin
c86c364a37 Version has __str__() method calls to_string(), so make use of it 2024-04-01 12:06:18 +02:00
Laurent Monin
005837e891 Make Version.from_string() stricter, matching from start of string 2024-03-30 21:21:16 +01:00
Kamil
bff804ff94 included missing commas 2022-03-13 19:50:35 +00:00
skelly37
94c9b37f2b Removed omitted import 2022-03-12 20:32:04 +01:00
skelly37
2be09bbf5a Removed deprecated picard.version_from_string() 2022-03-12 10:41:35 +01:00
skelly37
029fef7a10 Removed deprecated picard.version_to_string() 2022-03-12 10:24:01 +01:00
Philipp Wolfer
8cea3807c0 PICARD-1820: Allow single digit versions like "2" to be parsed
A version 2 is equivalent to 2.0 or 2.0.0.
2020-06-08 18:22:32 +02:00
Laurent Monin
6b5e852a60 Run fix-header on *.py 2020-02-24 10:25:09 +01:00
Laurent Monin
3f25bda3c8 Fix a bunch of flake8 warnings, mostly cosmetic changes 2020-02-21 21:43:40 +01:00
Philipp Wolfer
b40a3cb9cd PICARD-1756: Fix plugin update version comparison
Use Version class to implement version comparison. Fixes updater considering 1.10 < 1.9
2020-02-20 21:18:07 +00:00
Philipp Wolfer
83de668fdf Refactor Version.to_string and Version.from_string to improve readability 2020-01-03 14:26:40 +01:00
Philipp Wolfer
2f1b6d79da Implement proper version comparison for dev, alpha, beta and rc releases
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).
2020-01-03 14:25:15 +01:00
Philipp Wolfer
aa372fbe4c Format short version for alpha, beta and rc according to PEP 440
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.
2019-12-16 08:13:24 +01:00
Philipp Wolfer
ac171c1ed6 Re-add ability to mark alpha, beta and rc pre-release versions
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.
2019-12-16 07:52:01 +01:00
Laurent Monin
45a6b20b85 Introduce picard.api_versions_tuple
- 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)
2019-04-18 11:14:45 +02:00
Laurent Monin
b7203e4280 Docstrings should use triple double quotes (PEP257)
https://www.python.org/dev/peps/pep-0257/#id15

For consistency, always use """triple double quotes""" around docstrings.
2018-12-16 16:54:37 +01:00
Philipp Wolfer
2603e6286c Fixed test_api_versions test 2018-11-11 12:08:41 +01:00
Wieland Hoffmann
e624aa121c Make PicardTestCase the parent class of all tests
This brings the faketagger and, more importantly, settings reset to all of them.
2018-10-23 17:32:50 +02:00
Laurent Monin
5329e3592a Clean up and sort imports using isort
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
2018-08-22 08:51:25 +02:00
Sambhav Kothari
93c46dbce8 Update version_to_string to follow PEP440 2017-05-09 14:53:30 +05:30
Laurent Monin
a3b0e21290 Improve API versions list test
- 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)
2014-04-26 12:08:02 +02:00
Laurent Monin
d7ba54dc51 Make version_to_string() and version_from_string() more tolerant
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)
```
2014-04-25 12:01:47 +02:00
Laurent Monin
c2d53a4d4d version_from_string(): match end of the string instead full string 2014-01-02 17:32:34 +01:00
Laurent Monin
6e889ca0a0 Use exceptions in place of assertions -> VersionError 2014-01-02 17:28:41 +01:00
Laurent Monin
81ec25afcd Make version_from_string() more tolerant 2014-01-02 11:50:51 +01:00
Laurent Monin
4554898e42 version_to_string(): be smarter and accept list with strings 2013-12-31 15:31:12 +01:00
Laurent Monin
97f00b2d29 Handle configuration file versions.
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()
2013-07-02 01:45:25 +02:00