mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
reinstall cx_freeze with downgraded setuptools
This commit is contained in:
parent
4d612931ef
commit
9f9caafb0d
4 changed files with 52 additions and 42 deletions
|
|
@ -3,49 +3,43 @@
|
|||
|
||||
Useful for shell scripts to know more about OpenPype build.
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
import blessed
|
||||
import toml
|
||||
from pathlib import Path
|
||||
import click
|
||||
|
||||
term = blessed.Terminal()
|
||||
|
||||
|
||||
def _print(msg: str, message_type: int = 0) -> None:
|
||||
"""Print message to console.
|
||||
|
||||
Args:
|
||||
msg (str): message to print
|
||||
message_type (int): type of message (0 info, 1 error, 2 note)
|
||||
|
||||
"""
|
||||
if message_type == 0:
|
||||
header = term.aquamarine3(">>> ")
|
||||
elif message_type == 1:
|
||||
header = term.orangered2("!!! ")
|
||||
elif message_type == 2:
|
||||
header = term.tan1("... ")
|
||||
else:
|
||||
header = term.darkolivegreen3("--- ")
|
||||
|
||||
print("{}{}".format(header, msg))
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.argument("key", nargs=-1, type=click.STRING)
|
||||
def main(key):
|
||||
_print("Reading build metadata ...")
|
||||
@click.argument("keys", nargs=-1, type=click.STRING)
|
||||
def main(keys):
|
||||
"""Get values from `pyproject.toml`.
|
||||
|
||||
You can specify dot separated keys from `pyproject.toml`
|
||||
as arguments and this script will return them on separate
|
||||
lines. If key doesn't exists, None is returned.
|
||||
|
||||
|
||||
"""
|
||||
openpype_root = Path(os.path.dirname(__file__)).parent
|
||||
py_project = toml.load(openpype_root / "pyproject.toml")
|
||||
query = key.split(".")
|
||||
data = py_project
|
||||
for k in query:
|
||||
if isinstance(data, dict):
|
||||
data = data.get(k)
|
||||
else:
|
||||
break
|
||||
print(data)
|
||||
for q in keys:
|
||||
query = q.split(".")
|
||||
data = py_project
|
||||
for i, k in enumerate(query):
|
||||
|
||||
if isinstance(data, list):
|
||||
try:
|
||||
data = data[int(k)]
|
||||
except IndexError:
|
||||
print("None")
|
||||
sys.exit()
|
||||
continue
|
||||
|
||||
if isinstance(data, dict):
|
||||
data = data.get(k)
|
||||
print(data)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue