-
Notifications
You must be signed in to change notification settings - Fork 2
/
meson.build
114 lines (114 loc) · 3.36 KB
/
meson.build
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# OZI 0.1 meson.build:root_files,root_children
# Part of blastpipe.
# See LICENSE.txt in the project root for details.
# DO NOT EDIT BY HAND - This file was generated for use with OZI tools.
# ozi-fix -> meson rewrite is the standard editing pipeline.
project(
'blastpipe',
default_options: ['warning_level=3'],
license: 'Apache-2.0 WITH LLVM-exception',
license_files: ['LICENSE.txt'],
meson_version: '>=1.1.0',
version: run_command(
'python3',
[
'-c',
'from setuptools_scm import get_version;print(get_version(normalize=False))',
],
check: true,
).stdout().strip(),
)
env = environment()
fs = import('fs')
pymod = import('python')
project_name = meson.project_name()
docs_source = 'subprojects/docs'
pip_compile = find_program(get_option('compile-requirements-command')[0], required: true)
root_files = [
'README.rst',
'CHANGELOG.md',
'LICENSE.txt',
'requirements.in',
'pyproject.toml',
'.gitignore',
'.pre-commit-config.yaml',
'NOTICE.md',
]
custom_target(
'requirements-blastpipe',
input: root_files[3],
output: 'requirements.txt',
build_always_stale: true,
build_by_default: true,
command: [
get_option('compile-requirements-command'),
'--allow-unsafe',
'--strip-extras',
'-q',
'--generate-hashes',
'-o',
'@OUTPUT@',
'@INPUT@'
]
)
python = pymod.find_installation()
pyproject_config = configuration_data()
pyproject_config.set(
'PYTHON_VERSION_DIST',
'py'+''.join(python.language_version().split('.'))
)
pyproject_config.set('SCM_VERSION', meson.project_version())
pyproject_config.set('VCS_TAG', '@VCS_TAG@')
pyproject_config.set('PROJECT_NAME', project_name)
pyproject_config.set('README_TEXT', fs.read('README.rst'))
pyproject_config.set('REQUIREMENTS_IN',
run_command(
python, ['-c', '''import os;import pathlib
requirements = (
r.partition('\u0023')[0]
for r in filter(
lambda r: not (r.startswith('\u0023') or r == '\n'),
pathlib.Path('./requirements.in').read_text('utf-8').splitlines(),
)
)
for req in requirements:
print(f'Requires-Dist: {req}')
'''], check: true
).stdout().strip()
)
pyproject_config.set('LICENSE', meson.project_license()[0])
configure_file(
input: 'pyproject.toml',
output: 'pyproject.toml',
configuration: pyproject_config
)
vcs_tag(input: 'pyproject.toml', output: 'pyproject.orig.toml')
foreach source : root_files
if source not in ['pyproject.toml', '.gitignore', 'CHANGELOG.md']
fs.copyfile(source)
endif
endforeach
root_children = [
'blastpipe',
'tests',
]
foreach child: root_children
subdir(child)
endforeach
if false
executable('root_files', root_files)
executable('root_children', root_children)
executable('source_files', source_files)
executable('source_children', source_children)
executable('test_files', test_files)
endif
if not meson.is_subproject()
dev = subproject('ozi')
foreach var : get_option('variables')
name = var.replace('-', '_')
set_variable(name, dev.get_variable(name))
endforeach
meson.add_dist_script(dev.get_variable('pip'), 'install', 'tomli>=2.0.0')
meson.add_dist_script(python, '-c', dev.get_variable('meson_dist_setuptools_scm'))
endif
subproject('msgspec', default_options: ['install-subprojects=enabled'])