Add optional dependecy

This commit is contained in:
shenjack 2023-11-25 03:33:48 +08:00
parent de5440adeb
commit 54bed5b64c
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 8 additions and 4 deletions

View File

@ -45,6 +45,9 @@ build-backend = "setuptools.build_meta"
#lib_not_dr = "lib_not_dr" #lib_not_dr = "lib_not_dr"
#lndl_nuitka = "lndl_nuitka" #lndl_nuitka = "lndl_nuitka"
[project.optional-dependencies]
toml = ["tomli >= 2.0.1"]
[tool.setuptools.dynamic] [tool.setuptools.dynamic]
version = { attr = "lib_not_dr.__version__"} version = { attr = "lib_not_dr.__version__"}

View File

@ -64,7 +64,8 @@ def get_toml_reader():
return toml_loads return toml_loads
except ImportError: except ImportError:
continue continue
error_msg = """No toml reader found, please install any below by pip:\n%s error_msg = """No toml reader found, please install any below by pip:
%s
or use Python 3.11+""" % " ".join( or use Python 3.11+""" % " ".join(
TOML_READERS TOML_READERS
) )
@ -100,15 +101,15 @@ def gen_subprocess_args(nuitka_config: dict) -> list:
for name, value in nuitka_config.items(): for name, value in nuitka_config.items():
if value is True: if value is True:
# --<name> # --<name>
cmd_list.append("--%s" % name) cmd_list.append(f"--{name}")
continue continue
elif isinstance(value, str): elif isinstance(value, str):
# --<name>=<value> # --<name>=<value>
cmd_list.append("--%s=%s" % (name, value)) cmd_list.append(f"--{name}={value}")
continue continue
elif isinstance(value, Iterable): elif isinstance(value, Iterable):
# --<name>=<value1>,<value2>,... # --<name>=<value1>,<value2>,...
cmd_list.append("--%s=%s" % (name, ",".join(value))) cmd_list.append(f"--{name}={','.join(value)}")
continue continue
return cmd_list return cmd_list