[glib] gdbus-codegen: Allow '@since: UNRELEASED' in documentation comments



commit 15b315b472184cbeb842256defb3d4d7d0dbd4fd
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Tue Aug 16 17:46:30 2016 +0200

    gdbus-codegen: Allow '@since: UNRELEASED' in documentation comments
    
    Previously, this would not work, as it would result in comparing the
    order of a string and an integer. Make it work, and make 'UNRELEASED'
    compare higher than other versions so it's always treated as the latest
    version.
    
    'UNRELEASED' is commonly used by maintainers to highlight new API while
    it's being prototyped, until they know which version it will actually
    be released in. At the time of release, they replace all 'UNRELEASED'
    strings in git with the new version number.
    
    An example of this usage is here:
    
https://gitlab.com/walbottle/walbottle/commit/d380ac6a2a4a3f4004b805b755c2e6cd041180dc#9208ee267cb05db1afd3a5c323d71e51db489447_7619_7656
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769995

 gio/gdbus-2.0/codegen/utils.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gio/gdbus-2.0/codegen/utils.py b/gio/gdbus-2.0/codegen/utils.py
index c672dec..2c01493 100644
--- a/gio/gdbus-2.0/codegen/utils.py
+++ b/gio/gdbus-2.0/codegen/utils.py
@@ -96,7 +96,13 @@ def lookup_brief_docs(annotations):
         return s
 
 def version_cmp_key(key):
-    # If the 'since' version is empty put a 0 in its place as this will
+    # If the 'since' version is 'UNRELEASED', compare higher than anything else
+    # If it is empty put a 0 in its place as this will
     # allow LooseVersion to work and will always compare lower.
-    v = key[0] if key[0] else '0'
+    if key[0] == 'UNRELEASED':
+        v = '9999'
+    elif key[0]:
+        v = str(key[0])
+    else:
+        v = '0'
     return (distutils.version.LooseVersion(v), key[1])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]