reinstall cx_freeze with downgraded setuptools

This commit is contained in:
Ondrej Samohel 2021-10-07 18:18:33 +02:00
parent 4d612931ef
commit 9f9caafb0d
4 changed files with 52 additions and 42 deletions

View file

@ -59,13 +59,14 @@ includes = []
excludes = [
"openpype"
]
bin_includes = []
bin_includes = [
"vendor"
]
include_files = [
"igniter",
"openpype",
"repos",
"schema",
"vendor",
"LICENSE",
"README.md"
]

View file

@ -113,7 +113,26 @@ if not build_dir.exists():
_print("Probably freezing of code failed. Check ./build/build.log", 3)
sys.exit(1)
def _progress(_base, _names):
progress_bar.update()
return []
deps_dir = build_dir / "dependencies"
vendor_dir = build_dir / "vendor"
vendor_src = openpype_root / "vendor"
# copy vendor files
_print("Copying vendor files ...")
total_files = count_folders(vendor_src)
progress_bar = enlighten.Counter(
total=total_files, desc="Copying vendor files ...",
units="%", color=(64, 128, 222))
shutil.copytree(vendor_src.as_posix(),
vendor_dir.as_posix(),
ignore=_progress)
progress_bar.close()
# copy all files
_print("Copying dependencies ...")
@ -123,12 +142,6 @@ progress_bar = enlighten.Counter(
total=total_files, desc="Processing Dependencies",
units="%", color=(53, 178, 202))
def _progress(_base, _names):
progress_bar.update()
return []
shutil.copytree(site_pkg.as_posix(),
deps_dir.as_posix(),
ignore=_progress)

View file

@ -189,10 +189,12 @@ main () {
# cx_freeze will crash on missing __pychache__ on these but
# reinstalling them solves the problem.
echo -e "${BIGreen}>>>${RST} Post-venv creation fixes ..."
local openpype_index=$("$POETRY_HOME/bin/poetry" run python "$openpype_root/tools/parse_pyproject.py" tool.poetry.source.0.url)
echo -e "${BIGreen}- ${RST} Using index: ${BIWhite}$openpype_index${RST}"
"$POETRY_HOME/bin/poetry" run pip install setuptools==49.6.0
"$POETRY_HOME/bin/poetry" run pip install --disable-pip-version-check --force-reinstall wheel
"$POETRY_HOME/bin/poetry" run python -m pip install --disable-pip-version-check --force-reinstall pip
"$POETRY_HOME/bin/poetry" run pip install --disable-pip-version-check --force-reinstall cx_freeze
"$POETRY_HOME/bin/poetry" run pip install --disable-pip-version-check --force-reinstall cx_freeze -i $openpype_index --extra-index-url https://pypi.org/simple
}
return_code=0

View file

@ -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__":