mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #32 from pypeclub/openpype-infrastructure
OpenPype rename on igniter, tools and other infrastructure
This commit is contained in:
commit
4e54190ab8
34 changed files with 778 additions and 825 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -70,7 +70,7 @@ coverage.xml
|
|||
node_modules/
|
||||
package-lock.json
|
||||
|
||||
pype/premiere/ppro/js/debug.log
|
||||
openpype/premiere/ppro/js/debug.log
|
||||
|
||||
|
||||
# IDEA
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Bootstrap Pype repositories."""
|
||||
"""Bootstrap OpenPype repositories."""
|
||||
import functools
|
||||
import logging as log
|
||||
import os
|
||||
|
|
@ -14,8 +14,8 @@ from zipfile import ZipFile, BadZipFile
|
|||
from appdirs import user_data_dir
|
||||
from speedcopy import copyfile
|
||||
|
||||
from .user_settings import PypeSettingsRegistry
|
||||
from .tools import get_pype_path_from_db
|
||||
from .user_settings import OpenPypeSettingsRegistry
|
||||
from .tools import get_openpype_path_from_db
|
||||
|
||||
|
||||
LOG_INFO = 0
|
||||
|
|
@ -24,8 +24,8 @@ LOG_ERROR = 3
|
|||
|
||||
|
||||
@functools.total_ordering
|
||||
class PypeVersion:
|
||||
"""Class for storing information about Pype version.
|
||||
class OpenPypeVersion:
|
||||
"""Class for storing information about OpenPype version.
|
||||
|
||||
Attributes:
|
||||
major (int): [1].2.3-client-variant
|
||||
|
|
@ -33,7 +33,7 @@ class PypeVersion:
|
|||
subversion (int): 1.2.[3]-client-variant
|
||||
client (str): 1.2.3-[client]-variant
|
||||
variant (str): 1.2.3-client-[variant]
|
||||
path (str): path to Pype
|
||||
path (str): path to OpenPype
|
||||
|
||||
"""
|
||||
major = 0
|
||||
|
|
@ -191,37 +191,37 @@ class PypeVersion:
|
|||
|
||||
@staticmethod
|
||||
def version_in_str(string: str) -> Tuple:
|
||||
"""Find Pype version in given string.
|
||||
"""Find OpenPype version in given string.
|
||||
|
||||
Args:
|
||||
string (str): string to search.
|
||||
|
||||
Returns:
|
||||
tuple: True/False and PypeVersion if found.
|
||||
tuple: True/False and OpenPypeVersion if found.
|
||||
|
||||
"""
|
||||
try:
|
||||
result = PypeVersion._decompose_version(string)
|
||||
result = OpenPypeVersion._decompose_version(string)
|
||||
except ValueError:
|
||||
return False, None
|
||||
return True, PypeVersion(major=result[0],
|
||||
minor=result[1],
|
||||
subversion=result[2],
|
||||
variant=result[3],
|
||||
client=result[4])
|
||||
return True, OpenPypeVersion(major=result[0],
|
||||
minor=result[1],
|
||||
subversion=result[2],
|
||||
variant=result[3],
|
||||
client=result[4])
|
||||
|
||||
|
||||
class BootstrapRepos:
|
||||
"""Class for bootstrapping local Pype installation.
|
||||
"""Class for bootstrapping local OpenPype installation.
|
||||
|
||||
Attributes:
|
||||
data_dir (Path): local Pype installation directory.
|
||||
data_dir (Path): local OpenPype installation directory.
|
||||
live_repo_dir (Path): path to repos directory if running live,
|
||||
otherwise `None`.
|
||||
registry (PypeSettingsRegistry): Pype registry object.
|
||||
registry (OpenPypeSettingsRegistry): OpenPype registry object.
|
||||
zip_filter (list): List of files to exclude from zip
|
||||
pype_filter (list): list of top level directories not to include in
|
||||
zip in Pype repository.
|
||||
openpype_filter (list): list of top level directories not to
|
||||
include in zip in OpenPype repository.
|
||||
|
||||
"""
|
||||
|
||||
|
|
@ -236,13 +236,13 @@ class BootstrapRepos:
|
|||
"""
|
||||
# vendor and app used to construct user data dir
|
||||
self._vendor = "pypeclub"
|
||||
self._app = "pype"
|
||||
self._app = "openpype"
|
||||
self._log = log.getLogger(str(__class__))
|
||||
self.data_dir = Path(user_data_dir(self._app, self._vendor))
|
||||
self.registry = PypeSettingsRegistry()
|
||||
self.registry = OpenPypeSettingsRegistry()
|
||||
self.zip_filter = [".pyc", "__pycache__"]
|
||||
self.pype_filter = [
|
||||
"build", "docs", "tests", "repos", "tools", "venv"
|
||||
self.openpype_filter = [
|
||||
"build", "docs", "tests", "tools", "venv", "coverage"
|
||||
]
|
||||
self._message = message
|
||||
|
||||
|
|
@ -262,11 +262,11 @@ class BootstrapRepos:
|
|||
|
||||
@staticmethod
|
||||
def get_version_path_from_list(version: str, version_list: list) -> Path:
|
||||
"""Get path for specific version in list of Pype versions.
|
||||
"""Get path for specific version in list of OpenPype versions.
|
||||
|
||||
Args:
|
||||
version (str): Version string to look for (1.2.4-staging)
|
||||
version_list (list of PypeVersion): list of version to search.
|
||||
version_list (list of OpenPypeVersion): list of version to search.
|
||||
|
||||
Returns:
|
||||
Path: Path to given version.
|
||||
|
|
@ -278,31 +278,32 @@ class BootstrapRepos:
|
|||
|
||||
@staticmethod
|
||||
def get_local_live_version() -> str:
|
||||
"""Get version of local Pype."""
|
||||
"""Get version of local OpenPype."""
|
||||
|
||||
version = {}
|
||||
path = Path(os.path.dirname(__file__)).parent / "pype" / "version.py"
|
||||
path = Path(os.path.dirname(__file__)).parent / "openpype" / "version.py"
|
||||
with open(path, "r") as fp:
|
||||
exec(fp.read(), version)
|
||||
return version["__version__"]
|
||||
|
||||
@staticmethod
|
||||
def get_version(repo_dir: Path) -> Union[str, None]:
|
||||
"""Get version of Pype in given directory.
|
||||
"""Get version of OpenPype in given directory.
|
||||
|
||||
Note: in frozen Pype installed in user data dir, this must point
|
||||
one level deeper as it is `pype-version-v3.0.0/pype/pype/version.py`
|
||||
Note: in frozen OpenPype installed in user data dir, this must point
|
||||
one level deeper as it is:
|
||||
`openpype-version-v3.0.0/openpype/version.py`
|
||||
|
||||
Args:
|
||||
repo_dir (Path): Path to Pype repo.
|
||||
repo_dir (Path): Path to OpenPype repo.
|
||||
|
||||
Returns:
|
||||
str: version string.
|
||||
None: if Pype is not found.
|
||||
None: if OpenPype is not found.
|
||||
|
||||
"""
|
||||
# try to find version
|
||||
version_file = Path(repo_dir) / "pype" / "version.py"
|
||||
version_file = Path(repo_dir) / "openpype" / "version.py"
|
||||
if not version_file.exists():
|
||||
return None
|
||||
|
||||
|
|
@ -313,22 +314,22 @@ class BootstrapRepos:
|
|||
return version['__version__']
|
||||
|
||||
def create_version_from_live_code(
|
||||
self, repo_dir: Path = None) -> Union[PypeVersion, None]:
|
||||
"""Copy zip created from Pype repositories to user data dir.
|
||||
self, repo_dir: Path = None) -> Union[OpenPypeVersion, None]:
|
||||
"""Copy zip created from OpenPype repositories to user data dir.
|
||||
|
||||
This detect Pype version either in local "live" Pype repository
|
||||
or in user provided path. Then it will zip it in temporary directory
|
||||
and finally it will move it to destination which is user data
|
||||
directory. Existing files will be replaced.
|
||||
This detect OpenPype version either in local "live" OpenPype
|
||||
repository or in user provided path. Then it will zip it in temporary
|
||||
directory and finally it will move it to destination which is user
|
||||
data directory. Existing files will be replaced.
|
||||
|
||||
Args:
|
||||
repo_dir (Path, optional): Path to Pype repository.
|
||||
repo_dir (Path, optional): Path to OpenPype repository.
|
||||
|
||||
Returns:
|
||||
Path: path of installed repository file.
|
||||
|
||||
"""
|
||||
# if repo dir is not set, we detect local "live" Pype repository
|
||||
# if repo dir is not set, we detect local "live" OpenPype repository
|
||||
# version and use it as a source. Otherwise repo_dir is user
|
||||
# entered location.
|
||||
if not repo_dir:
|
||||
|
|
@ -338,7 +339,7 @@ class BootstrapRepos:
|
|||
version = self.get_version(repo_dir)
|
||||
|
||||
if not version:
|
||||
self._print("Pype not found.", LOG_ERROR)
|
||||
self._print("OpenPype not found.", LOG_ERROR)
|
||||
return
|
||||
|
||||
# create destination directory
|
||||
|
|
@ -348,20 +349,20 @@ class BootstrapRepos:
|
|||
# create zip inside temporary directory.
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
temp_zip = \
|
||||
Path(temp_dir) / f"pype-v{version}.zip"
|
||||
Path(temp_dir) / f"openpype-v{version}.zip"
|
||||
self._print(f"creating zip: {temp_zip}")
|
||||
|
||||
self._create_pype_zip(temp_zip, repo_dir)
|
||||
self._create_openpype_zip(temp_zip, repo_dir.parent)
|
||||
if not os.path.exists(temp_zip):
|
||||
self._print("make archive failed.", LOG_ERROR)
|
||||
return None
|
||||
|
||||
destination = self._move_zip_to_data_dir(temp_zip)
|
||||
|
||||
return PypeVersion(version=version, path=destination)
|
||||
return OpenPypeVersion(version=version, path=destination)
|
||||
|
||||
def _move_zip_to_data_dir(self, zip_file) -> Union[None, Path]:
|
||||
"""Move zip with Pype version to user data directory.
|
||||
"""Move zip with OpenPype version to user data directory.
|
||||
|
||||
Args:
|
||||
zip_file (Path): Path to zip file.
|
||||
|
|
@ -404,148 +405,110 @@ class BootstrapRepos:
|
|||
result.append(item)
|
||||
return result
|
||||
|
||||
def create_version_from_frozen_code(self) -> Union[None, PypeVersion]:
|
||||
"""Create Pype version from *frozen* code distributed by installer.
|
||||
def create_version_from_frozen_code(self) -> Union[None, OpenPypeVersion]:
|
||||
"""Create OpenPype version from *frozen* code distributed by installer.
|
||||
|
||||
This should be real edge case for those wanting to try out Pype
|
||||
This should be real edge case for those wanting to try out OpenPype
|
||||
without setting up whole infrastructure but is strongly discouraged
|
||||
in studio setup as this use local version independent of others
|
||||
that can be out of date.
|
||||
|
||||
Returns:
|
||||
:class:`PypeVersion` zip file to be installed.
|
||||
:class:`OpenPypeVersion` zip file to be installed.
|
||||
|
||||
"""
|
||||
frozen_root = Path(sys.executable).parent
|
||||
repo_dir = frozen_root / "repos"
|
||||
repo_list = self._filter_dir(
|
||||
repo_dir, self.zip_filter)
|
||||
|
||||
# from frozen code we need igniter, pype, schema vendor
|
||||
pype_list = self._filter_dir(
|
||||
frozen_root / "pype", self.zip_filter)
|
||||
pype_list += self._filter_dir(
|
||||
# from frozen code we need igniter, openpype, schema vendor
|
||||
openpype_list = self._filter_dir(
|
||||
frozen_root / "openpype", self.zip_filter)
|
||||
openpype_list += self._filter_dir(
|
||||
frozen_root / "igniter", self.zip_filter)
|
||||
pype_list += self._filter_dir(
|
||||
openpype_list += self._filter_dir(
|
||||
frozen_root / "repos", self.zip_filter)
|
||||
openpype_list += self._filter_dir(
|
||||
frozen_root / "schema", self.zip_filter)
|
||||
pype_list += self._filter_dir(
|
||||
openpype_list += self._filter_dir(
|
||||
frozen_root / "vendor", self.zip_filter)
|
||||
pype_list.append(frozen_root / "README.md")
|
||||
pype_list.append(frozen_root / "LICENSE")
|
||||
openpype_list.append(frozen_root / "LICENSE")
|
||||
|
||||
version = self.get_version(frozen_root)
|
||||
|
||||
# create zip inside temporary directory.
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
temp_zip = \
|
||||
Path(temp_dir) / f"pype-v{version}.zip"
|
||||
Path(temp_dir) / f"openpype-v{version}.zip"
|
||||
self._print(f"creating zip: {temp_zip}")
|
||||
|
||||
with ZipFile(temp_zip, "w") as zip_file:
|
||||
progress = 0
|
||||
repo_inc = 48.0 / float(len(repo_list))
|
||||
openpype_inc = 98.0 / float(len(openpype_list))
|
||||
file: Path
|
||||
for file in repo_list:
|
||||
progress += repo_inc
|
||||
self._progress_callback(int(progress))
|
||||
|
||||
# archive name is relative to repos dir
|
||||
arc_name = file.relative_to(repo_dir)
|
||||
zip_file.write(file, arc_name)
|
||||
|
||||
pype_inc = 48.0 / float(len(pype_list))
|
||||
file: Path
|
||||
for file in pype_list:
|
||||
progress += pype_inc
|
||||
for file in openpype_list:
|
||||
progress += openpype_inc
|
||||
self._progress_callback(int(progress))
|
||||
|
||||
arc_name = file.relative_to(frozen_root.parent)
|
||||
# we need to replace first part of path which starts with
|
||||
# something like `exe.win/linux....` with `pype` as this
|
||||
# is expected by Pype in zip archive.
|
||||
arc_name = Path("pype").joinpath(*arc_name.parts[1:])
|
||||
# something like `exe.win/linux....` with `openpype` as
|
||||
# this is expected by OpenPype in zip archive.
|
||||
arc_name = Path().joinpath(*arc_name.parts[1:])
|
||||
zip_file.write(file, arc_name)
|
||||
|
||||
destination = self._move_zip_to_data_dir(temp_zip)
|
||||
|
||||
return PypeVersion(version=version, path=destination)
|
||||
return OpenPypeVersion(version=version, path=destination)
|
||||
|
||||
def _create_pype_zip(
|
||||
self,
|
||||
zip_path: Path, include_dir: Path,
|
||||
include_pype: bool = True) -> None:
|
||||
"""Pack repositories and Pype into zip.
|
||||
def _create_openpype_zip(self, zip_path: Path, openpype_path: Path) -> None:
|
||||
"""Pack repositories and OpenPype into zip.
|
||||
|
||||
We are using :mod:`zipfile` instead :meth:`shutil.make_archive`
|
||||
because we need to decide what file and directories to include in zip
|
||||
and what not. They are determined by :attr:`zip_filter` on file level
|
||||
and :attr:`pype_filter` on top level directory in Pype repository.
|
||||
and :attr:`openpype_filter` on top level directory in OpenPype
|
||||
repository.
|
||||
|
||||
Args:
|
||||
zip_path (str): path to zip file.
|
||||
include_dir (Path): repo directories to include.
|
||||
include_pype (bool): add Pype module itself.
|
||||
zip_path (Path): Path to zip file.
|
||||
openpype_path (Path): Path to OpenPype sources.
|
||||
|
||||
"""
|
||||
include_dir = include_dir.resolve()
|
||||
openpype_list = []
|
||||
openpype_inc = 0
|
||||
|
||||
pype_list = []
|
||||
# get filtered list of files in repositories (repos directory)
|
||||
repo_list = self._filter_dir(include_dir, self.zip_filter)
|
||||
# count them
|
||||
repo_files = len(repo_list)
|
||||
# get filtered list of file in Pype repository
|
||||
openpype_list = self._filter_dir(openpype_path, self.zip_filter)
|
||||
openpype_files = len(openpype_list)
|
||||
|
||||
# there must be some files, otherwise `include_dir` path is wrong
|
||||
assert repo_files != 0, f"No repositories to include in {include_dir}"
|
||||
pype_inc = 0
|
||||
if include_pype:
|
||||
# get filtered list of file in Pype repository
|
||||
pype_list = self._filter_dir(include_dir.parent, self.zip_filter)
|
||||
pype_files = len(pype_list)
|
||||
repo_inc = 48.0 / float(repo_files)
|
||||
pype_inc = 48.0 / float(pype_files)
|
||||
else:
|
||||
repo_inc = 98.0 / float(repo_files)
|
||||
openpype_inc = 98.0 / float(openpype_files)
|
||||
|
||||
with ZipFile(zip_path, "w") as zip_file:
|
||||
progress = 0
|
||||
openpype_root = openpype_path.resolve()
|
||||
# generate list of filtered paths
|
||||
dir_filter = [openpype_root / f for f in self.openpype_filter]
|
||||
|
||||
file: Path
|
||||
for file in repo_list:
|
||||
progress += repo_inc
|
||||
for file in openpype_list:
|
||||
progress += openpype_inc
|
||||
self._progress_callback(int(progress))
|
||||
|
||||
# archive name is relative to repos dir
|
||||
arc_name = file.relative_to(include_dir)
|
||||
zip_file.write(file, arc_name)
|
||||
# if file resides in filtered path, skip it
|
||||
is_inside = None
|
||||
df: Path
|
||||
for df in dir_filter:
|
||||
try:
|
||||
is_inside = file.resolve().relative_to(df)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
# add pype itself
|
||||
if include_pype:
|
||||
pype_root = include_dir.parent.resolve()
|
||||
# generate list of filtered paths
|
||||
dir_filter = [pype_root / f for f in self.pype_filter]
|
||||
if is_inside:
|
||||
continue
|
||||
|
||||
file: Path
|
||||
for file in pype_list:
|
||||
progress += pype_inc
|
||||
self._progress_callback(int(progress))
|
||||
processed_path = file
|
||||
self._print(f"- processing {processed_path}")
|
||||
|
||||
# if file resides in filtered path, skip it
|
||||
is_inside = None
|
||||
df: Path
|
||||
for df in dir_filter:
|
||||
try:
|
||||
is_inside = file.resolve().relative_to(df)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if is_inside:
|
||||
continue
|
||||
|
||||
processed_path = file
|
||||
self._print(f"- processing {processed_path}")
|
||||
|
||||
zip_file.write(file,
|
||||
"pype" / file.relative_to(pype_root))
|
||||
zip_file.write(file, file.relative_to(openpype_root))
|
||||
|
||||
# test if zip is ok
|
||||
zip_file.testzip()
|
||||
|
|
@ -553,10 +516,10 @@ class BootstrapRepos:
|
|||
|
||||
@staticmethod
|
||||
def add_paths_from_archive(archive: Path) -> None:
|
||||
"""Add first-level directories as paths to :mod:`sys.path`.
|
||||
"""Add first-level directory and 'repos' as paths to :mod:`sys.path`.
|
||||
|
||||
This will enable Python to import modules is second-level directories
|
||||
in zip file.
|
||||
This will enable Python to import OpenPype and modules in `repos`
|
||||
submodule directory in zip file.
|
||||
|
||||
Adding to both `sys.path` and `PYTHONPATH`, skipping duplicates.
|
||||
|
||||
|
|
@ -574,21 +537,29 @@ class BootstrapRepos:
|
|||
name_list = zip_file.namelist()
|
||||
|
||||
roots = []
|
||||
paths = []
|
||||
for item in name_list:
|
||||
root = item.split("/")[0]
|
||||
if not item.startswith("repos/"):
|
||||
continue
|
||||
|
||||
root = item.split("/")[1]
|
||||
|
||||
if root not in roots:
|
||||
roots.append(root)
|
||||
sys.path.insert(0, f"{archive}{os.path.sep}{root}")
|
||||
paths.append(
|
||||
f"{archive}{os.path.sep}repos{os.path.sep}{root}")
|
||||
sys.path.insert(0, paths[-1])
|
||||
|
||||
sys.path.insert(0, f"{archive}")
|
||||
pythonpath = os.getenv("PYTHONPATH", "")
|
||||
paths = pythonpath.split(os.pathsep)
|
||||
paths += roots
|
||||
python_paths = pythonpath.split(os.pathsep)
|
||||
python_paths += paths
|
||||
|
||||
os.environ["PYTHONPATH"] = os.pathsep.join(paths)
|
||||
os.environ["PYTHONPATH"] = os.pathsep.join(python_paths)
|
||||
|
||||
@staticmethod
|
||||
def add_paths_from_directory(directory: Path) -> None:
|
||||
"""Add first level directories as paths to :mod:`sys.path`.
|
||||
"""Add repos first level directories as paths to :mod:`sys.path`.
|
||||
|
||||
This works the same as :meth:`add_paths_from_archive` but in
|
||||
specified directory.
|
||||
|
|
@ -599,6 +570,8 @@ class BootstrapRepos:
|
|||
directory (Path): path to directory.
|
||||
|
||||
"""
|
||||
sys.path.insert(0, directory.as_posix())
|
||||
directory = directory / "repos"
|
||||
if not directory.exists() and not directory.is_dir():
|
||||
raise ValueError("directory is invalid")
|
||||
|
||||
|
|
@ -616,49 +589,49 @@ class BootstrapRepos:
|
|||
|
||||
os.environ["PYTHONPATH"] = os.pathsep.join(paths)
|
||||
|
||||
def find_pype(
|
||||
def find_openpype(
|
||||
self,
|
||||
pype_path: Union[Path, str] = None,
|
||||
openpype_path: Union[Path, str] = None,
|
||||
staging: bool = False,
|
||||
include_zips: bool = False) -> Union[List[PypeVersion], None]:
|
||||
"""Get ordered dict of detected Pype version.
|
||||
include_zips: bool = False) -> Union[List[OpenPypeVersion], None]:
|
||||
"""Get ordered dict of detected OpenPype version.
|
||||
|
||||
Resolution order for Pype is following:
|
||||
Resolution order for OpenPype is following:
|
||||
|
||||
1) First we test for ``OPENPYPE_PATH`` environment variable
|
||||
2) We try to find ``pypePath`` in registry setting
|
||||
2) We try to find ``openPypePath`` in registry setting
|
||||
3) We use user data directory
|
||||
|
||||
Args:
|
||||
pype_path (Path or str, optional): Try to find Pype on the given
|
||||
path or url.
|
||||
openpype_path (Path or str, optional): Try to find OpenPype on
|
||||
the given path or url.
|
||||
staging (bool, optional): Filter only staging version, skip them
|
||||
otherwise.
|
||||
include_zips (bool, optional): If set True it will try to find
|
||||
Pype in zip files in given directory.
|
||||
OpenPype in zip files in given directory.
|
||||
|
||||
Returns:
|
||||
dict of Path: Dictionary of detected Pype version.
|
||||
dict of Path: Dictionary of detected OpenPype version.
|
||||
Key is version, value is path to zip file.
|
||||
|
||||
None: if Pype is not found.
|
||||
None: if OpenPype is not found.
|
||||
|
||||
Todo:
|
||||
implement git/url support as Pype location, so it would be
|
||||
possible to enter git url, Pype would check it out and if it is
|
||||
implement git/url support as OpenPype location, so it would be
|
||||
possible to enter git url, OpenPype would check it out and if it is
|
||||
ok install it as normal version.
|
||||
|
||||
"""
|
||||
if pype_path and not isinstance(pype_path, Path):
|
||||
if openpype_path and not isinstance(openpype_path, Path):
|
||||
raise NotImplementedError(
|
||||
("Finding Pype in non-filesystem locations is"
|
||||
("Finding OpenPype in non-filesystem locations is"
|
||||
" not implemented yet."))
|
||||
|
||||
dir_to_search = self.data_dir
|
||||
|
||||
# if we have pype_path specified, search only there.
|
||||
if pype_path:
|
||||
dir_to_search = pype_path
|
||||
# if we have openpype_path specified, search only there.
|
||||
if openpype_path:
|
||||
dir_to_search = openpype_path
|
||||
else:
|
||||
if os.getenv("OPENPYPE_PATH"):
|
||||
if Path(os.getenv("OPENPYPE_PATH")).exists():
|
||||
|
|
@ -666,7 +639,7 @@ class BootstrapRepos:
|
|||
else:
|
||||
try:
|
||||
registry_dir = Path(
|
||||
str(self.registry.get_item("pypePath")))
|
||||
str(self.registry.get_item("openPypePath")))
|
||||
if registry_dir.exists():
|
||||
dir_to_search = registry_dir
|
||||
|
||||
|
|
@ -674,22 +647,22 @@ class BootstrapRepos:
|
|||
# nothing found in registry, we'll use data dir
|
||||
pass
|
||||
|
||||
pype_versions = self.get_pype_versions(dir_to_search, staging)
|
||||
openpype_versions = self.get_openpype_versions(dir_to_search, staging)
|
||||
|
||||
# remove zip file version if needed.
|
||||
if not include_zips:
|
||||
pype_versions = [
|
||||
v for v in pype_versions if v.path.suffix != ".zip"
|
||||
openpype_versions = [
|
||||
v for v in openpype_versions if v.path.suffix != ".zip"
|
||||
]
|
||||
|
||||
return pype_versions
|
||||
return openpype_versions
|
||||
|
||||
def process_entered_location(self, location: str) -> Union[Path, None]:
|
||||
"""Process user entered location string.
|
||||
|
||||
It decides if location string is mongodb url or path.
|
||||
If it is mongodb url, it will connect and load ``OPENPYPE_PATH`` from
|
||||
there and use it as path to Pype. In it is _not_ mongodb url, it
|
||||
there and use it as path to OpenPype. In it is _not_ mongodb url, it
|
||||
is assumed we have a path, this is tested and zip file is
|
||||
produced and installed using :meth:`create_version_from_live_code`.
|
||||
|
||||
|
|
@ -697,51 +670,52 @@ class BootstrapRepos:
|
|||
location (str): User entered location.
|
||||
|
||||
Returns:
|
||||
Path: to Pype zip produced from this location.
|
||||
Path: to OpenPype zip produced from this location.
|
||||
None: Zipping failed.
|
||||
|
||||
"""
|
||||
pype_path = None
|
||||
# try to get pype path from mongo.
|
||||
openpype_path = None
|
||||
# try to get OpenPype path from mongo.
|
||||
if location.startswith("mongodb"):
|
||||
pype_path = get_pype_path_from_db(location)
|
||||
if not pype_path:
|
||||
pype_path = get_openpype_path_from_db(location)
|
||||
if not openpype_path:
|
||||
self._print("cannot find OPENPYPE_PATH in settings.")
|
||||
return None
|
||||
|
||||
# if not successful, consider location to be fs path.
|
||||
if not pype_path:
|
||||
pype_path = Path(location)
|
||||
if not openpype_path:
|
||||
openpype_path = Path(location)
|
||||
|
||||
# test if this path does exist.
|
||||
if not pype_path.exists():
|
||||
self._print(f"{pype_path} doesn't exists.")
|
||||
if not openpype_path.exists():
|
||||
self._print(f"{openpype_path} doesn't exists.")
|
||||
return None
|
||||
|
||||
# test if entered path isn't user data dir
|
||||
if self.data_dir == pype_path:
|
||||
if self.data_dir == openpype_path:
|
||||
self._print("cannot point to user data dir", LOG_ERROR)
|
||||
return None
|
||||
|
||||
# find pype zip files in location. There can be
|
||||
# either "live" Pype repository, or multiple zip files or even
|
||||
# multiple pype version directories. This process looks into zip
|
||||
# find openpype zip files in location. There can be
|
||||
# either "live" OpenPype repository, or multiple zip files or even
|
||||
# multiple OpenPype version directories. This process looks into zip
|
||||
# files and directories and tries to parse `version.py` file.
|
||||
versions = self.find_pype(pype_path, include_zips=True)
|
||||
versions = self.find_openpype(openpype_path, include_zips=True)
|
||||
if versions:
|
||||
self._print(f"found Pype in [ {pype_path} ]")
|
||||
self._print(f"found OpenPype in [ {openpype_path} ]")
|
||||
self._print(f"latest version found is [ {versions[-1]} ]")
|
||||
|
||||
return self.install_version(versions[-1])
|
||||
|
||||
# if we got here, it means that location is "live" Pype repository.
|
||||
# we'll create zip from it and move it to user data dir.
|
||||
live_pype = self.create_version_from_live_code(pype_path)
|
||||
if not live_pype.path.exists():
|
||||
self._print(f"installing zip {live_pype} failed.", LOG_ERROR)
|
||||
# if we got here, it means that location is "live"
|
||||
# OpenPype repository. We'll create zip from it and move it to user
|
||||
# data dir.
|
||||
live_openpype = self.create_version_from_live_code(openpype_path)
|
||||
if not live_openpype.path.exists():
|
||||
self._print(f"installing zip {live_openpype} failed.", LOG_ERROR)
|
||||
return None
|
||||
# install it
|
||||
return self.install_version(live_pype)
|
||||
return self.install_version(live_openpype)
|
||||
|
||||
def _print(self,
|
||||
message: str,
|
||||
|
|
@ -769,11 +743,11 @@ class BootstrapRepos:
|
|||
return
|
||||
self._log.info(message, exc_info=exc_info)
|
||||
|
||||
def extract_pype(self, version: PypeVersion) -> Union[Path, None]:
|
||||
"""Extract zipped Pype version to user data directory.
|
||||
def extract_openpype(self, version: OpenPypeVersion) -> Union[Path, None]:
|
||||
"""Extract zipped OpenPype version to user data directory.
|
||||
|
||||
Args:
|
||||
version (PypeVersion): Version of Pype.
|
||||
version (OpenPypeVersion): Version of OpenPype.
|
||||
|
||||
Returns:
|
||||
Path: path to extracted version.
|
||||
|
|
@ -819,40 +793,41 @@ class BootstrapRepos:
|
|||
is_inside = path.resolve().relative_to(
|
||||
self.data_dir)
|
||||
except ValueError:
|
||||
# if relative path cannot be calculated, Pype version is not
|
||||
# if relative path cannot be calculated, OpenPype version is not
|
||||
# inside user data dir
|
||||
pass
|
||||
return is_inside
|
||||
|
||||
def install_version(self,
|
||||
pype_version: PypeVersion,
|
||||
openpype_version: OpenPypeVersion,
|
||||
force: bool = False) -> Path:
|
||||
"""Install Pype version to user data directory.
|
||||
"""Install OpenPype version to user data directory.
|
||||
|
||||
Args:
|
||||
pype_version (PypeVersion): Pype version to install.
|
||||
oepnpype_version (OpenPypeVersion): OpenPype version to install.
|
||||
force (bool, optional): Force overwrite existing version.
|
||||
|
||||
Returns:
|
||||
Path: Path to installed Pype.
|
||||
Path: Path to installed OpenPype.
|
||||
|
||||
Raises:
|
||||
PypeVersionExists: If not forced and this version already exist
|
||||
OpenPypeVersionExists: If not forced and this version already exist
|
||||
in user data directory.
|
||||
PypeVersionInvalid: If version to install is invalid.
|
||||
PypeVersionIOError: If copying or zipping fail.
|
||||
OpenPypeVersionInvalid: If version to install is invalid.
|
||||
OpenPypeVersionIOError: If copying or zipping fail.
|
||||
|
||||
"""
|
||||
|
||||
if self.is_inside_user_data(pype_version.path) and not pype_version.path.is_file(): # noqa
|
||||
raise PypeVersionExists("Pype already inside user data dir")
|
||||
if self.is_inside_user_data(openpype_version.path) and not pype_version.path.is_file(): # noqa
|
||||
raise OpenPypeVersionExists(
|
||||
"OpenPype already inside user data dir")
|
||||
|
||||
# determine destination directory name
|
||||
# for zip file strip suffix, in case of dir use whole dir name
|
||||
if pype_version.path.is_dir():
|
||||
dir_name = pype_version.path.name
|
||||
if openpype_version.path.is_dir():
|
||||
dir_name = openpype_version.path.name
|
||||
else:
|
||||
dir_name = pype_version.path.stem
|
||||
dir_name = openpype_version.path.stem
|
||||
|
||||
destination = self.data_dir / dir_name
|
||||
|
||||
|
|
@ -864,82 +839,82 @@ class BootstrapRepos:
|
|||
self._print(
|
||||
f"cannot remove already existing {destination}",
|
||||
LOG_ERROR, exc_info=True)
|
||||
raise PypeVersionIOError(
|
||||
raise OpenPypeVersionIOError(
|
||||
f"cannot remove existing {destination}") from e
|
||||
elif destination.exists() and not force:
|
||||
raise PypeVersionExists(f"{destination} already exist.")
|
||||
raise OpenPypeVersionExists(f"{destination} already exist.")
|
||||
else:
|
||||
# create destination parent directories even if they don't exist.
|
||||
destination.mkdir(parents=True)
|
||||
|
||||
# version is directory
|
||||
if pype_version.path.is_dir():
|
||||
if openpype_version.path.is_dir():
|
||||
# create zip inside temporary directory.
|
||||
self._print("Creating zip from directory ...")
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
temp_zip = \
|
||||
Path(temp_dir) / f"pype-v{pype_version}.zip"
|
||||
Path(temp_dir) / f"openpype-v{openpype_version}.zip"
|
||||
self._print(f"creating zip: {temp_zip}")
|
||||
|
||||
self._create_pype_zip(temp_zip, pype_version.path)
|
||||
self._create_openpype_zip(temp_zip, openpype_version.path)
|
||||
if not os.path.exists(temp_zip):
|
||||
self._print("make archive failed.", LOG_ERROR)
|
||||
raise PypeVersionIOError("Zip creation failed.")
|
||||
raise OpenPypeVersionIOError("Zip creation failed.")
|
||||
|
||||
# set zip as version source
|
||||
pype_version.path = temp_zip
|
||||
openpype_version.path = temp_zip
|
||||
|
||||
elif pype_version.path.is_file():
|
||||
elif openpype_version.path.is_file():
|
||||
# check if file is zip (by extension)
|
||||
if pype_version.path.suffix.lower() != ".zip":
|
||||
raise PypeVersionInvalid("Invalid file format")
|
||||
if openpype_version.path.suffix.lower() != ".zip":
|
||||
raise OpenPypeVersionInvalid("Invalid file format")
|
||||
|
||||
if not self.is_inside_user_data(pype_version.path):
|
||||
if not self.is_inside_user_data(openpype_version.path):
|
||||
try:
|
||||
# copy file to destination
|
||||
self._print("Copying zip to destination ...")
|
||||
_destination_zip = destination.parent / pype_version.path.name
|
||||
_destination_zip = destination.parent / openpype_version.path.name # noqa: E501
|
||||
copyfile(
|
||||
pype_version.path.as_posix(),
|
||||
openpype_version.path.as_posix(),
|
||||
_destination_zip.as_posix())
|
||||
except OSError as e:
|
||||
self._print(
|
||||
"cannot copy version to user data directory", LOG_ERROR,
|
||||
exc_info=True)
|
||||
raise PypeVersionIOError((
|
||||
f"can't copy version {pype_version.path.as_posix()} "
|
||||
raise OpenPypeVersionIOError((
|
||||
f"can't copy version {openpype_version.path.as_posix()} "
|
||||
f"to destination {destination.parent.as_posix()}")) from e
|
||||
|
||||
# extract zip there
|
||||
self._print("extracting zip to destination ...")
|
||||
with ZipFile(pype_version.path, "r") as zip_ref:
|
||||
with ZipFile(openpype_version.path, "r") as zip_ref:
|
||||
zip_ref.extractall(destination)
|
||||
|
||||
return destination
|
||||
|
||||
def _is_pype_in_dir(self,
|
||||
dir_item: Path,
|
||||
detected_version: PypeVersion) -> bool:
|
||||
"""Test if path item is Pype version matching detected version.
|
||||
def _is_openpype_in_dir(self,
|
||||
dir_item: Path,
|
||||
detected_version: OpenPypeVersion) -> bool:
|
||||
"""Test if path item is OpenPype version matching detected version.
|
||||
|
||||
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.
|
||||
contain OpenPype version, check if it really does contain
|
||||
OpenPype and that their versions matches.
|
||||
|
||||
Args:
|
||||
dir_item (Path): Directory to test.
|
||||
detected_version (PypeVersion): Pype version detected from name.
|
||||
detected_version (OpenPypeVersion): OpenPype version detected
|
||||
from name.
|
||||
|
||||
Returns:
|
||||
True if it is valid Pype version, False otherwise.
|
||||
True if it is valid OpenPype version, False otherwise.
|
||||
|
||||
"""
|
||||
try:
|
||||
# add one 'pype' level as inside dir there should
|
||||
# add one 'openpype' level as inside dir there should
|
||||
# be many other repositories.
|
||||
version_str = BootstrapRepos.get_version(
|
||||
dir_item / "pype")
|
||||
version_check = PypeVersion(version=version_str)
|
||||
version_str = BootstrapRepos.get_version(dir_item)
|
||||
version_check = OpenPypeVersion(version=version_str)
|
||||
except ValueError:
|
||||
self._print(
|
||||
f"cannot determine version from {dir_item}", True)
|
||||
|
|
@ -955,21 +930,21 @@ class BootstrapRepos:
|
|||
return False
|
||||
return True
|
||||
|
||||
def _is_pype_in_zip(self,
|
||||
zip_item: Path,
|
||||
detected_version: PypeVersion) -> bool:
|
||||
"""Test if zip path is Pype version matching detected version.
|
||||
def _is_openpype_in_zip(self,
|
||||
zip_item: Path,
|
||||
detected_version: OpenPypeVersion) -> bool:
|
||||
"""Test if zip path is OpenPype version matching detected version.
|
||||
|
||||
Open zip file, look inside and parse version from Pype
|
||||
Open zip file, look inside and parse version from OpenPype
|
||||
inside it. If there is none, or it is different from
|
||||
version specified in file name, skip it.
|
||||
|
||||
Args:
|
||||
zip_item (Path): Zip file to test.
|
||||
detected_version (PypeVersion): Pype version detected from name.
|
||||
detected_version (OpenPypeVersion): Pype version detected from name.
|
||||
|
||||
Returns:
|
||||
True if it is valid Pype version, False otherwise.
|
||||
True if it is valid OpenPype version, False otherwise.
|
||||
|
||||
"""
|
||||
# skip non-zip files
|
||||
|
|
@ -979,10 +954,10 @@ class BootstrapRepos:
|
|||
try:
|
||||
with ZipFile(zip_item, "r") as zip_file:
|
||||
with zip_file.open(
|
||||
"pype/pype/version.py") as version_file:
|
||||
"openpype/version.py") as version_file:
|
||||
zip_version = {}
|
||||
exec(version_file.read(), zip_version)
|
||||
version_check = PypeVersion(
|
||||
version_check = OpenPypeVersion(
|
||||
version=zip_version["__version__"])
|
||||
|
||||
version_main = version_check.get_main_version() # noqa: E501
|
||||
|
|
@ -999,70 +974,72 @@ class BootstrapRepos:
|
|||
self._print(f"{zip_item} is not a zip file", True)
|
||||
return False
|
||||
except KeyError:
|
||||
self._print("Zip does not contain Pype", True)
|
||||
self._print("Zip does not contain OpenPype", True)
|
||||
return False
|
||||
return True
|
||||
|
||||
def get_pype_versions(self, pype_dir: Path, staging: bool = False) -> list:
|
||||
"""Get all detected Pype versions in directory.
|
||||
def get_openpype_versions(self,
|
||||
openpype_dir: Path,
|
||||
staging: bool = False) -> list:
|
||||
"""Get all detected OpenPype versions in directory.
|
||||
|
||||
Args:
|
||||
pype_dir (Path): Directory to scan.
|
||||
openpype_dir (Path): Directory to scan.
|
||||
staging (bool, optional): Find staging versions if True.
|
||||
|
||||
Returns:
|
||||
list of PypeVersion
|
||||
list of OpenPypeVersion
|
||||
|
||||
Throws:
|
||||
ValueError: if invalid path is specified.
|
||||
|
||||
"""
|
||||
if not pype_dir.exists() and not pype_dir.is_dir():
|
||||
if not openpype_dir.exists() and not openpype_dir.is_dir():
|
||||
raise ValueError("specified directory is invalid")
|
||||
|
||||
_pype_versions = []
|
||||
_openpype_versions = []
|
||||
# iterate over directory in first level and find all that might
|
||||
# contain Pype.
|
||||
for item in pype_dir.iterdir():
|
||||
# contain OpenPype.
|
||||
for item in openpype_dir.iterdir():
|
||||
|
||||
# if file, strip extension, in case of dir not.
|
||||
name = item.name if item.is_dir() else item.stem
|
||||
result = PypeVersion.version_in_str(name)
|
||||
result = OpenPypeVersion.version_in_str(name)
|
||||
|
||||
if result[0]:
|
||||
detected_version: PypeVersion
|
||||
detected_version: OpenPypeVersion
|
||||
detected_version = result[1]
|
||||
|
||||
if item.is_dir() and not self._is_pype_in_dir(
|
||||
if item.is_dir() and not self._is_openpype_in_dir(
|
||||
item, detected_version
|
||||
):
|
||||
continue
|
||||
|
||||
if item.is_file() and not self._is_pype_in_zip(
|
||||
if item.is_file() and not self._is_openpype_in_zip(
|
||||
item, detected_version
|
||||
):
|
||||
continue
|
||||
|
||||
detected_version.path = item
|
||||
if staging and detected_version.is_staging():
|
||||
_pype_versions.append(detected_version)
|
||||
_openpype_versions.append(detected_version)
|
||||
|
||||
if not staging and not detected_version.is_staging():
|
||||
_pype_versions.append(detected_version)
|
||||
_openpype_versions.append(detected_version)
|
||||
|
||||
return sorted(_pype_versions)
|
||||
return sorted(_openpype_versions)
|
||||
|
||||
|
||||
class PypeVersionExists(Exception):
|
||||
"""Exception for handling existing Pype version."""
|
||||
class OpenPypeVersionExists(Exception):
|
||||
"""Exception for handling existing OpenPype version."""
|
||||
pass
|
||||
|
||||
|
||||
class PypeVersionInvalid(Exception):
|
||||
"""Exception for handling invalid Pype version."""
|
||||
class OpenPypeVersionInvalid(Exception):
|
||||
"""Exception for handling invalid OpenPype version."""
|
||||
pass
|
||||
|
||||
|
||||
class PypeVersionIOError(Exception):
|
||||
"""Exception for handling IO errors in Pype version."""
|
||||
class OpenPypeVersionIOError(Exception):
|
||||
"""Exception for handling IO errors in OpenPype version."""
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ from .install_thread import InstallThread, InstallResult
|
|||
from .tools import (
|
||||
validate_path_string,
|
||||
validate_mongo_connection,
|
||||
get_pype_path_from_db
|
||||
get_openpype_path_from_db
|
||||
)
|
||||
from .user_settings import PypeSettingsRegistry
|
||||
from .user_settings import OpenPypeSettingsRegistry
|
||||
from .version import __version__
|
||||
|
||||
|
||||
|
|
@ -42,18 +42,19 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
|
||||
def __init__(self, parent=None):
|
||||
super(InstallDialog, self).__init__(parent)
|
||||
self.registry = PypeSettingsRegistry()
|
||||
self.registry = OpenPypeSettingsRegistry()
|
||||
|
||||
self.mongo_url = ""
|
||||
try:
|
||||
self.mongo_url = (
|
||||
os.getenv("OPENPYPE_MONGO", "")
|
||||
or self.registry.get_secure_item("pypeMongo")
|
||||
or self.registry.get_secure_item("openPypeMongo")
|
||||
)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
self.setWindowTitle(f"Pype Igniter {__version__} - Pype installation")
|
||||
self.setWindowTitle(
|
||||
f"OpenPype Igniter {__version__} - OpenPype installation")
|
||||
self._icon_path = os.path.join(
|
||||
os.path.dirname(__file__), 'openpype_icon.png')
|
||||
icon = QtGui.QIcon(self._icon_path)
|
||||
|
|
@ -84,7 +85,7 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
os.path.join(
|
||||
os.path.dirname(__file__), 'RobotoMono-Regular.ttf')
|
||||
)
|
||||
self._pype_run_ready = False
|
||||
self._openpype_run_ready = False
|
||||
|
||||
self._init_ui()
|
||||
|
||||
|
|
@ -100,35 +101,35 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
# Main info
|
||||
# --------------------------------------------------------------------
|
||||
self.main_label = QtWidgets.QLabel(
|
||||
"""Welcome to <b>Pype</b>
|
||||
"""Welcome to <b>OpenPype</b>
|
||||
<p>
|
||||
We've detected <b>Pype</b> is not configured yet. But don't worry,
|
||||
We've detected <b>OpenPype</b> is not configured yet. But don't worry,
|
||||
this is as easy as setting one or two things.
|
||||
<p>
|
||||
""")
|
||||
self.main_label.setWordWrap(True)
|
||||
self.main_label.setStyleSheet("color: rgb(200, 200, 200);")
|
||||
|
||||
# Pype path info
|
||||
# OpenPype path info
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
self.pype_path_label = QtWidgets.QLabel(
|
||||
"""This is <b>Path to studio location</b> where Pype versions
|
||||
self.openpype_path_label = QtWidgets.QLabel(
|
||||
"""This is <b>Path to studio location</b> where OpenPype versions
|
||||
are stored. It will be pre-filled if your MongoDB connection is
|
||||
already set and your studio defined this location.
|
||||
<p>
|
||||
Leave it empty if you want to install Pype version that comes with
|
||||
this installation.
|
||||
Leave it empty if you want to install OpenPype version that
|
||||
comes with this installation.
|
||||
</p>
|
||||
<p>
|
||||
If you want to just try Pype without installing, hit the middle
|
||||
button that states "run without installation".
|
||||
If you want to just try OpenPype without installing, hit the
|
||||
middle button that states "run without installation".
|
||||
</p>
|
||||
"""
|
||||
)
|
||||
|
||||
self.pype_path_label.setWordWrap(True)
|
||||
self.pype_path_label.setStyleSheet("color: rgb(150, 150, 150);")
|
||||
self.openpype_path_label.setWordWrap(True)
|
||||
self.openpype_path_label.setStyleSheet("color: rgb(150, 150, 150);")
|
||||
|
||||
# Path/Url box | Select button
|
||||
# --------------------------------------------------------------------
|
||||
|
|
@ -138,7 +139,7 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
input_layout.setContentsMargins(0, 10, 0, 10)
|
||||
self.user_input = FocusHandlingLineEdit()
|
||||
|
||||
self.user_input.setPlaceholderText("Path to Pype versions")
|
||||
self.user_input.setPlaceholderText("Path to OpenPype versions")
|
||||
self.user_input.textChanged.connect(self._path_changed)
|
||||
self.user_input.setStyleSheet(
|
||||
("color: rgb(233, 233, 233);"
|
||||
|
|
@ -151,7 +152,7 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
|
||||
self._btn_select = QtWidgets.QPushButton("Select")
|
||||
self._btn_select.setToolTip(
|
||||
"Select Pype repository"
|
||||
"Select OpenPype repository"
|
||||
)
|
||||
self._btn_select.setStyleSheet(
|
||||
("color: rgb(64, 64, 64);"
|
||||
|
|
@ -285,13 +286,13 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
# --------------------------------------------------------------------
|
||||
bottom_widget = QtWidgets.QWidget()
|
||||
bottom_layout = QtWidgets.QHBoxLayout()
|
||||
pype_logo_label = QtWidgets.QLabel("pype logo")
|
||||
pype_logo = QtGui.QPixmap(self._icon_path)
|
||||
# pype_logo.scaled(
|
||||
# pype_logo_label.width(),
|
||||
# pype_logo_label.height(), QtCore.Qt.KeepAspectRatio)
|
||||
pype_logo_label.setPixmap(pype_logo)
|
||||
pype_logo_label.setContentsMargins(10, 0, 0, 10)
|
||||
openpype_logo_label = QtWidgets.QLabel("openpype logo")
|
||||
openpype_logo = QtGui.QPixmap(self._icon_path)
|
||||
# openpype_logo.scaled(
|
||||
# openpype_logo_label.width(),
|
||||
# openpype_logo_label.height(), QtCore.Qt.KeepAspectRatio)
|
||||
openpype_logo_label.setPixmap(openpype_logo)
|
||||
openpype_logo_label.setContentsMargins(10, 0, 0, 10)
|
||||
|
||||
# install button - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
self.install_button = QtWidgets.QPushButton("Install")
|
||||
|
|
@ -301,7 +302,7 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
"padding: 0.5em;")
|
||||
)
|
||||
self.install_button.setMinimumSize(64, 24)
|
||||
self.install_button.setToolTip("Install Pype")
|
||||
self.install_button.setToolTip("Install OpenPype")
|
||||
self.install_button.clicked.connect(self._on_ok_clicked)
|
||||
|
||||
# run from current button - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
@ -328,7 +329,7 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
|
||||
bottom_layout.setContentsMargins(0, 10, 10, 0)
|
||||
bottom_layout.setAlignment(QtCore.Qt.AlignVCenter)
|
||||
bottom_layout.addWidget(pype_logo_label, 0, QtCore.Qt.AlignVCenter)
|
||||
bottom_layout.addWidget(openpype_logo_label, 0, QtCore.Qt.AlignVCenter)
|
||||
bottom_layout.addStretch(1)
|
||||
bottom_layout.addWidget(self.install_button, 0, QtCore.Qt.AlignVCenter)
|
||||
bottom_layout.addWidget(self.run_button, 0, QtCore.Qt.AlignVCenter)
|
||||
|
|
@ -408,7 +409,7 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
)
|
||||
# add all to main
|
||||
main.addWidget(self.main_label, 0)
|
||||
main.addWidget(self.pype_path_label, 0)
|
||||
main.addWidget(self.openpype_path_label, 0)
|
||||
main.addLayout(input_layout, 0)
|
||||
main.addWidget(self.mongo_label, 0)
|
||||
main.addWidget(self._mongo, 0)
|
||||
|
|
@ -421,9 +422,9 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
|
||||
self.setLayout(main)
|
||||
|
||||
# if mongo url is ok, try to get pype path from there
|
||||
# if mongo url is ok, try to get openpype path from there
|
||||
if self._mongo.validate_url() and len(self.path) == 0:
|
||||
self.path = get_pype_path_from_db(self.mongo_url)
|
||||
self.path = get_openpype_path_from_db(self.mongo_url)
|
||||
self.user_input.setText(self.path)
|
||||
|
||||
def _on_select_clicked(self):
|
||||
|
|
@ -476,7 +477,7 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
else:
|
||||
self._mongo.set_valid()
|
||||
|
||||
if self._pype_run_ready:
|
||||
if self._openpype_run_ready:
|
||||
self.done(3)
|
||||
return
|
||||
|
||||
|
|
@ -501,8 +502,8 @@ class InstallDialog(QtWidgets.QDialog):
|
|||
"""Change button behaviour based on installation outcome."""
|
||||
status = result.status
|
||||
if status >= 0:
|
||||
self.install_button.setText("Run installed Pype")
|
||||
self._pype_run_ready = True
|
||||
self.install_button.setText("Run installed OpenPype")
|
||||
self._openpype_run_ready = True
|
||||
|
||||
def _update_progress(self, progress: int):
|
||||
self._progress_bar.setValue(progress)
|
||||
|
|
@ -639,7 +640,7 @@ class PathValidator(MongoValidator):
|
|||
"""Validate path to be accepted by Igniter.
|
||||
|
||||
Args:
|
||||
path (str): path to Pype.
|
||||
path (str): path to OpenPype.
|
||||
pos (int): current position.
|
||||
|
||||
Returns:
|
||||
|
|
@ -649,7 +650,7 @@ class PathValidator(MongoValidator):
|
|||
|
||||
"""
|
||||
# allow empty path as that will use current version coming with
|
||||
# Pype Igniter
|
||||
# OpenPype Igniter
|
||||
if len(path) == 0:
|
||||
return self._return_state(
|
||||
QValidator.State.Acceptable, "Use version with Igniter", path)
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ from Qt.QtCore import QThread, Signal, QObject # noqa
|
|||
|
||||
from .bootstrap_repos import (
|
||||
BootstrapRepos,
|
||||
PypeVersionInvalid,
|
||||
PypeVersionIOError,
|
||||
PypeVersionExists,
|
||||
PypeVersion
|
||||
OpenPypeVersionInvalid,
|
||||
OpenPypeVersionIOError,
|
||||
OpenPypeVersionExists,
|
||||
OpenPypeVersion
|
||||
)
|
||||
|
||||
from .tools import validate_mongo_connection
|
||||
|
|
@ -26,9 +26,9 @@ class InstallResult(QObject):
|
|||
class InstallThread(QThread):
|
||||
"""Install Worker thread.
|
||||
|
||||
This class takes care of finding Pype version on user entered path
|
||||
This class takes care of finding OpenPype version on user entered path
|
||||
(or loading this path from database). If nothing is entered by user,
|
||||
Pype will create its zip files from repositories that comes with it.
|
||||
OpenPype will create its zip files from repositories that comes with it.
|
||||
|
||||
If path contains plain repositories, they are zipped and installed to
|
||||
user data dir.
|
||||
|
|
@ -49,19 +49,19 @@ class InstallThread(QThread):
|
|||
def run(self):
|
||||
"""Thread entry point.
|
||||
|
||||
Using :class:`BootstrapRepos` to either install Pype as zip files
|
||||
Using :class:`BootstrapRepos` to either install OpenPype as zip files
|
||||
or copy them from location specified by user or retrieved from
|
||||
database.
|
||||
|
||||
"""
|
||||
self.message.emit("Installing Pype ...", False)
|
||||
self.message.emit("Installing OpenPype ...", False)
|
||||
|
||||
# find local version of Pype
|
||||
# find local version of OpenPype
|
||||
bs = BootstrapRepos(
|
||||
progress_callback=self.set_progress, message=self.message)
|
||||
local_version = bs.get_local_live_version()
|
||||
|
||||
# if user did entered nothing, we install Pype from local version.
|
||||
# if user did entered nothing, we install OpenPype from local version.
|
||||
# zip content of `repos`, copy it to user data dir and append
|
||||
# version to it.
|
||||
if not self._path:
|
||||
|
|
@ -71,7 +71,8 @@ class InstallThread(QThread):
|
|||
if not os.getenv("OPENPYPE_MONGO"):
|
||||
# try to get it from settings registry
|
||||
try:
|
||||
self._mongo = bs.registry.get_secure_item("pypeMongo")
|
||||
self._mongo = bs.registry.get_secure_item(
|
||||
"openPypeMongo")
|
||||
except ValueError:
|
||||
self.message.emit(
|
||||
"!!! We need MongoDB URL to proceed.", True)
|
||||
|
|
@ -81,33 +82,34 @@ class InstallThread(QThread):
|
|||
self._mongo = os.getenv("OPENPYPE_MONGO")
|
||||
else:
|
||||
self.message.emit("Saving mongo connection string ...", False)
|
||||
bs.registry.set_secure_item("pypeMongo", self._mongo)
|
||||
bs.registry.set_secure_item("openPypeMongo", self._mongo)
|
||||
|
||||
os.environ["OPENPYPE_MONGO"] = self._mongo
|
||||
|
||||
self.message.emit(
|
||||
f"Detecting installed Pype versions in {bs.data_dir}", False)
|
||||
detected = bs.find_pype(include_zips=True)
|
||||
f"Detecting installed OpenPype versions in {bs.data_dir}",
|
||||
False)
|
||||
detected = bs.find_openpype(include_zips=True)
|
||||
|
||||
if detected:
|
||||
if PypeVersion(
|
||||
if OpenPypeVersion(
|
||||
version=local_version, path=Path()) < detected[-1]:
|
||||
self.message.emit((
|
||||
f"Latest installed version {detected[-1]} is newer "
|
||||
f"then currently running {local_version}"
|
||||
), False)
|
||||
self.message.emit("Skipping Pype install ...", False)
|
||||
self.message.emit("Skipping OpenPype install ...", False)
|
||||
if detected[-1].path.suffix.lower() == ".zip":
|
||||
bs.extract_pype(detected[-1])
|
||||
bs.extract_openpype(detected[-1])
|
||||
self.finished.emit(InstallResult(0))
|
||||
return
|
||||
|
||||
if PypeVersion(version=local_version).get_main_version() == detected[-1].get_main_version(): # noqa
|
||||
if OpenPypeVersion(version=local_version).get_main_version() == detected[-1].get_main_version(): # noqa
|
||||
self.message.emit((
|
||||
f"Latest installed version is the same as "
|
||||
f"currently running {local_version}"
|
||||
), False)
|
||||
self.message.emit("Skipping Pype install ...", False)
|
||||
self.message.emit("Skipping OpenPype install ...", False)
|
||||
self.finished.emit(InstallResult(0))
|
||||
return
|
||||
|
||||
|
|
@ -118,17 +120,17 @@ class InstallThread(QThread):
|
|||
else:
|
||||
if getattr(sys, 'frozen', False):
|
||||
self.message.emit("None detected.", True)
|
||||
self.message.emit(("We will use Pype coming with "
|
||||
self.message.emit(("We will use OpenPype coming with "
|
||||
"installer."), False)
|
||||
pype_version = bs.create_version_from_frozen_code()
|
||||
if not pype_version:
|
||||
openpype_version = bs.create_version_from_frozen_code()
|
||||
if not openpype_version:
|
||||
self.message.emit(
|
||||
f"!!! Install failed - {pype_version}", True)
|
||||
f"!!! Install failed - {openpype_version}", True)
|
||||
self.finished.emit(InstallResult(-1))
|
||||
return
|
||||
self.message.emit(f"Using: {pype_version}", False)
|
||||
bs.install_version(pype_version)
|
||||
self.message.emit(f"Installed as {pype_version}", False)
|
||||
self.message.emit(f"Using: {openpype_version}", False)
|
||||
bs.install_version(openpype_version)
|
||||
self.message.emit(f"Installed as {openpype_version}", False)
|
||||
self.progress.emit(100)
|
||||
self.finished.emit(InstallResult(1))
|
||||
return
|
||||
|
|
@ -136,26 +138,26 @@ class InstallThread(QThread):
|
|||
self.message.emit("None detected.", False)
|
||||
|
||||
self.message.emit(
|
||||
f"We will use local Pype version {local_version}", False)
|
||||
f"We will use local OpenPype version {local_version}", False)
|
||||
|
||||
local_pype = bs.create_version_from_live_code()
|
||||
if not local_pype:
|
||||
local_openpype = bs.create_version_from_live_code()
|
||||
if not local_openpype:
|
||||
self.message.emit(
|
||||
f"!!! Install failed - {local_pype}", True)
|
||||
f"!!! Install failed - {local_openpype}", True)
|
||||
self.finished.emit(InstallResult(-1))
|
||||
return
|
||||
|
||||
try:
|
||||
bs.install_version(local_pype)
|
||||
except (PypeVersionExists,
|
||||
PypeVersionInvalid,
|
||||
PypeVersionIOError) as e:
|
||||
bs.install_version(local_openpype)
|
||||
except (OpenPypeVersionExists,
|
||||
OpenPypeVersionInvalid,
|
||||
OpenPypeVersionIOError) as e:
|
||||
self.message.emit(f"Installed failed: ", True)
|
||||
self.message.emit(str(e), True)
|
||||
self.finished.emit(InstallResult(-1))
|
||||
return
|
||||
|
||||
self.message.emit(f"Installed as {local_pype}", False)
|
||||
self.message.emit(f"Installed as {local_openpype}", False)
|
||||
self.progress.emit(100)
|
||||
return
|
||||
else:
|
||||
|
|
@ -167,7 +169,7 @@ class InstallThread(QThread):
|
|||
f"!!! invalid mongo url {self._mongo}", True)
|
||||
self.finished.emit(InstallResult(-1))
|
||||
return
|
||||
bs.registry.set_secure_item("pypeMongo", self._mongo)
|
||||
bs.registry.set_secure_item("openPypeMongo", self._mongo)
|
||||
os.environ["OPENPYPE_MONGO"] = self._mongo
|
||||
|
||||
self.message.emit(f"processing {self._path}", True)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Pype terminal animation."""
|
||||
"""OpenPype terminal animation."""
|
||||
import blessed
|
||||
from pathlib import Path
|
||||
from time import sleep
|
||||
|
|
@ -15,7 +15,7 @@ except AttributeError:
|
|||
|
||||
|
||||
def play_animation():
|
||||
"""Play ASCII art Pype animation."""
|
||||
"""Play ASCII art OpenPype animation."""
|
||||
if NO_TERMINAL:
|
||||
return
|
||||
print(term.home + term.clear)
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@
|
|||
"""Tools used in **Igniter** GUI.
|
||||
|
||||
Functions ``compose_url()`` and ``decompose_url()`` are the same as in
|
||||
``pype.lib`` and they are here to avoid importing pype module before its
|
||||
``openpype.lib`` and they are here to avoid importing OpenPype module before its
|
||||
version is decided.
|
||||
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
from typing import Dict, Union
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
|
|
@ -163,7 +164,7 @@ def validate_mongo_string(mongo: str) -> (bool, str):
|
|||
|
||||
|
||||
def validate_path_string(path: str) -> (bool, str):
|
||||
"""Validate string if it is path to Pype repository.
|
||||
"""Validate string if it is path to OpenPype repository.
|
||||
|
||||
Args:
|
||||
path (str): Path to validate.
|
||||
|
|
@ -187,10 +188,10 @@ def validate_path_string(path: str) -> (bool, str):
|
|||
return True, "valid path"
|
||||
|
||||
|
||||
def get_pype_global_settings(url: str) -> dict:
|
||||
def get_openpype_global_settings(url: str) -> dict:
|
||||
"""Load global settings from Mongo database.
|
||||
|
||||
We are loading data from database `pype` and collection `settings`.
|
||||
We are loading data from database `openpype` and collection `settings`.
|
||||
There we expect document type `global_settings`.
|
||||
|
||||
Args:
|
||||
|
|
@ -215,7 +216,7 @@ def get_pype_global_settings(url: str) -> dict:
|
|||
# Create mongo connection
|
||||
client = MongoClient(**mongo_kwargs)
|
||||
# Access settings collection
|
||||
col = client["pype"]["settings"]
|
||||
col = client["openpype"]["settings"]
|
||||
# Query global settings
|
||||
global_settings = col.find_one({"type": "global_settings"}) or {}
|
||||
# Close Mongo connection
|
||||
|
|
@ -228,22 +229,22 @@ def get_pype_global_settings(url: str) -> dict:
|
|||
return global_settings.get("data") or {}
|
||||
|
||||
|
||||
def get_pype_path_from_db(url: str) -> Union[str, None]:
|
||||
"""Get Pype path from global settings.
|
||||
def get_openpype_path_from_db(url: str) -> Union[str, None]:
|
||||
"""Get OpenPype path from global settings.
|
||||
|
||||
Args:
|
||||
url (str): mongodb url.
|
||||
|
||||
Returns:
|
||||
path to Pype or None if not found
|
||||
path to OpenPype or None if not found
|
||||
"""
|
||||
global_settings = get_pype_global_settings(url)
|
||||
global_settings = get_openpype_global_settings(url)
|
||||
paths = (
|
||||
global_settings
|
||||
.get("pype_path", {})
|
||||
.get("openpype_path", {})
|
||||
.get(platform.system().lower())
|
||||
) or []
|
||||
# For cases when `pype_path` is a single path
|
||||
# For cases when `openpype_path` is a single path
|
||||
if paths and isinstance(paths, str):
|
||||
paths = [paths]
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class ASettingRegistry():
|
|||
"""Delete item from settings.
|
||||
|
||||
Note:
|
||||
see :meth:`pype.lib.user_settings.ARegistrySettings.delete_item`
|
||||
see :meth:`openpype.lib.user_settings.ARegistrySettings.delete_item`
|
||||
|
||||
"""
|
||||
pass
|
||||
|
|
@ -216,7 +216,7 @@ class IniSettingRegistry(ASettingRegistry):
|
|||
if not os.path.exists(self._registry_file):
|
||||
with open(self._registry_file, mode="w") as cfg:
|
||||
print("# Settings registry", cfg)
|
||||
print("# Generated by Pype {}".format(version), cfg)
|
||||
print("# Generated by OpenPype {}".format(version), cfg)
|
||||
now = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
|
||||
print("# {}".format(now), cfg)
|
||||
|
||||
|
|
@ -350,7 +350,7 @@ class IniSettingRegistry(ASettingRegistry):
|
|||
"""Delete item from default section.
|
||||
|
||||
Note:
|
||||
See :meth:`~pype.lib.IniSettingsRegistry.delete_item_from_section`
|
||||
See :meth:`~openpype.lib.IniSettingsRegistry.delete_item_from_section`
|
||||
|
||||
"""
|
||||
self.delete_item_from_section("MAIN", name)
|
||||
|
|
@ -367,7 +367,7 @@ class JSONSettingRegistry(ASettingRegistry):
|
|||
now = datetime.now().strftime("%d/%m/%Y %H:%M:%S")
|
||||
header = {
|
||||
"__metadata__": {
|
||||
"pype-version": os.getenv("OPENPYPE_VERSION", "N/A"),
|
||||
"openpype-version": os.getenv("OPENPYPE_VERSION", "N/A"),
|
||||
"generated": now
|
||||
},
|
||||
"registry": {}
|
||||
|
|
@ -385,7 +385,7 @@ class JSONSettingRegistry(ASettingRegistry):
|
|||
"""Get item value from registry json.
|
||||
|
||||
Note:
|
||||
See :meth:`pype.lib.JSONSettingRegistry.get_item`
|
||||
See :meth:`openpype.lib.JSONSettingRegistry.get_item`
|
||||
|
||||
"""
|
||||
with open(self._registry_file, mode="r") as cfg:
|
||||
|
|
@ -418,7 +418,7 @@ class JSONSettingRegistry(ASettingRegistry):
|
|||
"""Set item value to registry json.
|
||||
|
||||
Note:
|
||||
See :meth:`pype.lib.JSONSettingRegistry.set_item`
|
||||
See :meth:`openpype.lib.JSONSettingRegistry.set_item`
|
||||
|
||||
"""
|
||||
with open(self._registry_file, "r+") as cfg:
|
||||
|
|
@ -450,8 +450,8 @@ class JSONSettingRegistry(ASettingRegistry):
|
|||
json.dump(data, cfg, indent=4)
|
||||
|
||||
|
||||
class PypeSettingsRegistry(JSONSettingRegistry):
|
||||
"""Class handling Pype general settings registry.
|
||||
class OpenPypeSettingsRegistry(JSONSettingRegistry):
|
||||
"""Class handling OpenPype general settings registry.
|
||||
|
||||
Attributes:
|
||||
vendor (str): Name used for path construction.
|
||||
|
|
@ -461,6 +461,7 @@ class PypeSettingsRegistry(JSONSettingRegistry):
|
|||
|
||||
def __init__(self):
|
||||
self.vendor = "pypeclub"
|
||||
self.product = "pype"
|
||||
self.product = "openpype"
|
||||
path = appdirs.user_data_dir(self.product, self.vendor)
|
||||
super(PypeSettingsRegistry, self).__init__("pype_settings", path)
|
||||
super(OpenPypeSettingsRegistry, self).__init__(
|
||||
"openpype_settings", path)
|
||||
|
|
|
|||
4
poetry.lock
generated
4
poetry.lock
generated
|
|
@ -637,8 +637,8 @@ view = ["PySide2 (>=5.11,<6.0)"]
|
|||
|
||||
[package.source]
|
||||
type = "legacy"
|
||||
url = "https://d.r1.wbsprt.com/pype.club/distribute"
|
||||
reference = "pype"
|
||||
url = "https://distribute.openpype.io/wheels"
|
||||
reference = "openpype"
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
in-project = true
|
||||
|
||||
[repositories.pype]
|
||||
url = "http://d.r1.wbsprt.com/pype.club/distribute/"
|
||||
url = "https://distribute.openpype.io/wheels/"
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
[tool.poetry]
|
||||
name = "Pype"
|
||||
name = "OpenPype"
|
||||
version = "3.0.0-alpha1"
|
||||
description = "Multi-platform open-source pipeline built around the Avalon platform, expanding it with extra features and integrations."
|
||||
authors = ["Pype Club <info@pype.club>"]
|
||||
authors = ["OpenPype Team <info@openpype.io>"]
|
||||
license = "MIT License"
|
||||
homepage = "https://pype.club"
|
||||
documentation = "https://pype.club/docs/artist_getting_started"
|
||||
repository = "https://github.com/pypeclub/pype"
|
||||
homepage = "https://openpype.io"
|
||||
documentation = "https://openpype.io/docs/artist_getting_started"
|
||||
repository = "https://github.com/pypeclub/openpype"
|
||||
readme = "README.md"
|
||||
keywords = ["Pipeline", "Avalon", "VFX", "animation", "automation", "tracking", "asset management"]
|
||||
|
||||
|
|
@ -15,9 +15,9 @@ python = "3.7.*"
|
|||
aiohttp = "^3.7"
|
||||
aiohttp_json_rpc = "*" # TVPaint server
|
||||
acre = { git = "https://github.com/pypeclub/acre.git" }
|
||||
opentimelineio = { version = "0.14.0.dev1", source = "pype" }
|
||||
opentimelineio = { version = "0.14.0.dev1", source = "openpype" }
|
||||
appdirs = "^1.4.3"
|
||||
blessed = "^1.17" # pype terminal formatting
|
||||
blessed = "^1.17" # openpype terminal formatting
|
||||
clique = "1.5.*"
|
||||
Click = "^7"
|
||||
dnspython = "^2.1.0"
|
||||
|
|
@ -65,12 +65,12 @@ tqdm = "*"
|
|||
wheel = "*"
|
||||
|
||||
[tool.poetry.urls]
|
||||
"Bug Tracker" = "https://github.com/pypeclub/pype/issues"
|
||||
"Discussions" = "https://github.com/pypeclub/pype/discussions"
|
||||
"Bug Tracker" = "https://github.com/pypeclub/openpype/issues"
|
||||
"Discussions" = "https://github.com/pypeclub/openpype/discussions"
|
||||
|
||||
[[tool.poetry.source]]
|
||||
name = "pype"
|
||||
url = "https://d.r1.wbsprt.com/pype.club/distribute/"
|
||||
name = "openpype"
|
||||
url = "https://distribute.openpype.io/wheels/"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
|
|
|
|||
|
|
@ -25,4 +25,4 @@ omit = /tests
|
|||
directory = ./coverage
|
||||
|
||||
[tool:pytest]
|
||||
norecursedirs = repos/* pype/modules/ftrack/*
|
||||
norecursedirs = repos/* openpype/modules/ftrack/*
|
||||
18
setup.py
18
setup.py
|
|
@ -10,9 +10,9 @@ from sphinx.setup_command import BuildDoc
|
|||
|
||||
version = {}
|
||||
|
||||
pype_root = Path(os.path.dirname(__file__))
|
||||
openpype_root = Path(os.path.dirname(__file__))
|
||||
|
||||
with open(pype_root / "pype" / "version.py") as fp:
|
||||
with open(openpype_root / "pype" / "version.py") as fp:
|
||||
exec(fp.read(), version)
|
||||
|
||||
version_match = re.search(r"(\d+\.\d+.\d+).*", version["__version__"])
|
||||
|
|
@ -78,28 +78,28 @@ build_options = dict(
|
|||
optimize=0
|
||||
)
|
||||
|
||||
icon_path = pype_root / "igniter" / "openpype.ico"
|
||||
icon_path = openpype_root / "igniter" / "openpype.ico"
|
||||
|
||||
executables = [
|
||||
Executable("start.py", base=None,
|
||||
target_name="pype_console", icon=icon_path.as_posix()),
|
||||
target_name="openpype_console", icon=icon_path.as_posix()),
|
||||
Executable("start.py", base=base,
|
||||
target_name="pype_gui", icon=icon_path.as_posix())
|
||||
target_name="openpype_gui", icon=icon_path.as_posix())
|
||||
]
|
||||
|
||||
setup(
|
||||
name="pype",
|
||||
name="OpenPype",
|
||||
version=__version__,
|
||||
description="Ultimate pipeline",
|
||||
cmdclass={"build_sphinx": BuildDoc},
|
||||
options={
|
||||
"build_exe": build_options,
|
||||
"build_sphinx": {
|
||||
"project": "Pype",
|
||||
"project": "OpenPype",
|
||||
"version": __version__,
|
||||
"release": __version__,
|
||||
"source_dir": (pype_root / "docs" / "source").as_posix(),
|
||||
"build_dir": (pype_root / "docs" / "build").as_posix()
|
||||
"source_dir": (openpype_root / "docs" / "source").as_posix(),
|
||||
"build_dir": (openpype_root / "docs" / "build").as_posix()
|
||||
}
|
||||
},
|
||||
executables=executables
|
||||
|
|
|
|||
263
start.py
263
start.py
|
|
@ -1,46 +1,46 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Main entry point for Pype command.
|
||||
"""Main entry point for OpenPype command.
|
||||
|
||||
Bootstrapping process of Pype is as follows:
|
||||
Bootstrapping process of OpenPype is as follows:
|
||||
|
||||
`OPENPYPE_PATH` is checked for existence - either one from environment or
|
||||
from user settings. Precedence takes the one set by environment.
|
||||
|
||||
On this path we try to find pype in directories version string in their names.
|
||||
For example: `pype-v3.0.1-foo` is valid name, or even `foo_3.0.2` - as long
|
||||
as version can be determined from its name _AND_ file `pype/pype/version.py`
|
||||
can be found inside, it is considered Pype installation.
|
||||
On this path we try to find OpenPype in directories version string in their names.
|
||||
For example: `openpype-v3.0.1-foo` is valid name, or even `foo_3.0.2` - as long
|
||||
as version can be determined from its name _AND_ file `openpype/openpype/version.py`
|
||||
can be found inside, it is considered OpenPype installation.
|
||||
|
||||
If no Pype repositories are found in `OPENPYPE_PATH` (user data dir)
|
||||
then **Igniter** (Pype setup tool) will launch its GUI.
|
||||
If no OpenPype repositories are found in `OPENPYPE_PATH` (user data dir)
|
||||
then **Igniter** (OpenPype setup tool) will launch its GUI.
|
||||
|
||||
It can be used to specify `OPENPYPE_PATH` or if it is _not_ specified, current
|
||||
*"live"* repositories will be used to create zip file and copy it to
|
||||
appdata dir in user home and extract it there. Version will be determined by
|
||||
version specified in Pype module.
|
||||
version specified in OpenPype module.
|
||||
|
||||
If Pype repository directories are found in default install location
|
||||
If OpenPype repository directories are found in default install location
|
||||
(user data dir) or in `OPENPYPE_PATH`, it will get list of those dirs there and
|
||||
use latest one or the one specified with optional `--use-version` command
|
||||
line argument. If the one specified doesn't exist then latest available
|
||||
version will be used. All repositories in that dir will be added
|
||||
to `sys.path` and `PYTHONPATH`.
|
||||
|
||||
If Pype is live (not frozen) then current version of Pype module will be
|
||||
If OpenPype is live (not frozen) then current version of OpenPype module will be
|
||||
used. All directories under `repos` will be added to `sys.path` and
|
||||
`PYTHONPATH`.
|
||||
|
||||
Pype depends on connection to `MongoDB`_. You can specify MongoDB connection
|
||||
OpenPype depends on connection to `MongoDB`_. You can specify MongoDB connection
|
||||
string via `OPENPYPE_MONGO` set in environment or it can be set in user
|
||||
settings or via **Igniter** GUI.
|
||||
|
||||
So, bootstrapping Pype looks like this::
|
||||
So, bootstrapping OpenPype looks like this::
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
+-------------------------------------------------------+
|
||||
| Determine MongoDB connection: |
|
||||
| Use `OPENPYPE_MONGO`, system keyring `pypeMongo` |
|
||||
| Use `OPENPYPE_MONGO`, system keyring `openPypeMongo` |
|
||||
+--------------------------|----------------------------+
|
||||
.--- Found? --.
|
||||
YES NO
|
||||
|
|
@ -52,9 +52,9 @@ So, bootstrapping Pype looks like this::
|
|||
| |
|
||||
| |
|
||||
+-----------------v------------------------------------+ |
|
||||
| Get location of Pype: | |
|
||||
| Get location of OpenPype: | |
|
||||
| 1) Test for `OPENPYPE_PATH` environment variable | |
|
||||
| 2) Test `pypePath` in registry setting | |
|
||||
| 2) Test `openPypePath` in registry setting | |
|
||||
| 3) Test user data directory | |
|
||||
| ................................................... | |
|
||||
| If running from frozen code: | |
|
||||
|
|
@ -63,21 +63,21 @@ So, bootstrapping Pype looks like this::
|
|||
| - Use live code and install it to user data dir | |
|
||||
| * can be overridden with `--use-version` argument | |
|
||||
+-------------------------|----------------------------+ |
|
||||
.-- Is Pype found? --. |
|
||||
YES NO |
|
||||
| | |
|
||||
| +--------------v------------------+ |
|
||||
.-- Is OpenPype found? --. |
|
||||
YES NO |
|
||||
| | |
|
||||
| +---------------v-----------------+ |
|
||||
| | Look in `OPENPYPE_PATH`, find | |
|
||||
| | latest version and install it | |
|
||||
| | to user data dir. | |
|
||||
| +--------------|------------------+ |
|
||||
| .-- Is Pype found? --. |
|
||||
| YES NO ---------+
|
||||
| .-- Is OpenPype found? --. |
|
||||
| YES NO --------+
|
||||
| |
|
||||
|<---------+
|
||||
|
|
||||
+-------------v------------+
|
||||
| Run Pype |
|
||||
| Run OpenPype |
|
||||
+--------------------------+
|
||||
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ Todo:
|
|||
Move or remove bootstrapping environments out of the code.
|
||||
|
||||
Attributes:
|
||||
silent_commands (list): list of commands for which we won't print Pype
|
||||
silent_commands (list): list of commands for which we won't print OpenPype
|
||||
logo and info header.
|
||||
|
||||
.. _MongoDB:
|
||||
|
|
@ -113,16 +113,16 @@ if getattr(sys, 'frozen', False):
|
|||
|
||||
import igniter # noqa: E402
|
||||
from igniter import BootstrapRepos # noqa: E402
|
||||
from igniter.tools import get_pype_path_from_db # noqa
|
||||
from igniter.bootstrap_repos import PypeVersion # noqa: E402
|
||||
from igniter.tools import get_openpype_path_from_db # noqa
|
||||
from igniter.bootstrap_repos import OpenPypeVersion # noqa: E402
|
||||
|
||||
bootstrap = BootstrapRepos()
|
||||
silent_commands = ["run", "igniter", "standalonepublisher",
|
||||
"extractenvironments"]
|
||||
|
||||
|
||||
def set_pype_global_environments() -> None:
|
||||
"""Set global pype's environments."""
|
||||
def set_openpype_global_environments() -> None:
|
||||
"""Set global OpenPype's environments."""
|
||||
import acre
|
||||
|
||||
from pype.settings import get_environments
|
||||
|
|
@ -148,13 +148,13 @@ def set_pype_global_environments() -> None:
|
|||
def run(arguments: list, env: dict = None) -> int:
|
||||
"""Use correct executable to run stuff.
|
||||
|
||||
This passing arguments to correct Pype executable. If Pype is run from
|
||||
live sources, executable will be `python` in virtual environment.
|
||||
If running from frozen code, executable will be `pype`. Its equivalent in
|
||||
live code is `python start.py`.
|
||||
This passing arguments to correct OpenPype executable. If OpenPype is run
|
||||
from live sources, executable will be `python` in virtual environment.
|
||||
If running from frozen code, executable will be `openpype_console` or
|
||||
`openpype_gui`. Its equivalent in live code is `python start.py`.
|
||||
|
||||
Args:
|
||||
arguments (list): Argument list to pass Pype.
|
||||
arguments (list): Argument list to pass OpenPype.
|
||||
env (dict, optional): Dictionary containing environment.
|
||||
|
||||
Returns:
|
||||
|
|
@ -183,7 +183,7 @@ def set_avalon_environments():
|
|||
"""
|
||||
from pype import PACKAGE_DIR
|
||||
|
||||
# Path to pype's schema
|
||||
# Path to OpenPype's schema
|
||||
schema_path = os.path.join(
|
||||
os.path.dirname(PACKAGE_DIR),
|
||||
"schema"
|
||||
|
|
@ -194,22 +194,22 @@ def set_avalon_environments():
|
|||
or os.environ["OPENPYPE_MONGO"]
|
||||
)
|
||||
os.environ.update({
|
||||
# Mongo url (use same as pype has)
|
||||
# Mongo url (use same as OpenPype has)
|
||||
"AVALON_MONGO": avalon_mongo_url,
|
||||
|
||||
"AVALON_SCHEMA": schema_path,
|
||||
# Mongo DB name where avalon docs are stored
|
||||
"AVALON_DB": "avalon",
|
||||
# Name of config
|
||||
"AVALON_CONFIG": "pype",
|
||||
"AVALON_LABEL": "Pype"
|
||||
"AVALON_CONFIG": "openpype",
|
||||
"AVALON_LABEL": "OpenPype"
|
||||
})
|
||||
|
||||
|
||||
def set_modules_environments():
|
||||
"""Set global environments for pype modules.
|
||||
"""Set global environments for OpenPype modules.
|
||||
|
||||
This requires to have pype in `sys.path`.
|
||||
This requires to have OpenPype in `sys.path`.
|
||||
"""
|
||||
|
||||
from pype.modules import ModulesManager
|
||||
|
|
@ -270,7 +270,7 @@ def _process_arguments() -> tuple:
|
|||
import igniter
|
||||
return_code = igniter.open_dialog()
|
||||
|
||||
# this is when we want to run Pype without installing anything.
|
||||
# this is when we want to run OpenPype without installing anything.
|
||||
# or we are ready to run.
|
||||
if return_code not in [2, 3]:
|
||||
sys.exit(return_code)
|
||||
|
|
@ -292,11 +292,12 @@ def _determine_mongodb() -> str:
|
|||
|
||||
"""
|
||||
|
||||
pype_mongo = os.getenv("OPENPYPE_MONGO", None)
|
||||
if not pype_mongo:
|
||||
openpype_mongo = os.getenv("OPENPYPE_MONGO", None)
|
||||
if not openpype_mongo:
|
||||
# try system keyring
|
||||
try:
|
||||
pype_mongo = bootstrap.registry.get_secure_item("pypeMongo")
|
||||
openpype_mongo = bootstrap.registry.get_secure_item(
|
||||
"openPypeMongo")
|
||||
except ValueError:
|
||||
print("*** No DB connection string specified.")
|
||||
print("--- launching setup UI ...")
|
||||
|
|
@ -304,41 +305,41 @@ def _determine_mongodb() -> str:
|
|||
igniter.open_dialog()
|
||||
|
||||
try:
|
||||
pype_mongo = bootstrap.registry.get_secure_item("pypeMongo")
|
||||
openpype_mongo = bootstrap.registry.get_secure_item(
|
||||
"openPypeMongo")
|
||||
except ValueError:
|
||||
raise RuntimeError("missing mongodb url")
|
||||
|
||||
return pype_mongo
|
||||
return openpype_mongo
|
||||
|
||||
|
||||
def _initialize_environment(pype_version: PypeVersion) -> None:
|
||||
version_path = pype_version.path
|
||||
os.environ["OPENPYPE_VERSION"] = pype_version.version
|
||||
# set PYPE_ROOT to point to currently used Pype version.
|
||||
def _initialize_environment(openpype_version: OpenPypeVersion) -> None:
|
||||
version_path = openpype_version.path
|
||||
os.environ["OPENPYPE_VERSION"] = openpype_version.version
|
||||
# set OPENPYPE_ROOT to point to currently used OpenPype version.
|
||||
os.environ["OPENPYPE_ROOT"] = os.path.normpath(version_path.as_posix())
|
||||
# inject version to Python environment (sys.path, ...)
|
||||
print(">>> Injecting Pype version to running environment ...")
|
||||
print(">>> Injecting OpenPype version to running environment ...")
|
||||
bootstrap.add_paths_from_directory(version_path)
|
||||
|
||||
# Additional sys paths related to OPENPYPE_ROOT directory
|
||||
# TODO move additional paths to `boot` part when OPENPYPE_ROOT will point
|
||||
# to same hierarchy from code and from frozen pype
|
||||
# to same hierarchy from code and from frozen OpenPype
|
||||
additional_paths = [
|
||||
# add pype tools
|
||||
os.path.join(os.environ["OPENPYPE_ROOT"], "pype", "pype", "tools"),
|
||||
# add common pype vendor
|
||||
# add OpenPype tools
|
||||
os.path.join(os.environ["OPENPYPE_ROOT"], "openpype", "tools"),
|
||||
# add common OpenPype vendor
|
||||
# (common for multiple Python interpreter versions)
|
||||
os.path.join(
|
||||
os.environ["OPENPYPE_ROOT"],
|
||||
"pype",
|
||||
"pype",
|
||||
"openpype",
|
||||
"vendor",
|
||||
"python",
|
||||
"common"
|
||||
)
|
||||
]
|
||||
|
||||
split_paths = os.getenv("OPENPYTHONPATH", "").split(os.pathsep)
|
||||
split_paths = os.getenv("PYTHONPATH", "").split(os.pathsep)
|
||||
for path in additional_paths:
|
||||
split_paths.insert(0, path)
|
||||
sys.path.insert(0, path)
|
||||
|
|
@ -346,9 +347,9 @@ def _initialize_environment(pype_version: PypeVersion) -> None:
|
|||
os.environ["PYTHONPATH"] = os.pathsep.join(split_paths)
|
||||
|
||||
|
||||
def _find_frozen_pype(use_version: str = None,
|
||||
use_staging: bool = False) -> Path:
|
||||
"""Find Pype to run from frozen code.
|
||||
def _find_frozen_openpype(use_version: str = None,
|
||||
use_staging: bool = False) -> Path:
|
||||
"""Find OpenPype to run from frozen code.
|
||||
|
||||
This will process and modify environment variables:
|
||||
``PYTHONPATH``, ``OPENPYPE_VERSION``, ``OPENPYPE_ROOT``
|
||||
|
|
@ -361,75 +362,75 @@ def _find_frozen_pype(use_version: str = None,
|
|||
Path: Path to version to be used.
|
||||
|
||||
Raises:
|
||||
RuntimeError: If no Pype version are found or no staging version
|
||||
RuntimeError: If no OpenPype version are found or no staging version
|
||||
(if requested).
|
||||
|
||||
"""
|
||||
pype_version = None
|
||||
pype_versions = bootstrap.find_pype(include_zips=True,
|
||||
staging=use_staging)
|
||||
openpype_version = None
|
||||
openpype_versions = bootstrap.find_openpype(include_zips=True,
|
||||
staging=use_staging)
|
||||
if not os.getenv("OPENPYPE_TRYOUT"):
|
||||
try:
|
||||
# use latest one found (last in the list is latest)
|
||||
pype_version = pype_versions[-1]
|
||||
openpype_version = openpype_versions[-1]
|
||||
except IndexError:
|
||||
# no pype version found, run Igniter and ask for them.
|
||||
print('*** No Pype versions found.')
|
||||
# no OpenPype version found, run Igniter and ask for them.
|
||||
print('*** No OpenPype versions found.')
|
||||
print("--- launching setup UI ...")
|
||||
import igniter
|
||||
return_code = igniter.open_dialog()
|
||||
if return_code == 2:
|
||||
os.environ["OPENPYPE_TRYOUT"] = "1"
|
||||
if return_code == 3:
|
||||
# run Pype after installation
|
||||
# run OpenPype after installation
|
||||
|
||||
print('>>> Finding Pype again ...')
|
||||
pype_versions = bootstrap.find_pype(staging=use_staging)
|
||||
print('>>> Finding OpenPype again ...')
|
||||
openpype_versions = bootstrap.find_openpype(
|
||||
staging=use_staging)
|
||||
try:
|
||||
pype_version = pype_versions[-1]
|
||||
openpype_version = openpype_versions[-1]
|
||||
except IndexError:
|
||||
print(("!!! Something is wrong and we didn't "
|
||||
"found it again."))
|
||||
pype_versions = None
|
||||
sys.exit(1)
|
||||
elif return_code != 2:
|
||||
print(f" . finished ({return_code})")
|
||||
sys.exit(return_code)
|
||||
|
||||
if not pype_versions:
|
||||
if not openpype_versions:
|
||||
# no Pype versions found anyway, lets use then the one
|
||||
# shipped with frozen Pype
|
||||
# shipped with frozen OpenPype
|
||||
if not os.getenv("OPENPYPE_TRYOUT"):
|
||||
print("*** Still no luck finding Pype.")
|
||||
print("*** Still no luck finding OpenPype.")
|
||||
print(("*** We'll try to use the one coming "
|
||||
"with Pype installation."))
|
||||
"with OpenPype installation."))
|
||||
version_path = _bootstrap_from_code(use_version)
|
||||
pype_version = PypeVersion(
|
||||
openpype_version = OpenPypeVersion(
|
||||
version=BootstrapRepos.get_version(version_path),
|
||||
path=version_path)
|
||||
_initialize_environment(pype_version)
|
||||
_initialize_environment(openpype_version)
|
||||
return version_path
|
||||
|
||||
# get path of version specified in `--use-version`
|
||||
version_path = BootstrapRepos.get_version_path_from_list(
|
||||
use_version, pype_versions)
|
||||
use_version, openpype_versions)
|
||||
|
||||
if not version_path:
|
||||
if use_version is not None:
|
||||
if not pype_version:
|
||||
if not openpype_version:
|
||||
...
|
||||
else:
|
||||
print(("!!! Specified version was not found, using "
|
||||
"latest available"))
|
||||
# specified version was not found so use latest detected.
|
||||
version_path = pype_version.path
|
||||
print(f">>> Using version [ {pype_version} ]")
|
||||
version_path = openpype_version.path
|
||||
print(f">>> Using version [ {openpype_version} ]")
|
||||
print(f" From {version_path}")
|
||||
|
||||
# test if latest detected is installed (in user data dir)
|
||||
is_inside = False
|
||||
try:
|
||||
is_inside = pype_version.path.resolve().relative_to(
|
||||
is_inside = openpype_version.path.resolve().relative_to(
|
||||
bootstrap.data_dir)
|
||||
except ValueError:
|
||||
# if relative path cannot be calculated, Pype version is not
|
||||
|
|
@ -439,19 +440,19 @@ def _find_frozen_pype(use_version: str = None,
|
|||
if not is_inside:
|
||||
# install latest version to user data dir
|
||||
version_path = bootstrap.install_version(
|
||||
pype_version, force=True)
|
||||
openpype_version, force=True)
|
||||
|
||||
if pype_version.path.is_file():
|
||||
if openpype_version.path.is_file():
|
||||
print(">>> Extracting zip file ...")
|
||||
version_path = bootstrap.extract_pype(pype_version)
|
||||
pype_version.path = version_path
|
||||
version_path = bootstrap.extract_openpype(openpype_version)
|
||||
openpype_version.path = version_path
|
||||
|
||||
_initialize_environment(pype_version)
|
||||
_initialize_environment(openpype_version)
|
||||
return version_path
|
||||
|
||||
|
||||
def _bootstrap_from_code(use_version):
|
||||
"""Bootstrap live code (or the one coming with frozen Pype.
|
||||
"""Bootstrap live code (or the one coming with frozen OpenPype.
|
||||
|
||||
Args:
|
||||
use_version: (str): specific version to use.
|
||||
|
|
@ -463,35 +464,35 @@ def _bootstrap_from_code(use_version):
|
|||
# run through repos and add them to `sys.path` and `PYTHONPATH`
|
||||
# set root
|
||||
if getattr(sys, 'frozen', False):
|
||||
pype_root = os.path.normpath(
|
||||
openpype_root = os.path.normpath(
|
||||
os.path.dirname(sys.executable))
|
||||
local_version = bootstrap.get_version(Path(pype_root))
|
||||
local_version = bootstrap.get_version(Path(openpype_root))
|
||||
print(f" - running version: {local_version}")
|
||||
assert local_version
|
||||
else:
|
||||
pype_root = os.path.normpath(
|
||||
openpype_root = os.path.normpath(
|
||||
os.path.dirname(
|
||||
os.path.dirname(
|
||||
os.path.realpath(igniter.__file__))))
|
||||
# get current version of Pype
|
||||
# get current version of OpenPype
|
||||
local_version = bootstrap.get_local_live_version()
|
||||
|
||||
os.environ["OPENPYPE_VERSION"] = local_version
|
||||
if use_version and use_version != local_version:
|
||||
pype_versions = bootstrap.find_pype(include_zips=True)
|
||||
openpype_versions = bootstrap.find_openpype(include_zips=True)
|
||||
version_path = BootstrapRepos.get_version_path_from_list(
|
||||
use_version, pype_versions)
|
||||
use_version, openpype_versions)
|
||||
if version_path:
|
||||
# use specified
|
||||
bootstrap.add_paths_from_directory(version_path)
|
||||
os.environ["OPENPYPE_VERSION"] = use_version
|
||||
else:
|
||||
version_path = pype_root
|
||||
os.environ["OPENPYPE_ROOT"] = pype_root
|
||||
repos = os.listdir(os.path.join(pype_root, "repos"))
|
||||
repos = [os.path.join(pype_root, "repos", repo) for repo in repos]
|
||||
version_path = openpype_root
|
||||
os.environ["OPENPYPE_ROOT"] = openpype_root
|
||||
repos = os.listdir(os.path.join(openpype_root, "repos"))
|
||||
repos = [os.path.join(openpype_root, "repos", repo) for repo in repos]
|
||||
# add self to python paths
|
||||
repos.insert(0, pype_root)
|
||||
repos.insert(0, openpype_root)
|
||||
for repo in repos:
|
||||
sys.path.insert(0, repo)
|
||||
|
||||
|
|
@ -505,16 +506,16 @@ def _bootstrap_from_code(use_version):
|
|||
# in case when we are running without any version installed.
|
||||
if not getattr(sys, 'frozen', False):
|
||||
split_paths.append(site.getsitepackages()[-1])
|
||||
# TODO move additional paths to `boot` part when OPENPYPE_ROOT will
|
||||
# point to same hierarchy from code and from frozen pype
|
||||
# TODO move additional paths to `boot` part when OPENPYPE_ROOT will point
|
||||
# to same hierarchy from code and from frozen OpenPype
|
||||
additional_paths = [
|
||||
# add pype tools
|
||||
os.path.join(os.environ["OPENPYPE_ROOT"], "pype", "tools"),
|
||||
# add common pype vendor
|
||||
# add OpenPype tools
|
||||
os.path.join(os.environ["OPENPYPE_ROOT"], "openpype", "tools"),
|
||||
# add common OpenPype vendor
|
||||
# (common for multiple Python interpreter versions)
|
||||
os.path.join(
|
||||
os.environ["OPENPYPE_ROOT"],
|
||||
"pype",
|
||||
"openpype",
|
||||
"vendor",
|
||||
"python",
|
||||
"common"
|
||||
|
|
@ -530,13 +531,13 @@ def _bootstrap_from_code(use_version):
|
|||
|
||||
|
||||
def boot():
|
||||
"""Bootstrap Pype."""
|
||||
"""Bootstrap OpenPype."""
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
# Play animation
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
from igniter.terminal_splash import play_animation
|
||||
# from igniter.terminal_splash import play_animation
|
||||
|
||||
# don't play for silenced commands
|
||||
# if all(item not in sys.argv for item in silent_commands):
|
||||
|
|
@ -553,18 +554,18 @@ def boot():
|
|||
# ------------------------------------------------------------------------
|
||||
|
||||
try:
|
||||
pype_mongo = _determine_mongodb()
|
||||
openpype_mongo = _determine_mongodb()
|
||||
except RuntimeError as e:
|
||||
# without mongodb url we are done for.
|
||||
print(f"!!! {e}")
|
||||
sys.exit(1)
|
||||
|
||||
os.environ["OPENPYPE_MONGO"] = pype_mongo
|
||||
os.environ["OPENPYPE_MONGO"] = openpype_mongo
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
# Set environments - load Pype path from database (if set)
|
||||
# Set environments - load OpenPype path from database (if set)
|
||||
# ------------------------------------------------------------------------
|
||||
# set PYPE_ROOT to running location until proper version can be
|
||||
# set OPENPYPE_ROOT to running location until proper version can be
|
||||
# determined.
|
||||
if getattr(sys, 'frozen', False):
|
||||
os.environ["OPENPYPE_ROOT"] = os.path.dirname(sys.executable)
|
||||
|
|
@ -573,18 +574,22 @@ def boot():
|
|||
|
||||
# Get Pype path from database and set it to environment so Pype can
|
||||
# find its versions there and bootstrap them.
|
||||
pype_path = get_pype_path_from_db(pype_mongo)
|
||||
if not os.getenv("OPENPYPE_PATH") and pype_path:
|
||||
os.environ["OPENPYPE_PATH"] = pype_path
|
||||
openpype_path = get_openpype_path_from_db(openpype_mongo)
|
||||
if not openpype_path:
|
||||
print("*** Cannot get OpenPype path from database.")
|
||||
|
||||
if not os.getenv("OPENPYPE_PATH") and openpype_path:
|
||||
os.environ["OPENPYPE_PATH"] = openpype_path
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
# Find Pype versions
|
||||
# Find OpenPype versions
|
||||
# ------------------------------------------------------------------------
|
||||
# WARNING Environment PYPE_ROOT may change if frozen pype is executed
|
||||
# WARNING: Environment OPENPYPE_ROOT may change if frozen OpenPype
|
||||
# is executed
|
||||
if getattr(sys, 'frozen', False):
|
||||
# find versions of Pype to be used with frozen code
|
||||
# find versions of OpenPype to be used with frozen code
|
||||
try:
|
||||
version_path = _find_frozen_pype(use_version, use_staging)
|
||||
version_path = _find_frozen_openpype(use_version, use_staging)
|
||||
except RuntimeError as e:
|
||||
# no version to run
|
||||
print(f"!!! {e}")
|
||||
|
|
@ -593,7 +598,7 @@ def boot():
|
|||
version_path = _bootstrap_from_code(use_version)
|
||||
|
||||
# set this to point either to `python` from venv in case of live code
|
||||
# or to `pype` or `pype_console` in case of frozen code
|
||||
# or to `openpype` or `openpype_console` in case of frozen code
|
||||
os.environ["OPENPYPE_EXECUTABLE"] = sys.executable
|
||||
|
||||
if getattr(sys, 'frozen', False):
|
||||
|
|
@ -602,7 +607,7 @@ def boot():
|
|||
os.environ["OPENPYPE_REPOS_ROOT"] = os.path.join(
|
||||
os.environ["OPENPYPE_ROOT"], "repos")
|
||||
|
||||
# delete Pype module and it's submodules from cache so it is used from
|
||||
# delete OpenPype module and it's submodules from cache so it is used from
|
||||
# specific version
|
||||
modules_to_del = [
|
||||
sys.modules.pop(module_name)
|
||||
|
|
@ -622,8 +627,8 @@ def boot():
|
|||
# Avalon environments must be set before avalon module is imported
|
||||
print(" - for Avalon ...")
|
||||
set_avalon_environments()
|
||||
print(" - global Pype ...")
|
||||
set_pype_global_environments()
|
||||
print(" - global OpenPype ...")
|
||||
set_openpype_global_environments()
|
||||
print(" - for modules ...")
|
||||
set_modules_environments()
|
||||
|
||||
|
|
@ -633,7 +638,7 @@ def boot():
|
|||
|
||||
assert version_path, "Version path not defined."
|
||||
info = get_info()
|
||||
info.insert(0, f">>> Using Pype from [ {version_path} ]")
|
||||
info.insert(0, f">>> Using OpenPype from [ {version_path} ]")
|
||||
|
||||
t_width = 20
|
||||
try:
|
||||
|
|
@ -642,7 +647,7 @@ def boot():
|
|||
# running without terminal
|
||||
pass
|
||||
|
||||
_header = f"*** Pype [{__version__}] "
|
||||
_header = f"*** OpenPype [{__version__}] "
|
||||
|
||||
info.insert(0, _header + "-" * (t_width - len(_header)))
|
||||
for i in info:
|
||||
|
|
@ -654,7 +659,7 @@ def boot():
|
|||
cli.main(obj={}, prog_name="pype")
|
||||
except Exception: # noqa
|
||||
exc_info = sys.exc_info()
|
||||
print("!!! Pype crashed:")
|
||||
print("!!! OpenPype crashed:")
|
||||
traceback.print_exception(*exc_info)
|
||||
sys.exit(1)
|
||||
|
||||
|
|
@ -668,10 +673,10 @@ def get_info() -> list:
|
|||
|
||||
inf = []
|
||||
if not getattr(sys, 'frozen', False):
|
||||
inf.append(("Pype variant", "staging"))
|
||||
inf.append(("OpenPype variant", "staging"))
|
||||
else:
|
||||
inf.append(("Pype variant", "production"))
|
||||
inf.append(("Running pype from", os.environ.get('OPENPYPE_ROOT')))
|
||||
inf.append(("OpenPype variant", "production"))
|
||||
inf.append(("Running OpenPype from", os.environ.get('OPENPYPE_ROOT')))
|
||||
inf.append(("Using mongodb", components["host"]))
|
||||
|
||||
if os.environ.get("FTRACK_SERVER"):
|
||||
|
|
|
|||
|
|
@ -145,18 +145,18 @@ def test_search_string_for_pype_version(printer):
|
|||
assert PypeVersion.version_in_str(ver_string[0])[0] == ver_string[1]
|
||||
|
||||
|
||||
@pytest.mark.slow
|
||||
def test_install_live_repos(fix_bootstrap, printer):
|
||||
rf = fix_bootstrap.create_version_from_live_code()
|
||||
pype_version = fix_bootstrap.create_version_from_live_code()
|
||||
sep = os.path.sep
|
||||
expected_paths = [
|
||||
f"{rf}{sep}avalon-core",
|
||||
f"{rf}{sep}avalon-unreal-integration",
|
||||
f"{rf}{sep}maya-look-assigner",
|
||||
f"{rf}{sep}pype"
|
||||
f"{pype_version.path}{sep}repos{sep}avalon-core",
|
||||
f"{pype_version.path}{sep}repos{sep}avalon-unreal-integration",
|
||||
f"{pype_version.path}"
|
||||
]
|
||||
printer("testing zip creation")
|
||||
assert os.path.exists(rf), "zip archive was not created"
|
||||
fix_bootstrap.add_paths_from_archive(rf)
|
||||
assert os.path.exists(pype_version.path), "zip archive was not created"
|
||||
fix_bootstrap.add_paths_from_archive(pype_version.path)
|
||||
for ep in expected_paths:
|
||||
assert ep in sys.path, f"{ep} not set correctly"
|
||||
|
||||
|
|
@ -165,10 +165,9 @@ def test_install_live_repos(fix_bootstrap, printer):
|
|||
import pype # noqa: F401
|
||||
|
||||
# test if pype is imported from specific location in zip
|
||||
print(pype.__file__)
|
||||
assert "pype" in sys.modules.keys(), "Pype not imported"
|
||||
assert sys.modules["pype"].__file__ == \
|
||||
f"{rf}{sep}pype{sep}pype{sep}__init__.py"
|
||||
f"{pype_version.path}{sep}pype{sep}__init__.py"
|
||||
|
||||
|
||||
def test_find_pype(fix_bootstrap, tmp_path_factory, monkeypatch, printer):
|
||||
|
|
@ -252,7 +251,7 @@ def test_find_pype(fix_bootstrap, tmp_path_factory, monkeypatch, printer):
|
|||
def _create_valid_zip(path: Path, version: str):
|
||||
with ZipFile(path, "w") as zf:
|
||||
zf.writestr(
|
||||
"pype/pype/version.py", f"__version__ = '{version}'\n\n")
|
||||
"pype/version.py", f"__version__ = '{version}'\n\n")
|
||||
|
||||
def _create_invalid_dir(path: Path):
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
|
|
@ -260,7 +259,7 @@ def test_find_pype(fix_bootstrap, tmp_path_factory, monkeypatch, printer):
|
|||
fp.write("invalid")
|
||||
|
||||
def _create_valid_dir(path: Path, version: str):
|
||||
pype_path = path / "pype" / "pype"
|
||||
pype_path = path / "pype"
|
||||
version_path = pype_path / "version.py"
|
||||
pype_path.mkdir(parents=True, exist_ok=True)
|
||||
with open(version_path, "w") as fp:
|
||||
|
|
|
|||
|
|
@ -10,7 +10,3 @@ def test_validate_path_string(tmp_path):
|
|||
status2, _ = validate_path_string("booo" + str(uuid4()))
|
||||
assert status2 is False
|
||||
|
||||
# todo: change when Pype token is implemented
|
||||
status3, reason = validate_path_string(str(uuid4()))
|
||||
assert status3 is False
|
||||
assert reason == "Not implemented yet"
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to build Pype.
|
||||
Helper script to build OpenPype.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will detect Python installation, create venv and install
|
||||
all necessary packages from `requirements.txt` needed by Pype to be
|
||||
included during application freeze on Windows.
|
||||
This script will detect Python installation, and build OpenPype to `build`
|
||||
directory using existing virtual environment created by Poetry (or
|
||||
by running `/tools/create_venv.ps1`). It will then shuffle dependencies in
|
||||
build folder to optimize for different Python versions (2/3) in Python host.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
|
|
@ -75,14 +76,11 @@ function Install-Poetry() {
|
|||
|
||||
$art = @"
|
||||
|
||||
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/ ______ ___ ___ ___
|
||||
\ \ \___/ /\ \ \ \\ \\ \
|
||||
\ \____\ \ \_____\ \__\\__\\__\
|
||||
\/____/ \/_____/ . PYPE Club .
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
"@
|
||||
|
||||
|
|
@ -93,28 +91,28 @@ Write-Host $art -ForegroundColor DarkGreen
|
|||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$pype_root = (Get-Item $script_dir).parent.FullName
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
Set-Location -Path $pype_root
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
$version_file = Get-Content -Path "$($pype_root)\pype\version.py"
|
||||
$version_file = Get-Content -Path "$($openpype_root)\pype\version.py"
|
||||
$result = [regex]::Matches($version_file, '__version__ = "(?<version>\d+\.\d+.\d+.*)"')
|
||||
$pype_version = $result[0].Groups['version'].Value
|
||||
if (-not $pype_version) {
|
||||
$openpype_version = $result[0].Groups['version'].Value
|
||||
if (-not $openpype_version) {
|
||||
Write-Host "!!! " -ForegroundColor yellow -NoNewline
|
||||
Write-Host "Cannot determine Pype version."
|
||||
Write-Host "Cannot determine OpenPype version."
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
# Create build directory if not exist
|
||||
if (-not (Test-Path -PathType Container -Path "$($pype_root)\build")) {
|
||||
New-Item -ItemType Directory -Force -Path "$($pype_root)\build"
|
||||
if (-not (Test-Path -PathType Container -Path "$($openpype_root)\build")) {
|
||||
New-Item -ItemType Directory -Force -Path "$($openpype_root)\build"
|
||||
}
|
||||
|
||||
Write-Host "--- " -NoNewline -ForegroundColor yellow
|
||||
Write-Host "Cleaning build directory ..."
|
||||
try {
|
||||
Remove-Item -Recurse -Force "$($pype_root)\build\*"
|
||||
Remove-Item -Recurse -Force "$($openpype_root)\build\*"
|
||||
}
|
||||
catch {
|
||||
Write-Host "!!! " -NoNewline -ForegroundColor Red
|
||||
|
|
@ -124,8 +122,8 @@ catch {
|
|||
}
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Building Pype [ " -NoNewline -ForegroundColor white
|
||||
Write-host $pype_version -NoNewline -ForegroundColor green
|
||||
Write-Host "Building OpenPype [ " -NoNewline -ForegroundColor white
|
||||
Write-host $openpype_version -NoNewline -ForegroundColor green
|
||||
Write-Host " ] ..." -ForegroundColor white
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
|
|
@ -167,31 +165,31 @@ if (-not (Test-Path -PathType Container -Path "$($env:USERPROFILE)\.poetry\bin")
|
|||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Cleaning cache files ... " -NoNewline
|
||||
Get-ChildItem $pype_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force
|
||||
Get-ChildItem $pype_root -Filter "*.pyo" -Force -Recurse | Remove-Item -Force
|
||||
Get-ChildItem $pype_root -Filter "__pycache__" -Force -Recurse | Remove-Item -Force -Recurse
|
||||
Get-ChildItem $openpype_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force
|
||||
Get-ChildItem $openpype_root -Filter "*.pyo" -Force -Recurse | Remove-Item -Force
|
||||
Get-ChildItem $openpype_root -Filter "__pycache__" -Force -Recurse | Remove-Item -Force -Recurse
|
||||
Write-Host "OK" -ForegroundColor green
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Building Pype ..."
|
||||
Write-Host "Building OpenPype ..."
|
||||
$out = & poetry run python setup.py build 2>&1
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
{
|
||||
Set-Content -Path "$($pype_root)\build\build.log" -Value $out
|
||||
Set-Content -Path "$($openpype_root)\build\build.log" -Value $out
|
||||
Write-Host "!!! " -NoNewLine -ForegroundColor Red
|
||||
Write-Host "Build failed. Check the log: " -NoNewline
|
||||
Write-Host ".\build\build.log" -ForegroundColor Yellow
|
||||
Exit-WithCode $LASTEXITCODE
|
||||
}
|
||||
|
||||
Set-Content -Path "$($pype_root)\build\build.log" -Value $out
|
||||
& poetry run python "$($pype_root)\tools\build_dependencies.py"
|
||||
Set-Content -Path "$($openpype_root)\build\build.log" -Value $out
|
||||
& poetry run python "$($openpype_root)\tools\build_dependencies.py"
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "restoring current directory"
|
||||
Set-Location -Path $current_dir
|
||||
|
||||
Write-Host "*** " -NoNewline -ForegroundColor Cyan
|
||||
Write-Host "All done. You will find Pype and build log in " -NoNewLine
|
||||
Write-Host "All done. You will find OpenPype and build log in " -NoNewLine
|
||||
Write-Host "'.\build'" -NoNewline -ForegroundColor Green
|
||||
Write-Host " directory."
|
||||
|
|
|
|||
|
|
@ -5,13 +5,12 @@
|
|||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
EOF
|
||||
}
|
||||
|
|
@ -93,7 +92,7 @@ detect_python () {
|
|||
###############################################################################
|
||||
clean_pyc () {
|
||||
local path
|
||||
path=$pype_root
|
||||
path=$openpype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
|
|
@ -136,16 +135,16 @@ main () {
|
|||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(dirname $(dirname "$(realpath ${BASH_SOURCE[0]})"))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
openpype_root=$(dirname $(dirname "$(realpath ${BASH_SOURCE[0]})"))
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
version_command="import os;exec(open(os.path.join('$pype_root', 'pype', 'version.py')).read());print(__version__);"
|
||||
pype_version="$(python3 <<< ${version_command})"
|
||||
version_command="import os;exec(open(os.path.join('$openpype_root', 'openpype', 'version.py')).read());print(__version__);"
|
||||
openpype_version="$(python3 <<< ${version_command})"
|
||||
|
||||
echo -e "${BIYellow}---${RST} Cleaning build directory ..."
|
||||
rm -rf "$pype_root/build" && mkdir "$pype_root/build" > /dev/null
|
||||
rm -rf "$openpype_root/build" && mkdir "$openpype_root/build" > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Building Pype ${BIWhite}[${RST} ${BIGreen}$pype_version${RST} ${BIWhite}]${RST}"
|
||||
echo -e "${BIGreen}>>>${RST} Building OpenPype ${BIWhite}[${RST} ${BIGreen}$openpype_version${RST} ${BIWhite}]${RST}"
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning cache files ..."
|
||||
clean_pyc
|
||||
|
||||
|
|
@ -159,11 +158,11 @@ main () {
|
|||
fi
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Building ..."
|
||||
poetry run python3 "$pype_root/setup.py" build > "$pype_root/build/build.log" || { echo -e "${BIRed}!!!${RST} Build failed, see the build log."; return; }
|
||||
poetry run python3 "$pype_root/tools/build_dependencies.py"
|
||||
poetry run python3 "$openpype_root/setup.py" build > "$openpype_root/build/build.log" || { echo -e "${BIRed}!!!${RST} Build failed, see the build log."; return; }
|
||||
poetry run python3 "$openpype_root/tools/build_dependencies.py"
|
||||
|
||||
echo -e "${BICyan}>>>${RST} All done. You will find Pype and build log in \c"
|
||||
echo -e "${BIWhite}$pype_root/build${RST} directory."
|
||||
echo -e "${BICyan}>>>${RST} All done. You will find OpenPype and build log in \c"
|
||||
echo -e "${BIWhite}$openpype_root/build${RST} directory."
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ for d in libs_dir.iterdir():
|
|||
to_delete.append(d)
|
||||
_print(f"found {d}", 3)
|
||||
|
||||
# add pype and igniter in libs too
|
||||
to_delete.append(libs_dir / "pype")
|
||||
# add openpype and igniter in libs too
|
||||
to_delete.append(libs_dir / "openpype")
|
||||
to_delete.append(libs_dir / "igniter")
|
||||
|
||||
# delete duplicates
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script create virtual env.
|
||||
Helper script create virtual environment using Poetry.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will detect Python installation, create venv and install
|
||||
all necessary packages from `requirements.txt` needed by Pype to be
|
||||
included during application freeze on Windows.
|
||||
This script will detect Python installation, create venv with Poetry
|
||||
and install all necessary packages from `poetry.lock` or `pyproject.toml`
|
||||
needed by OpenPype to be included during application freeze on Windows.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
|
|
@ -82,20 +82,17 @@ print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))
|
|||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$pype_root = (Get-Item $script_dir).parent.FullName
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
Set-Location -Path $pype_root
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
$art = @"
|
||||
|
||||
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/ ______ ___ ___ ___
|
||||
\ \ \___/ /\ \ \ \\ \\ \
|
||||
\ \____\ \ \_____\ \__\\__\\__\
|
||||
\/____/ \/_____/ . PYPE Club .
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
"@
|
||||
|
||||
|
|
@ -104,18 +101,18 @@ Write-Host $art -ForegroundColor DarkGreen
|
|||
# Enable if PS 7.x is needed.
|
||||
# Show-PSWarning
|
||||
|
||||
$version_file = Get-Content -Path "$($pype_root)\pype\version.py"
|
||||
$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py"
|
||||
$result = [regex]::Matches($version_file, '__version__ = "(?<version>\d+\.\d+.\d+.*)"')
|
||||
$pype_version = $result[0].Groups['version'].Value
|
||||
if (-not $pype_version) {
|
||||
$openpype_version = $result[0].Groups['version'].Value
|
||||
if (-not $openpype_version) {
|
||||
Write-Host "!!! " -ForegroundColor yellow -NoNewline
|
||||
Write-Host "Cannot determine Pype version."
|
||||
Write-Host "Cannot determine OpenPype version."
|
||||
Set-Location -Path $current_dir
|
||||
Exit-WithCode 1
|
||||
}
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor Green
|
||||
Write-Host "Found Pype version " -NoNewline
|
||||
Write-Host "[ $($pype_version) ]" -ForegroundColor Green
|
||||
Write-Host "Found OpenPype version " -NoNewline
|
||||
Write-Host "[ $($openpype_version) ]" -ForegroundColor Green
|
||||
|
||||
Test-Python
|
||||
|
||||
|
|
@ -129,7 +126,7 @@ if (-not (Test-Path -PathType Container -Path "$($env:USERPROFILE)\.poetry\bin")
|
|||
Write-Host "OK" -ForegroundColor Green
|
||||
}
|
||||
|
||||
if (-not (Test-Path -PathType Leaf -Path "$($pype_root)\poetry.lock")) {
|
||||
if (-not (Test-Path -PathType Leaf -Path "$($openpype_root)\poetry.lock")) {
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Installing virtual environment and creating lock."
|
||||
} else {
|
||||
|
|
@ -145,4 +142,4 @@ if ($LASTEXITCODE -ne 0) {
|
|||
}
|
||||
Set-Location -Path $current_dir
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Virtual environment created. "
|
||||
Write-Host "Virtual environment created."
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script will detect Python installation, and create virtual environment
|
||||
# for Pype to run or build.
|
||||
|
||||
# This script will detect Python installation, create venv with Poetry
|
||||
# and install all necessary packages from `poetry.lock` or `pyproject.toml`
|
||||
# needed by OpenPype to be included during application freeze on unix.
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
EOF
|
||||
}
|
||||
|
|
@ -117,7 +115,7 @@ install_poetry () {
|
|||
###############################################################################
|
||||
clean_pyc () {
|
||||
local path
|
||||
path=$pype_root
|
||||
path=$openpype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
|
|
@ -144,8 +142,8 @@ main () {
|
|||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Reading Poetry ... \c"
|
||||
if [ -f "$HOME/.poetry/bin/poetry" ]; then
|
||||
|
|
@ -156,7 +154,7 @@ main () {
|
|||
install_poetry || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return; }
|
||||
fi
|
||||
|
||||
if [ -f "$pype_root/poetry.lock" ]; then
|
||||
if [ -f "$openpype_root/poetry.lock" ]; then
|
||||
echo -e "${BIGreen}>>>${RST} Updating dependencies ..."
|
||||
else
|
||||
echo -e "${BIGreen}>>>${RST} Installing dependencies ..."
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script create distributable Pype zip.
|
||||
Helper script create distributable OpenPype zip.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will detect Python installation, create venv and install
|
||||
all necessary packages from `requirements.txt` needed by Pype to be
|
||||
included during application freeze on Windows.
|
||||
This script will detect Python installation and run OpenPype to create
|
||||
zip. It needs mongodb running. I will create zip from current source code
|
||||
version and copy it top `%LOCALAPPDATA%/pypeclub/pype` if `--path` or `-p`
|
||||
argument is not used.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
|
|
@ -35,19 +36,16 @@ function Show-PSWarning() {
|
|||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$pype_root = (Get-Item $script_dir).parent.FullName
|
||||
Set-Location -Path $pype_root
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
$art = @"
|
||||
|
||||
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/ ______ ___ ___ ___
|
||||
\ \ \___/ /\ \ \ \\ \\ \
|
||||
\ \____\ \ \_____\ \__\\__\\__\
|
||||
\/____/ \/_____/ . PYPE Club .
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
"@
|
||||
|
||||
|
|
@ -56,12 +54,12 @@ Write-Host $art -ForegroundColor DarkGreen
|
|||
# Enable if PS 7.x is needed.
|
||||
# Show-PSWarning
|
||||
|
||||
$version_file = Get-Content -Path "$($pype_root)\pype\version.py"
|
||||
$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py"
|
||||
$result = [regex]::Matches($version_file, '__version__ = "(?<version>\d+\.\d+.\d+.*)"')
|
||||
$pype_version = $result[0].Groups['version'].Value
|
||||
if (-not $pype_version) {
|
||||
$openpype_version = $result[0].Groups['version'].Value
|
||||
if (-not $openpype_version) {
|
||||
Write-Host "!!! " -ForegroundColor yellow -NoNewline
|
||||
Write-Host "Cannot determine Pype version."
|
||||
Write-Host "Cannot determine OpenPype version."
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
|
|
@ -95,5 +93,5 @@ Write-Host "Generating zip from current sources ..."
|
|||
Write-Host "... " -NoNewline -ForegroundColor Magenta
|
||||
Write-Host "arguments: " -NoNewline -ForegroundColor Gray
|
||||
Write-Host $ARGS -ForegroundColor White
|
||||
& poetry run python "$($pype_root)\start.py" generate-zip $ARGS
|
||||
& poetry run python "$($openpype_root)\start.py" generate-zip $ARGS
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,17 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Helper script to create Pype zip.
|
||||
|
||||
# This script will detect Python installation and run OpenPype to create
|
||||
# zip. It needs mongodb running. I will create zip from current source code
|
||||
# version and copy it top `~/.local/share/pype` if `--path` or `-p`
|
||||
# argument is not used.
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
EOF
|
||||
}
|
||||
|
|
@ -91,7 +92,7 @@ detect_python () {
|
|||
###############################################################################
|
||||
clean_pyc () {
|
||||
local path
|
||||
path=$pype_root
|
||||
path=$openpype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
|
|
@ -118,11 +119,11 @@ main () {
|
|||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
poetry run python3 "$pype_root/start.py" generate-zip "$@"
|
||||
poetry run python3 "$openpype_root/start.py" generate-zip "$@"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to update Pype Sphinx sources.
|
||||
Helper script to update OpenPype Sphinx sources.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will run apidoc over Pype sources and generate new source rst
|
||||
This script will run apidoc over OpenPype sources and generate new source rst
|
||||
files for documentation. Then it will run build_sphinx to create test html
|
||||
documentation build.
|
||||
|
||||
|
|
@ -15,33 +15,31 @@ PS> .\make_docs.ps1
|
|||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$pype_root = (Get-Item $script_dir).parent.FullName
|
||||
Set-Location -Path $pype_root
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
|
||||
$art = @"
|
||||
|
||||
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/ ______ ___ ___ ___
|
||||
\ \ \___/ /\ \ \ \\ \\ \
|
||||
\ \____\ \ \_____\ \__\\__\\__\
|
||||
\/____/ \/_____/ . PYPE Club .
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
"@
|
||||
|
||||
Write-Host $art -ForegroundColor DarkGreen
|
||||
|
||||
Write-Host "This will not overwrite existing source rst files, only scan and add new."
|
||||
Set-Location -Path $pype_root
|
||||
Set-Location -Path $openpype_root
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Running apidoc ..."
|
||||
& poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($pype_root)\docs\source" igniter
|
||||
& poetry run sphinx-apidoc.exe -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($pype_root)\docs\source" pype vendor, pype\vendor
|
||||
& poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($openpype_root)\docs\source" igniter
|
||||
& poetry run sphinx-apidoc.exe -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$($openpype_root)\docs\source" openpype vendor, openpype\vendor
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Building html ..."
|
||||
& poetry run python "$($pype_root)\setup.py" build_sphinx
|
||||
& poetry run python "$($openpype_root)\setup.py" build_sphinx
|
||||
Set-Location -Path $current_dir
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Make Pype documentation
|
||||
|
||||
# This script will run apidoc over OpenPype sources and generate new source rst
|
||||
# files for documentation. Then it will run build_sphinx to create test html
|
||||
# documentation build.
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
EOF
|
||||
}
|
||||
|
||||
|
|
@ -71,15 +70,15 @@ main () {
|
|||
echo -e "${RST}"
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running apidoc ..."
|
||||
poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" igniter
|
||||
poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$pype_root/docs/source" pype vendor, pype\vendor
|
||||
poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$openpype_root/docs/source" igniter
|
||||
poetry run sphinx-apidoc -M -e -d 10 --ext-intersphinx --ext-todo --ext-coverage --ext-viewcode -o "$openpype_root/docs/source" openpype vendor, openpype\vendor
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Building html ..."
|
||||
poetry run python3 "$pype_root/setup.py" build_sphinx
|
||||
poetry run python3 "$openpype_root/setup.py" build_sphinx
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
|||
|
|
@ -13,14 +13,11 @@ PS> .\run_mongo.ps1
|
|||
|
||||
$art = @"
|
||||
|
||||
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/ ______ ___ ___ ___
|
||||
\ \ \___/ /\ \ \ \\ \\ \
|
||||
\ \____\ \ \_____\ \__\\__\\__\
|
||||
\/____/ \/_____/ . PYPE Club .
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
"@
|
||||
|
||||
|
|
@ -37,37 +34,39 @@ function Exit-WithCode($exitcode) {
|
|||
|
||||
|
||||
function Find-Mongo {
|
||||
Write-Host ">>> " -NoNewLine -ForegroundColor Green
|
||||
Write-Host "Detecting MongoDB ... " -NoNewline
|
||||
if (-not (Get-Command "mongod" -ErrorAction SilentlyContinue)) {
|
||||
if(Test-Path 'C:\Program Files\MongoDB\Server\*\bin\mongod.exe' -PathType Leaf) {
|
||||
# we have mongo server installed on standard Windows location
|
||||
# so we can inject it to the PATH. We'll use latest version available.
|
||||
$mongoVersions = Get-ChildItem -Directory 'C:\Program Files\MongoDB\Server' | Sort-Object -Property {$_.Name -as [int]}
|
||||
if(Test-Path "$($mongoVersions[-1])\bin\mongod.exe" -PathType Leaf) {
|
||||
$env:PATH="$($env:PATH);$($mongoVersions[-1])\bin\"
|
||||
Write-Host "OK" -ForegroundColor Green
|
||||
Write-Host " - auto-added from [ " -NoNewline
|
||||
Write-Host "$($mongoVersions[-1])\bin\" -NoNewLine -ForegroundColor Cyan
|
||||
Write-Host " ]"
|
||||
} else {
|
||||
Write-Host "FAILED " -NoNewLine -ForegroundColor Red
|
||||
Write-Host "MongoDB not detected" -ForegroundColor Yellow
|
||||
Write-Host "Tried to find it on standard location " -NoNewline -ForegroundColor Gray
|
||||
Write-Host " [ " -NoNewline -ForegroundColor Cyan
|
||||
Write-Host "$($mongoVersions[-1])\bin\" -NoNewline -ForegroundColor White
|
||||
Write-Host " ] " -NonNewLine -ForegroundColor Cyan
|
||||
Write-Host "but failed." -ForegroundColor Gray
|
||||
Exit-WithCode 1
|
||||
}
|
||||
$defaultPath = "C:\Program Files\MongoDB\Server"
|
||||
Write-Host ">>> " -NoNewLine -ForegroundColor Green
|
||||
Write-Host "Detecting MongoDB ... " -NoNewline
|
||||
if (-not (Get-Command "mongod" -ErrorAction SilentlyContinue)) {
|
||||
if(Test-Path "$($defaultPath)\*\bin\mongod.exe" -PathType Leaf) {
|
||||
# we have mongo server installed on standard Windows location
|
||||
# so we can inject it to the PATH. We'll use latest version available.
|
||||
$mongoVersions = Get-ChildItem -Directory 'C:\Program Files\MongoDB\Server' | Sort-Object -Property {$_.Name -as [int]}
|
||||
if(Test-Path "$($mongoVersions[-1])\bin\mongod.exe" -PathType Leaf) {
|
||||
$env:PATH = "$($env:PATH);$($mongoVersions[-1])\bin\"
|
||||
Write-Host "OK" -ForegroundColor Green
|
||||
Write-Host " - auto-added from [ " -NoNewline
|
||||
Write-Host "$($mongoVersions[-1])\bin\mongod.exe" -NoNewLine -ForegroundColor Cyan
|
||||
Write-Host " ]"
|
||||
return "$($mongoVersions[-1])\bin\mongod.exe"
|
||||
} else {
|
||||
Write-Host "FAILED " -NoNewLine -ForegroundColor Red
|
||||
Write-Host "MongoDB not detected" -ForegroundColor Yellow
|
||||
Write-Host "Tried to find it on standard location " -NoNewline -ForegroundColor Gray
|
||||
Write-Host " [ " -NoNewline -ForegroundColor Cyan
|
||||
Write-Host "$($mongoVersions[-1])\bin\mongod.exe" -NoNewline -ForegroundColor White
|
||||
Write-Host " ] " -NoNewLine -ForegroundColor Cyan
|
||||
Write-Host "but failed." -ForegroundColor Gray
|
||||
Exit-WithCode 1
|
||||
}
|
||||
} else {
|
||||
Write-Host "FAILED " -NoNewLine -ForegroundColor Red
|
||||
Write-Host "MongoDB not detected in PATH" -ForegroundColor Yellow
|
||||
Exit-WithCode 1
|
||||
Write-Host "FAILED " -NoNewLine -ForegroundColor Red
|
||||
Write-Host "MongoDB not detected in PATH" -ForegroundColor Yellow
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
} else {
|
||||
Write-Host "OK" -ForegroundColor Green
|
||||
Write-Host "OK" -ForegroundColor Green
|
||||
return Get-Command "mongod" -ErrorAction SilentlyContinue
|
||||
}
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
|
@ -80,14 +79,15 @@ function Find-Mongo {
|
|||
}
|
||||
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$pype_root = (Get-Item $script_dir).parent.FullName
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
# mongodb port
|
||||
$port = 2707
|
||||
|
||||
# path to database
|
||||
$dbpath = (Get-Item $pype_root).parent.FullName + "\mongo_db_data"
|
||||
$dbpath = (Get-Item $openpype_root).parent.FullName + "\mongo_db_data"
|
||||
|
||||
$mongoPath = Find-Mongo
|
||||
Start-Process -FilePath $mongopath "--dbpath $($dbpath) --port $($port)" -PassThru
|
||||
|
||||
|
||||
Find-Mongo
|
||||
$mongo = Get-Command "mongod" | Select-Object -ExpandProperty Definition
|
||||
Start-Process -FilePath $mongo "--dbpath $($dbpath) --port $($port)"
|
||||
|
|
|
|||
|
|
@ -6,13 +6,12 @@
|
|||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
EOF
|
||||
}
|
||||
|
|
@ -72,11 +71,11 @@ main () {
|
|||
echo -e "${RST}"
|
||||
|
||||
# Directories
|
||||
pype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
openpype_root=$(dirname $(realpath $(dirname $(dirname "${BASH_SOURCE[0]}"))))
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
mongo_port=2707
|
||||
dbpath="$(dirname $pype_root)/mongo_db_data"
|
||||
dbpath="$(dirname $openpype_root)/mongo_db_data"
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running mongodb ..."
|
||||
mongod --dbpath "$dbpath" --port $mongo_port
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to Pype Settings UI
|
||||
Helper script to OpenPype Settings UI
|
||||
|
||||
.DESCRIPTION
|
||||
This script will run Pype and open Settings UI.
|
||||
This script will run OpenPype and open Settings UI.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ PS> .\run_settings.ps1
|
|||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$pype_root = (Get-Item $script_dir).parent.FullName
|
||||
Set-Location -Path $pype_root
|
||||
& poetry run python "$($pype_root)\start.py" settings --dev
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
Set-Location -Path $openpype_root
|
||||
& poetry run python "$($openpype_root)\start.py" settings --dev
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,17 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run Pype Settings GUI
|
||||
# Run OpenPype Settings GUI
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
EOF
|
||||
}
|
||||
|
|
@ -91,7 +90,7 @@ detect_python () {
|
|||
###############################################################################
|
||||
clean_pyc () {
|
||||
local path
|
||||
path=$pype_root
|
||||
path=$oepnpype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
|
|
@ -118,11 +117,11 @@ main () {
|
|||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Generating zip from current sources ..."
|
||||
poetry run python3 "$pype_root/start.py" settings --dev
|
||||
poetry run python3 "$openpype_root/start.py" settings --dev
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to build Pype.
|
||||
Helper script to run tests for OpenPype.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will detect Python installation, create venv and install
|
||||
all necessary packages from `requirements.txt` needed by Pype to be
|
||||
included during application freeze on Windows.
|
||||
This will use virtual environment and pytest to run test for OpenPype.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
|
|
@ -34,14 +32,11 @@ function Show-PSWarning() {
|
|||
|
||||
$art = @"
|
||||
|
||||
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/ ______ ___ ___ ___
|
||||
\ \ \___/ /\ \ \ \\ \\ \
|
||||
\ \____\ \ \_____\ \__\\__\\__\
|
||||
\/____/ \/_____/ . PYPE Club .
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
"@
|
||||
|
||||
|
|
@ -52,22 +47,22 @@ Write-Host $art -ForegroundColor DarkGreen
|
|||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$pype_root = (Get-Item $script_dir).parent.FullName
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
Set-Location -Path $pype_root
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
$version_file = Get-Content -Path "$($pype_root)\pype\version.py"
|
||||
$version_file = Get-Content -Path "$($openpype_root)\openpype\version.py"
|
||||
$result = [regex]::Matches($version_file, '__version__ = "(?<version>\d+\.\d+.\d+.*)"')
|
||||
$pype_version = $result[0].Groups['version'].Value
|
||||
if (-not $pype_version) {
|
||||
$openpype_version = $result[0].Groups['version'].Value
|
||||
if (-not $openpype_version) {
|
||||
Write-Host "!!! " -ForegroundColor yellow -NoNewline
|
||||
Write-Host "Cannot determine Pype version."
|
||||
Write-Host "Cannot determine OpenPype version."
|
||||
Exit-WithCode 1
|
||||
}
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Building Pype [ " -NoNewline -ForegroundColor white
|
||||
Write-host $pype_version -NoNewline -ForegroundColor green
|
||||
Write-Host "Building OpenPype [ " -NoNewline -ForegroundColor white
|
||||
Write-host $openpype_version -NoNewline -ForegroundColor green
|
||||
Write-Host " ] ..." -ForegroundColor white
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
|
|
@ -97,15 +92,15 @@ Write-Host "OK [ $p ]" -ForegroundColor green
|
|||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Cleaning cache files ... " -NoNewline
|
||||
Get-ChildItem $pype_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force
|
||||
Get-ChildItem $pype_root -Filter "__pycache__" -Force -Recurse | Remove-Item -Force -Recurse
|
||||
Get-ChildItem $openpype_root -Filter "*.pyc" -Force -Recurse | Remove-Item -Force
|
||||
Get-ChildItem $openpype_root -Filter "__pycache__" -Force -Recurse | Remove-Item -Force -Recurse
|
||||
Write-Host "OK" -ForegroundColor green
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
Write-Host "Testing Pype ..."
|
||||
Write-Host "Testing OpenPype ..."
|
||||
$original_pythonpath = $env:PYTHONPATH
|
||||
$env:PYTHONPATH="$($pype_root);$($env:PYTHONPATH)"
|
||||
& poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$($pype_root)/tests"
|
||||
$env:PYTHONPATH="$($openpype_root);$($env:PYTHONPATH)"
|
||||
& poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$($openpype_root)/tests"
|
||||
$env:PYTHONPATH = $original_pythonpath
|
||||
|
||||
Write-Host ">>> " -NoNewline -ForegroundColor green
|
||||
|
|
|
|||
|
|
@ -1,17 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run tests for Pype
|
||||
|
||||
# Run tests for OpenPype
|
||||
# This will use virtual environment and pytest to run test for OpenPype.
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
EOF
|
||||
}
|
||||
|
|
@ -87,7 +86,7 @@ detect_python () {
|
|||
###############################################################################
|
||||
clean_pyc () {
|
||||
local path
|
||||
path=$pype_root
|
||||
path=$openpype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
|
|
@ -114,13 +113,13 @@ main () {
|
|||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" || return > /dev/null
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$openpype_root" || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Testing Pype ..."
|
||||
echo -e "${BIGreen}>>>${RST} Testing OpenPype ..."
|
||||
original_pythonpath=$PYTHONPATH
|
||||
export PYTHONPATH="$pype_root:$PYTHONPATH"
|
||||
poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$pype_root/tests"
|
||||
export PYTHONPATH="$openpype_root:$PYTHONPATH"
|
||||
poetry run pytest -x --capture=sys --print -W ignore::DeprecationWarning "$openpype_root/tests"
|
||||
PYTHONPATH=$original_pythonpath
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script Pype Tray.
|
||||
Helper script OpenPype Tray.
|
||||
|
||||
.DESCRIPTION
|
||||
|
||||
|
|
@ -12,8 +12,8 @@ PS> .\run_tray.ps1
|
|||
#>
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$pype_root = (Get-Item $script_dir).parent.FullName
|
||||
Set-Location -Path $pype_root
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
& poetry run python "$($pype_root)\start.py" tray --debug
|
||||
& poetry run python "$($openpype_root)\start.py" tray --debug
|
||||
Set-Location -Path $current_dir
|
||||
|
|
@ -1,17 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run Pype Tray
|
||||
# Run OpenPype Tray
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
EOF
|
||||
}
|
||||
|
|
@ -92,7 +91,7 @@ detect_python () {
|
|||
###############################################################################
|
||||
clean_pyc () {
|
||||
local path
|
||||
path=$pype_root
|
||||
path=$openpype_root
|
||||
echo -e "${BIGreen}>>>${RST} Cleaning pyc at [ ${BIWhite}$path${RST} ] ... \c"
|
||||
find "$path" -regex '^.*\(__pycache__\|\.py[co]\)$' -delete
|
||||
echo -e "${BIGreen}DONE${RST}"
|
||||
|
|
@ -119,11 +118,11 @@ main () {
|
|||
detect_python || return 1
|
||||
|
||||
# Directories
|
||||
pype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$pype_root" > /dev/null || return > /dev/null
|
||||
openpype_root=$(realpath $(dirname $(dirname "${BASH_SOURCE[0]}")))
|
||||
pushd "$openpype_root" > /dev/null || return > /dev/null
|
||||
|
||||
echo -e "${BIGreen}>>>${RST} Running Pype Tray with debug option ..."
|
||||
poetry run python3 "$pype_root/start.py" tray --debug
|
||||
echo -e "${BIGreen}>>>${RST} Running OpenPype Tray with debug option ..."
|
||||
poetry run python3 "$openpype_root/start.py" tray --debug
|
||||
}
|
||||
|
||||
main
|
||||
|
|
@ -1,26 +1,20 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Helper script to run mongodb.
|
||||
|
||||
.DESCRIPTION
|
||||
This script will detect mongodb, add it to the PATH and launch it on specified port and db location.
|
||||
Helper script to update submodules.
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
PS> .\run_mongo.ps1
|
||||
PS> .\update_submodules.ps1
|
||||
|
||||
#>
|
||||
|
||||
$art = @"
|
||||
|
||||
|
||||
____________
|
||||
/\ ___ \
|
||||
\ \ \/_\ \
|
||||
\ \ _____/ ______ ___ ___ ___
|
||||
\ \ \___/ /\ \ \ \\ \\ \
|
||||
\ \____\ \ \_____\ \__\\__\\__\
|
||||
\/____/ \/_____/ . PYPE Club .
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
https://openpype.io
|
||||
|
||||
"@
|
||||
|
||||
|
|
@ -37,9 +31,9 @@ function Exit-WithCode($exitcode) {
|
|||
|
||||
$current_dir = Get-Location
|
||||
$script_dir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
|
||||
$pype_root = (Get-Item $script_dir).parent.FullName
|
||||
$openpype_root = (Get-Item $script_dir).parent.FullName
|
||||
|
||||
Set-Location -Path $pype_root
|
||||
Set-Location -Path $openpype_root
|
||||
|
||||
git submodule update --recursive --remote
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run Pype Tray
|
||||
# Run OpenPype Tray
|
||||
|
||||
|
||||
art () {
|
||||
cat <<-EOF
|
||||
____________
|
||||
/\\ ___ \\
|
||||
\\ \\ \\/_\\ \\
|
||||
\\ \\ _____/ ______ ___ ___ ___
|
||||
\\ \\ \\___/ /\\ \\ \\ \\\\ \\\\ \\
|
||||
\\ \\____\\ \\ \\_____\\ \\__\\\\__\\\\__\\
|
||||
\\/____/ \\/_____/ . PYPE Club .
|
||||
|
||||
▒█▀▀▀█ █▀▀█ █▀▀ █▀▀▄ ▒█▀▀█ █░░█ █▀▀█ █▀▀ ▀█▀ ▀█▀ ▀█▀
|
||||
▒█░░▒█ █░░█ █▀▀ █░░█ ▒█▄▄█ █▄▄█ █░░█ █▀▀ ▒█░ ▒█░ ▒█░
|
||||
▒█▄▄▄█ █▀▀▀ ▀▀▀ ▀░░▀ ▒█░░░ ▄▄▄█ █▀▀▀ ▀▀▀ ▄█▄ ▄█▄ ▄█▄
|
||||
.---= [ by Pype Club ] =---.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue