]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
version: format version following PEP-440
authorYou-Sheng Yang (vicamo) <vicamo@gmail.com>
Tue, 1 Nov 2022 14:38:53 +0000 (22:38 +0800)
committerStephen Finucane <stephenfinucane@hotmail.com>
Tue, 24 Jan 2023 22:35:05 +0000 (22:35 +0000)
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) <vicamo@gmail.com>
patchwork/tests/test_version.py
patchwork/version.py
version.txt

index f9a994f344a4f46fad4b58f4fbf37df001ece734..8e512084c09def3cd0ba89fb793cd7b8d3fda3b3 100644 (file)
@@ -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))
index 01bdfaabb3c9dd4de75c0eec827e92c1948f826c..a94b6724afb566c612d58d9787279c9109790151 100644 (file)
@@ -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
 
index 2c1cf683e54ff3c441659d4f1e10c092c1734f0c..28f243b61d787274dc6d647e0a17b4ef37a8973d 100644 (file)
@@ -1 +1 @@
-3.2.0.alpha.0
+3.2.0.a.0