[gedit-plugins] build: do not use a variable for meson.project_version()



commit 4ec93d8dc095522ec9d3e682f3f2a066e607bdbe
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Nov 11 15:40:13 2019 +0100

    build: do not use a variable for meson.project_version()
    
    It's better to avoid global variables (a variable that is used in
    several files).
    Also, "meson.project_version()" is more greppable,
    `git grep version` in meson files gives lots of other results.

 meson.build         | 9 ++++-----
 plugins/meson.build | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/meson.build b/meson.build
index fb18048..ceee860 100644
--- a/meson.build
+++ b/meson.build
@@ -10,8 +10,7 @@ pkg = import('pkgconfig')
 python = import('python')
 
 # Versioning
-version = meson.project_version()
-version_arr = version.split('.')
+version_arr = meson.project_version().split('.')
 version_major = version_arr[0]
 version_minor = version_arr[1]
 version_micro = version_arr[2]
@@ -58,12 +57,12 @@ appstream_util = find_program('appstream-util', required: false)
 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', localedir)
 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())
 
 config_h.set('GEDIT_MAJOR_VERSION', version_major)
 config_h.set('GEDIT_MINOR_VERSION', version_minor)
@@ -133,7 +132,7 @@ subdir('help')
 summary = [
   '',
   '------',
-  'gedit-plugins @0@ (@1@)'.format(version, api_version),
+  'gedit-plugins @0@ (@1@)'.format(meson.project_version(), api_version),
   '',
   '  AppData: @0@'.format(install_metainfo),
   '',
diff --git a/plugins/meson.build b/plugins/meson.build
index 49f2116..1838b04 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -9,13 +9,13 @@ msgfmt_plugin_cmd = [
 ]
 
 plugin_in = configuration_data()
-plugin_in.set('VERSION', version)
+plugin_in.set('VERSION', meson.project_version())
 
 gpdefs_py = configuration_data()
 gpdefs_py.set('PACKAGE', package_name)
 gpdefs_py.set('PACKAGE_STRING', package_string)
 gpdefs_py.set('GETTEXT_PACKAGE', package_name)
-gpdefs_py.set('VERSION', version)
+gpdefs_py.set('VERSION', meson.project_version())
 
 gpdefs_py.set('prefix', prefix)
 


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