diff --git a/python/cli.py b/python/cli.py index b190db9..840d0ff 100644 --- a/python/cli.py +++ b/python/cli.py @@ -27,6 +27,7 @@ class Command(enum.StrEnum): mypy = 'mypy' deploy_wheel = 'deploy:wheel' tests = 'tests' + meson_setup = 'meson:setup' @dataclasses.dataclass class Settings( @@ -143,6 +144,14 @@ class CLI(_cli.CLI): output_dir=options.output_dir, mypy=True, ) + elif options.command is Command.meson_setup: + assert not options.project is None + + self.meson_setup( + project_name=options.project, + argv=args, + force=options.force, + ) elif options.command is Command.mypy: self.mypy( argv=args, diff --git a/python/meson.build b/python/meson.build index 7f612ef..1494182 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.16+27.7', + version: '0.1.5.16+27.8', # default_options: [ # 'cpp_std=c++23', # # 'prefer_static=true', diff --git a/python/meson_options.txt b/python/meson_options.txt new file mode 100644 index 0000000..bad457a --- /dev/null +++ b/python/meson_options.txt @@ -0,0 +1,2 @@ +option('modes', type: 'array', choices: ['meson', 'pyproject'], value: ['pyproject']) +option('install_path', type : 'string', value: '') diff --git a/python/online/fxreader/pr34/commands_typed/cli.py b/python/online/fxreader/pr34/commands_typed/cli.py index b7935c0..db7293d 100644 --- a/python/online/fxreader/pr34/commands_typed/cli.py +++ b/python/online/fxreader/pr34/commands_typed/cli.py @@ -624,7 +624,16 @@ class CLI(abc.ABC): assert isinstance(p, tomlkit.items.Table) p['name'] = module.name + if not pyproject2['tool']: + pyproject2['tool'] = [] + + pyproject_tool = pyproject2['tool'] + assert isinstance(pyproject_tool, tomlkit.items.Array) + + pyproject_tool.extend(module.tool) + del p + del pyproject_tool tomlkit.dump( pyproject2, diff --git a/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py b/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py index 0ff3d67..1987543 100644 --- a/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py +++ b/python/online/fxreader/pr34/commands_typed/cli_bootstrap.py @@ -39,7 +39,7 @@ class PyProject: class Module: name: str meson: Optional[pathlib.Path] = None - + tool: list[Any] = dataclasses.field(default_factory=lambda : []) path: pathlib.Path dependencies: dict[str, list[str]] @@ -149,6 +149,11 @@ def pyproject_load( module.meson = pathlib.Path(o['meson']) + if 'tool' in o: + assert isinstance(o['tool'], list) + + module.tool.extend(o['tool']) + res.modules.append(module) return res