[+] update module_switch

1. allow per module tool array;
  2. partially fix deploy:wheel;
This commit is contained in:
Siarhei Siniak 2025-05-09 14:35:27 +03:00
parent 0166dc4756
commit 9a12e71493
5 changed files with 27 additions and 2 deletions

@ -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,

@ -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',

2
python/meson_options.txt Normal file

@ -0,0 +1,2 @@
option('modes', type: 'array', choices: ['meson', 'pyproject'], value: ['pyproject'])
option('install_path', type : 'string', value: '')

@ -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,

@ -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