[libvirt PATCH v3 2/3] meson: Add spell checking

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

 



If "codespell" is installed, use it to find spelling mistakes.
Enabled by default, disable with "meson -Dspellcheck=disabled".

Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 build-aux/meson.build | 16 ++++++++++++++++
 meson.build           |  1 +
 meson_options.txt     |  1 +
 scripts/meson.build   |  1 +
 4 files changed, 19 insertions(+)

diff --git a/build-aux/meson.build b/build-aux/meson.build
index e491bdeebc..96fa694d26 100644
--- a/build-aux/meson.build
+++ b/build-aux/meson.build
@@ -67,3 +67,19 @@ if git
     )
   endforeach
 endif
+
+
+if get_option('spellcheck').auto()
+  use_spellcheck = git and codespell_prog.found()
+else
+  use_spellcheck = get_option('spellcheck').enabled()
+endif
+
+if use_spellcheck
+  test(
+    'check-spelling',
+    python3_prog,
+    args: [ check_spelling_prog.path(), '--ignore-untracked' ],
+    suite: 'syntax-check',
+  )
+endif
diff --git a/meson.build b/meson.build
index 70843afcd5..0f0a065247 100644
--- a/meson.build
+++ b/meson.build
@@ -812,6 +812,7 @@ endforeach
 
 optional_programs = [
   'augparse',
+  'codespell',
   'dmidecode',
   'ebtables',
   'flake8',
diff --git a/meson_options.txt b/meson_options.txt
index 5b43cdbd6b..b3aabdad35 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -10,6 +10,7 @@ option('rpath', type: 'feature', value: 'auto', description: 'whether to include
 option('docdir', type: 'string', value: '', description: 'documentation installation directory')
 option('docs', type: 'feature', value: 'auto', description: 'whether to generate documentation')
 option('tests', type: 'feature', value: 'auto', description: 'whether to build tests')
+option('spellcheck', type: 'feature', value: 'auto', description: 'whether to check spelling')
 
 
 # build dependencies options
diff --git a/scripts/meson.build b/scripts/meson.build
index 421e3d2acd..735c963c38 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -7,6 +7,7 @@ scripts = [
   'check-drivername.py',
   'check-file-access.py',
   'check-remote-protocol.py',
+  'check-spelling.py',
   'check-symfile.py',
   'check-symsorting.py',
   'dtrace2systemtap.py',
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux