-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathmeson.build
More file actions
39 lines (34 loc) · 1.09 KB
/
meson.build
File metadata and controls
39 lines (34 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# SPDX-FileCopyrightText: 2026 The meson-python developers
#
# SPDX-License-Identifier: MIT
project(
'dynamic-version-from-script',
version: run_command(
['generate_version.py', '--print-version'],
check: true,
).stdout().strip(),
)
fs = import('fs')
py = import('python').find_installation()
py.install_sources(
'dynamic_version_from_script/__init__.py',
subdir: 'dynamic_version_from_script',
)
meson.add_dist_script('generate_version.py', '-o', 'dynamic_version_from_script/_version.py')
if not fs.exists('dynamic_version_from_script/_version.py')
custom_target(
'write_version_file',
output: '_version.py',
command: ['generate_version.py', '-o', '@OUTPUT@'],
build_by_default: true,
build_always_stale: true,
install: true,
install_dir: py.get_install_dir() / 'dynamic_version_from_script',
)
else
# When building from sdist, _version.py exists and should be included
py.install_sources(
['dynamic_version_from_script/_version.py'],
subdir: 'dynamic_version_from_script',
)
endif