diff --git a/igniter/bootstrap_repos.py b/igniter/bootstrap_repos.py index f624b96125..754a2d2e25 100644 --- a/igniter/bootstrap_repos.py +++ b/igniter/bootstrap_repos.py @@ -285,7 +285,7 @@ class BootstrapRepos: """Get version of local OpenPype.""" version = {} - path = Path(os.path.dirname(__file__)).parent / "openpype" / "version.py" + path = Path(os.environ["OPENPYPE_ROOT"]) / "openpype" / "version.py" with open(path, "r") as fp: exec(fp.read(), version) return version["__version__"] diff --git a/igniter/openpype.icns b/igniter/openpype.icns new file mode 100644 index 0000000000..792f819ad9 Binary files /dev/null and b/igniter/openpype.icns differ diff --git a/igniter/tools.py b/igniter/tools.py index ff2db6bc7e..368e9a2b3d 100644 --- a/igniter/tools.py +++ b/igniter/tools.py @@ -130,7 +130,7 @@ def validate_mongo_connection(cnx: str) -> (bool, str): mongo_args["port"] = int(port) try: - client = MongoClient(**mongo_args) + client = MongoClient(cnx) client.server_info() client.close() except ServerSelectionTimeoutError as e: diff --git a/pyproject.toml b/pyproject.toml index 12b9c4446d..88c977cd99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "OpenPype" version = "3.0.0-beta2" -description = "Multi-platform open-source pipeline built around the Avalon platform, expanding it with extra features and integrations." +description = "Open VFX and Animation pipeline with support." authors = ["OpenPype Team "] license = "MIT License" homepage = "https://openpype.io" diff --git a/setup.py b/setup.py index fd589e5251..c096befa34 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,8 @@ install_requires = [ "googleapiclient", "httplib2", # Harmony implementation - "filecmp" + "filecmp", + "dns" ] includes = [] @@ -69,7 +70,11 @@ if sys.platform == "win32": "pythoncom" ]) -build_options = dict( + +icon_path = openpype_root / "igniter" / "openpype.ico" +mac_icon_path = openpype_root / "igniter" / "openpype.icns" + +build_exe_options = dict( packages=install_requires, includes=includes, excludes=excludes, @@ -78,13 +83,16 @@ build_options = dict( optimize=0 ) -icon_path = openpype_root / "igniter" / "openpype.ico" +bdist_mac_options = dict( + bundle_name="OpenPype", + iconfile=mac_icon_path +) executables = [ - Executable("start.py", base=None, - target_name="openpype_console", icon=icon_path.as_posix()), Executable("start.py", base=base, - target_name="openpype_gui", icon=icon_path.as_posix()) + target_name="openpype_gui", icon=icon_path.as_posix()), + Executable("start.py", base=None, + target_name="openpype_console", icon=icon_path.as_posix()) ] setup( @@ -93,7 +101,8 @@ setup( description="Ultimate pipeline", cmdclass={"build_sphinx": BuildDoc}, options={ - "build_exe": build_options, + "build_exe": build_exe_options, + "bdist_mac": bdist_mac_options, "build_sphinx": { "project": "OpenPype", "version": __version__, diff --git a/start.py b/start.py index a2a03f112c..0d4addf59f 100644 --- a/start.py +++ b/start.py @@ -115,6 +115,7 @@ else: os.path.join(OPENPYPE_ROOT, "dependencies") ) sys.path.append(frozen_libs) + sys.path.insert(0, OPENPYPE_ROOT) # add stuff from `/dependencies` to PYTHONPATH. pythonpath = os.getenv("PYTHONPATH", "") paths = pythonpath.split(os.pathsep) diff --git a/tools/build.ps1 b/tools/build.ps1 index 412bb111c1..5283ee4754 100644 --- a/tools/build.ps1 +++ b/tools/build.ps1 @@ -121,6 +121,10 @@ catch { Exit-WithCode 1 } +Write-Host ">>> " -NoNewLine -ForegroundColor green +Write-Host "Making sure submodules are up-to-date ..." +git submodule update --init --recursive + Write-Host ">>> " -NoNewline -ForegroundColor green Write-Host "Building OpenPype [ " -NoNewline -ForegroundColor white Write-host $openpype_version -NoNewline -ForegroundColor green diff --git a/tools/build.sh b/tools/build.sh index b95e2969c4..d0593a2b2f 100755 --- a/tools/build.sh +++ b/tools/build.sh @@ -157,10 +157,33 @@ main () { install_poetry || { echo -e "${BIRed}!!!${RST} Poetry installation failed"; return; } fi + echo -e "${BIGreen}>>>${RST} Making sure submodules are up-to-date ..." + git submodule update --init --recursive + echo -e "${BIGreen}>>>${RST} Building ..." - poetry run python3 "$openpype_root/setup.py" build > "$openpype_root/build/build.log" || { echo -e "${BIRed}!!!${RST} Build failed, see the build log."; return; } + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + poetry run python3 "$openpype_root/setup.py" build > "$openpype_root/build/build.log" || { echo -e "${BIRed}!!!${RST} Build failed, see the build log."; return; } + elif [[ "$OSTYPE" == "darwin"* ]]; then + poetry run python3 "$openpype_root/setup.py" bdist_mac > "$openpype_root/build/build.log" || { echo -e "${BIRed}!!!${RST} Build failed, see the build log."; return; } + fi poetry run python3 "$openpype_root/tools/build_dependencies.py" + if [[ "$OSTYPE" == "darwin"* ]]; then + # fix code signing issue + codesign --remove-signature "$openpype_root/build/OpenPype.app/Contents/MacOS/lib/Python" + if command -v create-dmg > /dev/null 2>&1; then + create-dmg \ + --volname "OpenPype Installer" \ + --window-pos 200 120 \ + --window-size 600 300 \ + --app-drop-link 100 50 \ + "$openpype_root/build/OpenPype-Installer.dmg" \ + "$openpype_root/build/OpenPype.app" + else + echo -e "${BIYellow}!!!${RST} ${BIWhite}create-dmg${RST} command is not available." + fi + fi + echo -e "${BICyan}>>>${RST} All done. You will find OpenPype and build log in \c" echo -e "${BIWhite}$openpype_root/build${RST} directory." } diff --git a/tools/build_dependencies.py b/tools/build_dependencies.py index e49e930a70..fb52e2b5fd 100644 --- a/tools/build_dependencies.py +++ b/tools/build_dependencies.py @@ -22,6 +22,7 @@ import os import sys import site from distutils.util import get_platform +import platform from pathlib import Path import shutil import blessed @@ -76,7 +77,14 @@ _print(f"Working with: {site_pkg}", 2) build_dir = "exe.{}-{}".format(get_platform(), sys.version[0:3]) # create full path -build_dir = Path(os.path.dirname(__file__)).parent / "build" / build_dir +if platform.system().lower() == "darwin": + build_dir = Path(os.path.dirname(__file__)).parent.joinpath( + "build", + "OpenPype.app", + "Contents", + "MacOS") +else: + build_dir = Path(os.path.dirname(__file__)).parent / "build" / build_dir _print(f"Using build at {build_dir}", 2) if not build_dir.exists(): diff --git a/tools/create_env.ps1 b/tools/create_env.ps1 index 44e1799be8..e72e98e04b 100644 --- a/tools/create_env.ps1 +++ b/tools/create_env.ps1 @@ -133,7 +133,7 @@ if (-not (Test-Path -PathType Leaf -Path "$($openpype_root)\poetry.lock")) { Write-Host ">>> " -NoNewline -ForegroundColor green Write-Host "Installing virtual environment from lock." } -& poetry install $poetry_verbosity +& poetry install --no-root $poetry_verbosity if ($LASTEXITCODE -ne 0) { Write-Host "!!! " -ForegroundColor yellow -NoNewline Write-Host "Poetry command failed." diff --git a/tools/create_env.sh b/tools/create_env.sh index 7bdb8503fd..04414ddea5 100755 --- a/tools/create_env.sh +++ b/tools/create_env.sh @@ -160,7 +160,7 @@ main () { echo -e "${BIGreen}>>>${RST} Installing dependencies ..." fi - poetry install $poetry_verbosity || { echo -e "${BIRed}!!!${RST} Poetry environment installation failed"; return; } + poetry install --no-root $poetry_verbosity || { echo -e "${BIRed}!!!${RST} Poetry environment installation failed"; return; } echo -e "${BIGreen}>>>${RST} Cleaning cache files ..." clean_pyc diff --git a/tools/run_mongo.sh b/tools/run_mongo.sh index 1c788abcaf..8c94fcf881 100755 --- a/tools/run_mongo.sh +++ b/tools/run_mongo.sh @@ -82,3 +82,4 @@ main () { echo -e "${BIGreen}>>>${RST} Detached to background." } +main