diff --git a/igniter/__init__.py b/igniter/__init__.py index e69de29bb2..92b2cf65b9 100644 --- a/igniter/__init__.py +++ b/igniter/__init__.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +"""Open install dialog.""" + +import sys +from Qt import QtWidgets + +from .install_dialog import InstallDialog + + +def run(): + app = QtWidgets.QApplication(sys.argv) + d = InstallDialog() + d.show() + sys.exit(app.exec_()) diff --git a/igniter/bootstrap_repos.py b/igniter/bootstrap_repos.py index fe649c8148..b028fa3401 100644 --- a/igniter/bootstrap_repos.py +++ b/igniter/bootstrap_repos.py @@ -14,7 +14,7 @@ from typing import Union, Callable from zipfile import ZipFile from appdirs import user_data_dir -from version import __version__ +from pype.version import __version__ class BootstrapRepos(): @@ -167,4 +167,16 @@ class BootstrapRepos(): archive (str): path to archive. """ - pass + name_list = [] + with ZipFile(archive, "r") as zip: + name_list = zip.namelist() + + roots = [] + for item in name_list: + root = item.split("/")[0] + if root not in roots: + roots.append(root) + sys.path.append(f"{archive}{os.path.sep}{root}") + + os.environ["PYTHONPATH"] = "{}{}{}".format( + os.environ["PYTHONPATH"], os.pathsep, os.pathsep.join(roots)) diff --git a/pype.py b/pype.py index 1ad70c3963..0274f22370 100644 --- a/pype.py +++ b/pype.py @@ -8,7 +8,7 @@ from appdirs import user_data_dir from pype import cli from pype.lib import terminal as t -from version import __version__ +from pype.version import __version__ vendor = "pypeclub" @@ -35,7 +35,6 @@ print(art) t.echo(f"*** Pype [{__version__}] --------------------") t.echo(">>> Validating installation ...") -t.echo(sys.executable) try: cli.main(obj={}, prog_name="pype") except Exception: diff --git a/setup.cfg b/setup.cfg index cc509b94d8..0d89c74b6e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,3 +20,32 @@ omit = /tests [coverage:html] directory = ./coverage + +[tox:tox] +envlist = + py37 + docs +requires = + cx_Freeze + +[testenv:py37] +deps = + pytest + cx_Freeze +commands = + pytest -x --capture=sys --print -W ignore::DeprecationWarning {toxinidir}/tests + +[testenv:docs] +skipsdist = True +usedevelop = True +changedir = doc/en +deps = + cx_Freeze + attrs + more-itertools + PyYAML + sphinx + sphinxcontrib-trio + +commands = + sphinx-build -W -b html . _build diff --git a/setup.py b/setup.py index fb8fb13f46..983dce8021 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,18 @@ # -*- coding: utf-8 -*- """Setup info for building Pype 3.0.""" import sys +import os from cx_Freeze import setup, Executable -from version import __version__ + +version = {} +with open(os.path.join("pype", "version.py")) as fp: + exec(fp.read(), version) +__version__ = version['__version__'] install_requires = [ - "appdirs" + "appdirs", + "cx_Freeze", "clique", "jsonschema", "OpenTimelineIO", @@ -14,7 +20,7 @@ install_requires = [ "PIL", "pymongo", "Qt", - "speedcopy", + "speedcopy" ] base = None @@ -25,6 +31,7 @@ if sys.platform == "win32": buildOptions = dict( packages=install_requires, includes=[ + 'pype', 'repos/acre/acre', 'repos/avalon-core/avalon', 'repos/pyblish-base/pyblish', @@ -38,7 +45,7 @@ buildOptions = dict( "vendor", "LICENSE", "README.md", - "version"] + "pype/version.py"] ) @@ -49,5 +56,5 @@ setup( version=__version__, description="Ultimate pipeline", options=dict(build_exe=buildOptions), - executables=executables, + executables=executables ) diff --git a/tests/igniter/test_bootstrap_repos.py b/tests/igniter/test_bootstrap_repos.py index caf42ca656..05c35c697f 100644 --- a/tests/igniter/test_bootstrap_repos.py +++ b/tests/igniter/test_bootstrap_repos.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- """Test suite for repos bootstrapping (install).""" import os +import sys import pytest from igniter.bootstrap_repos import BootstrapRepos @@ -15,7 +16,19 @@ def fix_bootrap(tmp_path_factory): def test_install_live_repos(fix_bootrap, printer): - printer(f"repo: {fix_bootrap.live_repo_dir}") - printer(f"data: {fix_bootrap.data_dir}") rf = fix_bootrap.install_live_repos() + expected_paths = [ + f"{rf}{os.path.sep}acre", + f"{rf}{os.path.sep}avalon-core", + f"{rf}{os.path.sep}avalon-unreal-integration", + f"{rf}{os.path.sep}maya-look-assigner", + f"{rf}{os.path.sep}pyblish-base", + f"{rf}{os.path.sep}pype", + f"{rf}{os.path.sep}pype-config" + ] assert os.path.exists(rf), "zip archive was not created" + fix_bootrap.add_paths_from_archive(rf) + for ep in expected_paths: + assert ep in sys.path, f"{ep} not set correctly" + + import pype diff --git a/version.py b/version.py deleted file mode 100644 index 1580b6abd2..0000000000 --- a/version.py +++ /dev/null @@ -1,3 +0,0 @@ -# -*- coding: utf-8 -*- -"""Pype version specific metadata.""" -__version__ = "3.0.0"