diff options
author | David Robillard <d@drobilla.net> | 2023-04-02 15:19:31 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-04-02 15:19:31 -0400 |
commit | 41c87f9cffc2d18bcb5d311ccf8c6e316e820a85 (patch) | |
tree | d5d949816163d20b7379a95d0efe12dbb48076f0 /scripts/meson.build | |
parent | eea9955c7bc91c5f095d9d901d45064249fbee28 (diff) | |
download | zix-41c87f9cffc2d18bcb5d311ccf8c6e316e820a85.tar.gz zix-41c87f9cffc2d18bcb5d311ccf8c6e316e820a85.tar.bz2 zix-41c87f9cffc2d18bcb5d311ccf8c6e316e820a85.zip |
Only check benchmark.py with pylint if matplotlib is present
Diffstat (limited to 'scripts/meson.build')
-rw-r--r-- | scripts/meson.build | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/scripts/meson.build b/scripts/meson.build index be6f5e8..604db89 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -2,22 +2,38 @@ # SPDX-License-Identifier: 0BSD OR ISC if get_option('strict') and not meson.is_subproject() - flake8 = find_program('flake8', required: get_option('tests')) - pylint = find_program('pylint', required: get_option('tests')) - black = find_program('black', required: get_option('tests')) + simple_scripts = files('benchmark.py') + plot_scripts = files('plot.py') - all_scripts = files('benchmark.py', 'plot.py') - - if is_variable('black') and black.found() + # Check formatting with black + black = find_program('black', required: get_option('tests')) + if black.found() black_opts = ['-l', '79', '-q', '--check'] test('black', black, args: black_opts + all_scripts, suite: 'scripts') endif - if is_variable('flake8') and flake8.found() + # Check for errors with flake8 + flake8 = find_program('flake8', required: get_option('tests')) + if flake8.found() test('flake8', flake8, args: all_scripts, suite: 'scripts') endif - if is_variable('pylint') and pylint.found() - test('pylint', pylint, args: all_scripts, suite: 'scripts') + # Check for errors with pylint + pylint = find_program('pylint', required: get_option('tests')) + if pylint.found() + pymod = import('python') + plot_py = pymod.find_installation( + 'python3', + modules: ['matplotlib'], + required: false, + ) + + all_scripts = simple_scripts + plot_scripts + lint_scripts = simple_scripts + if plot_py.found() + lint_scripts += plot_scripts + endif + + test('pylint', pylint, args: lint_scripts, suite: 'scripts') endif endif |