diff options
author | Jouke Witteveen <j.witteveen@gmail.com> | 2024-02-02 18:20:37 +0100 |
---|---|---|
committer | Jouke Witteveen <j.witteveen@gmail.com> | 2024-02-12 22:19:59 +0100 |
commit | 524a66116b38a65210b7516781d26ed6efb690b9 (patch) | |
tree | 1d781f624b8b07301a91008ad499c3521ed5c4bd /test cases/unit/35 dist script | |
parent | db51dcfa47d66b094a13eb127e09d3134d8dbf1f (diff) | |
download | meson-524a66116b38a65210b7516781d26ed6efb690b9.zip meson-524a66116b38a65210b7516781d26ed6efb690b9.tar.gz meson-524a66116b38a65210b7516781d26ed6efb690b9.tar.bz2 |
Add MESONREWRITE to `meson dist` scripts
Fixes #688
Diffstat (limited to 'test cases/unit/35 dist script')
3 files changed, 17 insertions, 1 deletions
diff --git a/test cases/unit/35 dist script/subprojects/sub/dist-script.py b/test cases/unit/35 dist script/subprojects/sub/dist-script.py index 1274f29..5f1b4a1 100644 --- a/test cases/unit/35 dist script/subprojects/sub/dist-script.py +++ b/test cases/unit/35 dist script/subprojects/sub/dist-script.py @@ -2,11 +2,18 @@ import os import pathlib +import shlex +import subprocess import sys assert sys.argv[1] == 'success' source_root = pathlib.Path(os.environ['MESON_PROJECT_DIST_ROOT']) +mesonrewrite = shlex.split(os.environ['MESONREWRITE']) +rewrite_cmd = ['kwargs', 'set', 'project', '/', 'version', 'release'] + +subprocess.run([*mesonrewrite, '-s', source_root, *rewrite_cmd], check=True) + modfile = source_root / 'prog.c' with modfile.open('w') as f: f.write('int main(){return 0;}') diff --git a/test cases/unit/35 dist script/subprojects/sub/meson.build b/test cases/unit/35 dist script/subprojects/sub/meson.build index a41a3b6..9dc047c 100644 --- a/test cases/unit/35 dist script/subprojects/sub/meson.build +++ b/test cases/unit/35 dist script/subprojects/sub/meson.build @@ -1,4 +1,5 @@ -project('sub', 'c') +project('sub', 'c', + version : 'vcs') if get_option('broken_dist_script') # Make sure we can add a dist script in a subproject, but it won't be run @@ -8,4 +9,7 @@ else # The dist script replace prog.c with something that actually build. meson.add_dist_script('dist-script.py', 'success') executable('prog', 'prog.c') + + versiontest = find_program('version-test.py') + test('dist version replacement', versiontest, args : meson.project_version()) endif diff --git a/test cases/unit/35 dist script/subprojects/sub/version-test.py b/test cases/unit/35 dist script/subprojects/sub/version-test.py new file mode 100644 index 0000000..1dcafc4 --- /dev/null +++ b/test cases/unit/35 dist script/subprojects/sub/version-test.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 + +from sys import argv + +assert argv[1] == 'release' |