Enhance | 写完 parse_output
This commit is contained in:
parent
fb5f7f3473
commit
e495cdbfa4
@ -57,7 +57,6 @@ logger.trace('so this message will be in the same line', tag='same line!')
|
||||
### Nuitka pyproject paser
|
||||
|
||||
> `pyproject.toml` 内的配置
|
||||
>
|
||||
> Config in `pyproject.toml`
|
||||
|
||||
```toml title="pyproject.toml"
|
||||
@ -69,7 +68,6 @@ onefile = false
|
||||
```
|
||||
|
||||
> 通过 `lndl_nuitka` 命令行工具使用
|
||||
>
|
||||
> Use with `lndl_nuitka` command line tool
|
||||
|
||||
```bash
|
||||
@ -83,7 +81,6 @@ lndl_nuitka . -n
|
||||
```
|
||||
|
||||
> 通过 `lib_not_dr.nuitka.reader` 模块使用
|
||||
>
|
||||
> Use with `lib_not_dr.nuitka.reader`
|
||||
|
||||
```python
|
||||
|
@ -162,7 +162,7 @@ class ConfigStorage(Options):
|
||||
self.merge_storage(env)
|
||||
return None
|
||||
|
||||
def parse_output(self, output_config: Dict[str, dict]) -> 'ConfigStorage':
|
||||
def parse_output(self, output_config: Dict[str, dict]) -> None:
|
||||
"""
|
||||
Parse output config
|
||||
:param output_config:
|
||||
@ -175,6 +175,17 @@ class ConfigStorage(Options):
|
||||
if output_class is None:
|
||||
env.fail_outputs[output_name] = config
|
||||
continue
|
||||
# get formatter for output
|
||||
if 'formatter' in config:
|
||||
if self.formatters.get(config['formatter']) is None:
|
||||
if self.fail_formatters.get(config['formatter']) is None:
|
||||
self.log.error(f'Output {output_name} formatter {config["formatter"]} not found, ignored')
|
||||
else:
|
||||
self.log.error(f'Output {output_name} require a fail formatter {config["formatter"]}, ignored')
|
||||
env.fail_outputs[output_name] = config
|
||||
continue
|
||||
else:
|
||||
config['formatter'] = self.formatters[config['formatter']]
|
||||
# init output
|
||||
try:
|
||||
output_instance = output_class(**config)
|
||||
@ -185,7 +196,8 @@ class ConfigStorage(Options):
|
||||
continue
|
||||
# add output
|
||||
env.outputs[output_name] = output_instance
|
||||
return env
|
||||
self.merge_storage(env)
|
||||
return None
|
||||
|
||||
def read_dict_config(self, config: Dict[str, dict]) -> None:
|
||||
"""
|
||||
|
@ -17,13 +17,13 @@ def pyproject_toml(toml_data: dict) -> dict:
|
||||
:return: dict
|
||||
"""
|
||||
if "tool" not in toml_data:
|
||||
raise ValueError(f"No tool section in config file/dict")
|
||||
raise ValueError("No tool section in config file/dict")
|
||||
|
||||
if "lndl" not in toml_data["tool"]:
|
||||
raise ValueError(f"No lib-not-dr(lndl) section in config file/dict")
|
||||
raise ValueError("No lib-not-dr(lndl) section in config file/dict")
|
||||
|
||||
if "nuitka" not in toml_data["tool"]["lndl"]:
|
||||
raise ValueError(f"No lib-not-dr(lndl).nuitka section in config file/dict")
|
||||
raise ValueError("No lib-not-dr(lndl).nuitka section in config file/dict")
|
||||
|
||||
nuitka_config = toml_data["tool"]["lndl"]["nuitka"]
|
||||
|
||||
@ -152,7 +152,7 @@ def gen_subprocess_args(nuitka_config:
|
||||
continue
|
||||
if all(isinstance(item, str) for item in value):
|
||||
# --<name>=<value1>,<value2>,...
|
||||
cmd_list.append(f"--{name}={','.join(value)}")
|
||||
cmd_list.append(f"--{name}={','.join(value)}") # type: ignore
|
||||
elif all(isinstance(item, (tuple, list)) for item in value):
|
||||
# --<name>=<value1>=<value2>
|
||||
# --<name>=<value3>=<value4>,...
|
||||
|
Loading…
Reference in New Issue
Block a user