[gedit] build: use meson.project_version() instead of having a global variable



commit 16e260d4de77f61506cafb03b1dec0e803fb9b62
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Dec 4 11:21:16 2019 +0100

    build: use meson.project_version() instead of having a global variable
    
    The global variable "version" was harder to grep, it gives lots of false
    positives. And when possible it's of course better to avoid a global
    variable.

 data/meson.build  | 2 +-
 gedit/meson.build | 2 +-
 meson.build       | 9 +++------
 3 files changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index bef694c4f..cd00137de 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -36,7 +36,7 @@ endif
 
 
 desktop_in = configuration_data()
-desktop_in.set('VERSION', version)
+desktop_in.set('VERSION', meson.project_version())
 desktop_in.set('FULL_LIBEXECDIR', libexecdir)
 
 desktop_file_configured = configure_file(
diff --git a/gedit/meson.build b/gedit/meson.build
index de9e818ec..e93537eeb 100644
--- a/gedit/meson.build
+++ b/gedit/meson.build
@@ -258,7 +258,7 @@ libgedit_pc = pkg.generate(
   name: package_name,
   description: 'GNOME text editor',
   requires: ['gtksourceview-4', 'libpeas-1.0', 'libpeas-gtk-1.0'],
-  version: version,
+  version: meson.project_version(),
   subdirs: package_string,
   libraries: libgedit_sha,
   install_dir: pkgconfigdir,
diff --git a/meson.build b/meson.build
index 8df973ac3..cf52c810d 100644
--- a/meson.build
+++ b/meson.build
@@ -9,9 +9,6 @@ i18n = import('i18n')
 pkg = import('pkgconfig')
 python = import('python')
 
-# Versioning
-version = meson.project_version()
-
 api_version = '3.36'
 
 package_name = meson.project_name()
@@ -107,12 +104,12 @@ endif
 config_h = configuration_data()
 config_h.set_quoted('PACKAGE_NAME', package_name)
 config_h.set_quoted('PACKAGE_STRING', package_string)
-config_h.set_quoted('PACKAGE_VERSION', version)
+config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
 config_h.set_quoted('GETTEXT_PACKAGE', package_name)
 config_h.set_quoted('LOCALEDIR', localdir)
 config_h.set_quoted('LIBDIR', libdir)
 config_h.set_quoted('DATADIR', datadir)
-config_h.set_quoted('VERSION', version)
+config_h.set_quoted('VERSION', meson.project_version())
 
 version_array = meson.project_version().split('.')
 config_h.set('GEDIT_MAJOR_VERSION', version_array[0])
@@ -179,7 +176,7 @@ endif
 summary = [
   '',
   '------',
-  'gedit @0@ (@1@)'.format(version, api_version),
+  'gedit @0@ (@1@)'.format(meson.project_version(), api_version),
   '',
   '       API docs: @0@'.format(build_gtk_doc),
   '      User docs: @0@'.format(get_option('user_documentation')),


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