Skip to content

Commit

Permalink
fix: add new style dep install
Browse files Browse the repository at this point in the history
Signed-off-by: rjdbcm <[email protected]>
  • Loading branch information
rjdbcm committed Aug 28, 2024
1 parent 5951997 commit 503364e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
10 changes: 10 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ to_distribution = run_command(
],
check: true,
).stdout()
install_dependencies = run_command(
python,
[
'-c',
python_readlines.format(scripts / 'meson_postconf_install_dependencies.py'),
],
check: true,
).stdout()
replace_ruff_target_version = run_command(
python,
[
Expand Down Expand Up @@ -206,6 +214,8 @@ configure_file(
command: [python, '-c', meson_setuptools_scm],
output: 'PKG-INFO',
)
deps = run_command(python, '-c', install_dependencies, check: true).stdout().strip().split('$$')
meson.add_postconf_script(pip, 'install', deps)
meson.add_dist_script(pip, 'install', 'tomli>=2.0.0')
meson.add_dist_script(python, '-c', meson_dist_setuptools_scm)
vcs_tag(input: 'pyproject.toml', output: 'pyproject.orig.toml')
Expand Down
28 changes: 28 additions & 0 deletions ozi/scripts/meson_postconf_install_dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

import os
import sys
from pathlib import Path

if sys.version_info >= (3, 11): # pragma: no cover
import tomllib as toml
elif sys.version_info < (3, 11): # pragma: no cover
import tomli as toml


if __name__ == '__main__':
source = '/' / Path(
os.path.relpath(
os.path.join('/', os.environ.get('MESON_BUILD_ROOT', os.path.relpath('..'))),
'/',
),
)
dist = '/' / Path(
os.path.relpath(
os.path.join('/', os.environ.get('MESON_DIST_ROOT', os.path.relpath('..'))),
'/',
),
)
with (source / 'pyproject.toml').open('rb') as project_file:
pyproject_toml = toml.load(project_file)
dependencies = pyproject_toml.get('project', {}).get('dependencies', [])
print('$$'.join(dependencies))

0 comments on commit 503364e

Please sign in to comment.