From: You-Sheng Yang (vicamo) Date: Tue, 1 Nov 2022 14:38:53 +0000 (+0800) Subject: version: format version following PEP-440 X-Git-Tag: v3.2.0~101 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c940acdeacbdf1ecbd884488ec11f8b858cc489a;p=thirdparty%2Fpatchwork.git version: format version following PEP-440 PEP-440 regulates public and local version schemes. Git version string will use local version scheme and alpha/stable releases will follow the public one. Signed-off-by: You-Sheng Yang (vicamo) --- diff --git a/patchwork/tests/test_version.py b/patchwork/tests/test_version.py index f9a994f3..8e512084 100644 --- a/patchwork/tests/test_version.py +++ b/patchwork/tests/test_version.py @@ -20,8 +20,8 @@ class TestVersion(test.TestCase): str_version = version.get_str_version() git_version = version.get_git_version() - str_re = r'v\d\.\d\.\d(\.alpha-0)?' # v1.2.3-alpha-0 - git_re = r'v\d\.\d\.\d(\.post\d+-\w+)?' # v1.2.3.post1-abc123 + str_re = r'v\d\.\d\.\d(([ab]|rc)\d+)?' # v1.2.3a0 + git_re = r'v\d\.\d\.\d(\.post\d+\+\w+)?' # v1.2.3.post1+abc123 str_match = re.match(str_re, version.format_str_version(str_version)) git_match = re.match(git_re, version.format_git_version(git_version)) diff --git a/patchwork/version.py b/patchwork/version.py index 01bdfaab..a94b6724 100644 --- a/patchwork/version.py +++ b/patchwork/version.py @@ -24,10 +24,10 @@ def get_latest_version(): def format_str_version(version): """Format version tuple.""" - return 'v' + '.'.join( + return 'v' + ''.join( [ '.'.join([str(x) for x in version[:3]]), - '-'.join([str(x) for x in version[3:]]), + ''.join([str(x) for x in version[3:]]), ] ) @@ -35,8 +35,8 @@ def format_str_version(version): def format_git_version(version): """Returns a version based on Git tags.""" if '-' in version: # after tag - # convert version-N-githash to version.postN-githash - return version.replace('-', '.post', 1) + # convert version-N-githash to version.postN+githash + return version.replace('-', '.post', 1).replace('-g', '+git', 1) else: # at tag return version diff --git a/version.txt b/version.txt index 2c1cf683..28f243b6 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -3.2.0.alpha.0 +3.2.0.a.0