[+] partially update meson_install

1. add parsing of tool section
    from pyproject.toml;
    to add install arguments for meson_install;
This commit is contained in:
Siarhei Siniak 2025-05-12 15:51:42 +03:00
parent 43c85ca162
commit 51f08a0ea6
4 changed files with 20 additions and 5 deletions

@ -5,7 +5,7 @@ project(
).stdout().strip('\n'), ).stdout().strip('\n'),
# 'online.fxreader.uv', # 'online.fxreader.uv',
# ['c', 'cpp'], # ['c', 'cpp'],
version: '0.1.5.16+27.11', version: '0.1.5.16+27.12',
# default_options: [ # default_options: [
# 'cpp_std=c++23', # 'cpp_std=c++23',
# # 'prefer_static=true', # # 'prefer_static=true',

@ -28,15 +28,21 @@ class Project:
dest_dir : pathlib.Path dest_dir : pathlib.Path
meson_path: Optional[pathlib.Path] = None meson_path: Optional[pathlib.Path] = None
@dataclasses.dataclass
class PyProject: class PyProject:
@dataclasses.dataclass
class Tool: class Tool:
@dataclasses.dataclass
class Meson: class Meson:
@dataclasses.dataclass
class Args: class Args:
install: list[str] install: list[str]
args: Args args: Args
@dataclasses.dataclass
class MesonPython: class MesonPython:
@dataclasses.dataclass
class Args: class Args:
install: list[str] install: list[str]
@ -349,6 +355,8 @@ class CLI(abc.ABC):
force: Optional[bool] = None, force: Optional[bool] = None,
argv: Optional[list[str]] = None, argv: Optional[list[str]] = None,
) -> None: ) -> None:
from . import cli_bootstrap
project = self.projects[project_name] project = self.projects[project_name]
if force is None: if force is None:
@ -365,8 +373,8 @@ class CLI(abc.ABC):
) )
pyproject_tool = pydantic.RootModel[ pyproject_tool = pydantic.RootModel[
PyProject PyProject.Tool
].model_validate(pyproject.module) ].model_validate(pyproject.tool).root
if ( if (
pyproject_tool.meson and pyproject_tool.meson and
@ -379,8 +387,8 @@ class CLI(abc.ABC):
shutil_which('meson', True,), shutil_which('meson', True,),
'install', 'install',
'-C', '-C',
project.build_dir / 'meson', str(project.build_dir / 'meson'),
'--destdir', project.dest_dir, '--destdir', str(project.dest_dir),
*argv, *argv,
] ]

@ -54,6 +54,10 @@ class PyProject:
default_factory=lambda : [], default_factory=lambda : [],
) )
tool: dict[str, Any] = dataclasses.field(
default_factory=dict,
)
def pyproject_load( def pyproject_load(
d: pathlib.Path, d: pathlib.Path,
) -> PyProject: ) -> PyProject:

Binary file not shown.