[+] partially add pyproject.toml generation
This commit is contained in:
parent
ffdd17270e
commit
d6f921eab6
@ -556,6 +556,9 @@ class CLI(abc.ABC):
|
|||||||
# force: bool,
|
# force: bool,
|
||||||
argv: Optional[list[str]] = None,
|
argv: Optional[list[str]] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
import tomlkit
|
||||||
|
import tomlkit.items
|
||||||
|
|
||||||
from . import cli_bootstrap
|
from . import cli_bootstrap
|
||||||
from . import argparse as pr34_argparse
|
from . import argparse as pr34_argparse
|
||||||
|
|
||||||
@ -599,4 +602,36 @@ class CLI(abc.ABC):
|
|||||||
for o in pyproject.modules
|
for o in pyproject.modules
|
||||||
]
|
]
|
||||||
|
|
||||||
|
modules: dict[
|
||||||
|
str,
|
||||||
|
cli_bootstrap.PyProject.Module
|
||||||
|
] = {
|
||||||
|
o.name : o
|
||||||
|
for o in pyproject.modules
|
||||||
|
}
|
||||||
|
|
||||||
|
module = modules[options.module]
|
||||||
|
|
||||||
|
with io.open(options.file, 'rb') as f:
|
||||||
|
pyproject2 = tomlkit.load(options.file)
|
||||||
|
|
||||||
|
with io.open(
|
||||||
|
project.source_dir / 'pyproject.toml',
|
||||||
|
'w',
|
||||||
|
) as f:
|
||||||
|
p = pyproject2['project']
|
||||||
|
assert isinstance(p, tomlkit.items.Item)
|
||||||
|
n = p['name']
|
||||||
|
assert isinstance(n, tomlkit.items.Item)
|
||||||
|
n = module.name
|
||||||
|
|
||||||
|
del n
|
||||||
|
del p
|
||||||
|
|
||||||
|
tomlkit.dump(
|
||||||
|
pyproject2,
|
||||||
|
f
|
||||||
|
)
|
||||||
|
del pyproject2
|
||||||
|
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
Loading…
Reference in New Issue
Block a user