mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
fixed tests, renamed entry point
This commit is contained in:
parent
a6bbee9abf
commit
18d63433e0
5 changed files with 67 additions and 13 deletions
|
|
@ -346,12 +346,12 @@ class BootstrapRepos:
|
|||
if file in self.zip_filter:
|
||||
continue
|
||||
|
||||
zip_file.write(
|
||||
os.path.relpath(os.path.join(root, file),
|
||||
os.path.join(include_dir, '..')),
|
||||
os.path.relpath(os.path.join(root, file),
|
||||
file_name = os.path.relpath(
|
||||
os.path.join(root, file),
|
||||
os.path.join(include_dir, '..'))
|
||||
arc_name = os.path.relpath(os.path.join(root, file),
|
||||
os.path.join(include_dir))
|
||||
)
|
||||
zip_file.write(file_name, arc_name)
|
||||
# add pype itself
|
||||
if include_pype:
|
||||
for root, _, files in os.walk("pype"):
|
||||
|
|
@ -491,7 +491,13 @@ class BootstrapRepos:
|
|||
# contain Pype.
|
||||
for file in dir_to_search.iterdir():
|
||||
|
||||
result = PypeVersion.version_in_str(file.stem)
|
||||
# if file, strip extension, in case of dir not.
|
||||
if file.is_dir():
|
||||
name = file.name
|
||||
else:
|
||||
name = file.stem
|
||||
|
||||
result = PypeVersion.version_in_str(name)
|
||||
|
||||
if result[0]:
|
||||
detected_version = result[1]
|
||||
|
|
@ -500,8 +506,16 @@ class BootstrapRepos:
|
|||
# if item is directory that might (based on it's name)
|
||||
# contain Pype version, check if it really does contain
|
||||
# Pype and that their versions matches.
|
||||
version_check = PypeVersion(
|
||||
version=BootstrapRepos.get_version(file))
|
||||
try:
|
||||
# add one 'pype' level as inside dir there should
|
||||
# be many other repositories.
|
||||
version_str = BootstrapRepos.get_version(
|
||||
file / "pype")
|
||||
version_check = PypeVersion(version=version_str)
|
||||
except ValueError:
|
||||
self._log.error(
|
||||
f"cannot determine version from {file}")
|
||||
continue
|
||||
if version_check != detected_version:
|
||||
self._log.error(
|
||||
(f"dir version ({detected_version}) and "
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Working thread for installer."""
|
||||
import os
|
||||
import sys
|
||||
from zipfile import ZipFile
|
||||
|
||||
from Qt.QtCore import QThread, Signal
|
||||
|
|
@ -96,7 +97,14 @@ class InstallThread(QThread):
|
|||
f"currently running one {local_version}"
|
||||
), False)
|
||||
else:
|
||||
self.message.emit("None detected.", False)
|
||||
# we cannot build install package from frozen code.
|
||||
if getattr(sys, 'frozen', False):
|
||||
self.message.emit("None detected.", True)
|
||||
self.message.emit(("Please set path to Pype sources to "
|
||||
"build installation."), False)
|
||||
return
|
||||
else:
|
||||
self.message.emit("None detected.", False)
|
||||
|
||||
self.message.emit(
|
||||
f"We will use local Pype version {local_version}", False)
|
||||
|
|
|
|||
12
setup.py
12
setup.py
|
|
@ -13,8 +13,7 @@ __version__ = version["__version__"]
|
|||
|
||||
base = None
|
||||
if sys.platform == "win32":
|
||||
# base = "Win32GUI"
|
||||
...
|
||||
base = "Win32GUI"
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# build_exe
|
||||
|
|
@ -34,7 +33,9 @@ install_requires = [
|
|||
"jinxed",
|
||||
"blessed",
|
||||
"Qt",
|
||||
"speedcopy"
|
||||
"speedcopy",
|
||||
"googleapiclient",
|
||||
"httplib2"
|
||||
]
|
||||
|
||||
includes = [
|
||||
|
|
@ -70,7 +71,10 @@ buildOptions = dict(
|
|||
)
|
||||
|
||||
|
||||
executables = [Executable("pype.py", base=base, targetName="pype")]
|
||||
executables = [
|
||||
Executable("start.py", base=None, targetName="pype_console"),
|
||||
Executable("start.py", base=base, targetName="pype")
|
||||
]
|
||||
|
||||
setup(
|
||||
name="pype",
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ def boot():
|
|||
m = re.search(r"--use-version=(?P<version>\d+\.\d+\.\d*.+?)", arg)
|
||||
if m and m.group('version'):
|
||||
use_version = m.group('version')
|
||||
sys.argv.remove(arg)
|
||||
break
|
||||
|
||||
if not os.getenv("PYPE_MONGO"):
|
||||
|
|
@ -224,6 +224,17 @@ def test_find_pype(fix_bootstrap, tmp_path_factory, monkeypatch, printer):
|
|||
test_pype(prefix="foo-v", version="3.2.0",
|
||||
suffix=".zip", type="zip", valid=True)
|
||||
]
|
||||
|
||||
test_versions_4 = [
|
||||
test_pype(prefix="foo-v", version="10.0.0",
|
||||
suffix="", type="dir", valid=True),
|
||||
test_pype(prefix="lom-v", version="11.2.6",
|
||||
suffix=".zip", type="dir", valid=False),
|
||||
test_pype(prefix="bom-v", version="7.2.7-client",
|
||||
suffix=".zip", type="zip", valid=True),
|
||||
test_pype(prefix="woo-v", version="7.2.8-client-strange",
|
||||
suffix=".zip", type="txt", valid=False)
|
||||
]
|
||||
|
||||
def _create_invalid_zip(path: Path):
|
||||
with ZipFile(path, "w") as zf:
|
||||
|
|
@ -286,6 +297,12 @@ def test_find_pype(fix_bootstrap, tmp_path_factory, monkeypatch, printer):
|
|||
for test_file in test_versions_3:
|
||||
_build_test_item(g_path, test_file)
|
||||
|
||||
# dir vs zip preference
|
||||
dir_path = tmp_path_factory.mktemp("dirZipPath")
|
||||
for test_file in test_versions_4:
|
||||
_build_test_item(dir_path, test_file)
|
||||
|
||||
printer("testing finding Pype in given path ...")
|
||||
result = fix_bootstrap.find_pype(g_path, True)
|
||||
# we should have results as file were created
|
||||
assert result is not None, "no Pype version found"
|
||||
|
|
@ -347,3 +364,13 @@ def test_find_pype(fix_bootstrap, tmp_path_factory, monkeypatch, printer):
|
|||
)
|
||||
)
|
||||
assert result[-1].path == expected_path, "not a latest version of Pype 1"
|
||||
|
||||
result = fix_bootstrap.find_pype(dir_path, True)
|
||||
assert result is not None, "no Pype versions found"
|
||||
expected_path = Path(
|
||||
e_path / "{}{}{}".format(
|
||||
test_versions_4[0].prefix,
|
||||
test_versions_4[0].version,
|
||||
test_versions_4[0].suffix
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue