-
-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add support for pyproject.toml (tool.cxfreeze) (#2244)
- Loading branch information
1 parent
dd7518f
commit 2b7f36e
Showing
12 changed files
with
310 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Internal module.""" | ||
|
||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
|
||
try: | ||
from tomllib import loads as toml_loads | ||
except ImportError: | ||
try: | ||
from setuptools.extern.tomli import loads as toml_loads | ||
except ImportError: | ||
from tomli import loads as toml_loads | ||
|
||
|
||
def get_pyproject_tool_data() -> dict: | ||
pyproject_toml = Path("pyproject.toml") | ||
if not pyproject_toml.exists(): | ||
return {} | ||
data = toml_loads(pyproject_toml.read_bytes().decode()) | ||
tool_data = data.get("tool", {}).get("cxfreeze", {}) | ||
executables = tool_data.pop("executables", []) | ||
options = {} | ||
for cmd, data in tool_data.items(): | ||
for option, value in data.items(): | ||
options.setdefault(cmd, {}) | ||
options[cmd].setdefault(option, ("tool.cxfreeze", value)) | ||
options["executables"] = executables | ||
return options |
Oops, something went wrong.