[gtk/matthiasc/builder-requires: 5/7] builder: Be a bit more strict about requires




commit e4be785c6c53d57e9199462bbccd8e344ee55e86
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Nov 10 19:18:26 2020 -0500

    builder: Be a bit more strict about requires
    
    Check that the major version matches (without this, the
    requires check is really toothless), but allow 3.99 to
    match 4.0.

 gtk/gtkbuilderparser.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index c8e096aacb..b714a8e869 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -2016,13 +2016,16 @@ end_element (GtkBuildableParseContext  *context,
        */
       if (!strcmp (req_info->library, "gtk"))
         {
-          if (!GTK_CHECK_VERSION (req_info->major, req_info->minor, 0))
+          if (req_info->major == 4 && req_info->minor == 0)
+            {
+              /* We allow 3.99.x to pass as 4.0 */
+            }
+          else if (gtk_check_version (req_info->major, req_info->minor, 0) != NULL)
             {
               g_set_error (error,
                            GTK_BUILDER_ERROR,
                            GTK_BUILDER_ERROR_VERSION_MISMATCH,
-                           "Required %s version %d.%d, current version is %d.%d",
-                           req_info->library,
+                           "Required GTK version %d.%d, current version is %d.%d",
                            req_info->major, req_info->minor,
                            GTK_MAJOR_VERSION, GTK_MINOR_VERSION);
               _gtk_builder_prefix_error (data->builder, context, error);


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