From f87de4d9bf9c66976a0dd7686c27e6adabedc48a Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Mon, 4 Aug 2025 09:52:36 +0300 Subject: [PATCH] [+] improve meson:setup 1. allow to pass mode; --- python/meson.build | 2 +- python/online/fxreader/pr34/commands_typed/cli.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/python/meson.build b/python/meson.build index cff2a3b..0230458 100644 --- a/python/meson.build +++ b/python/meson.build @@ -5,7 +5,7 @@ project( ).stdout().strip('\n'), # 'online.fxreader.uv', # ['c', 'cpp'], - version: '0.1.5.19', + version: '0.1.5.20', # default_options: [ # 'cpp_std=c++23', # # 'prefer_static=true', diff --git a/python/online/fxreader/pr34/commands_typed/cli.py b/python/online/fxreader/pr34/commands_typed/cli.py index b5a664c..ccbe3f4 100644 --- a/python/online/fxreader/pr34/commands_typed/cli.py +++ b/python/online/fxreader/pr34/commands_typed/cli.py @@ -648,11 +648,15 @@ class CLI(abc.ABC): force: bool, argv: Optional[list[str]] = None, env: Optional[dict[str, str]] = None, + mode: Optional[Literal['meson', 'pyproject']] = None, # third_party_roots: Optional[list[pathlib.Path]] = None, ) -> None: from . import cli_bootstrap from .os import shutil_rmtree + if mode is None: + mode = 'meson' + project = self.projects[project_name] if argv is None: @@ -668,9 +672,9 @@ class CLI(abc.ABC): logger.info(dict(env=env)) if force: - if (project.build_dir / 'meson').exists(): - logger.info(dict(action='removing build dir', path=project.build_dir / 'meson')) - shutil.rmtree(project.build_dir / 'meson') + if (project.build_dir / mode).exists(): + logger.info(dict(action='removing build dir', path=project.build_dir / mode)) + shutil.rmtree(project.build_dir / mode) extra_args: list[str] = [] @@ -692,8 +696,8 @@ class CLI(abc.ABC): 'mesonbuild.mesonmain', 'setup', str(project.source_dir), - str(project.build_dir / 'meson'), - '-Dmodes=["meson"]', + str(project.build_dir / mode), + '-Dmodes=["{}"]'.format(mode), *extra_args, # '-Dpkgconfig.relocatable=true', '-Dprefix=/',