Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into feature/extract_reveiew_metadata_update
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubjezek001 committed Jan 19, 2022
2 parents 34fa94f + 45862d4 commit 91407aa
Show file tree
Hide file tree
Showing 464 changed files with 22,561 additions and 2,399 deletions.
170 changes: 83 additions & 87 deletions CHANGELOG.md

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Dockerfile.centos7
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.n
ncurses \
ncurses-devel \
qt5-qtbase-devel \
xcb-util-wm \
xcb-util-renderutil \
&& yum clean all

# we need to build our own patchelf
Expand Down Expand Up @@ -92,7 +94,8 @@ RUN source $HOME/.bashrc \
RUN cp /usr/lib64/libffi* ./build/exe.linux-x86_64-3.7/lib \
&& cp /usr/lib64/libssl* ./build/exe.linux-x86_64-3.7/lib \
&& cp /usr/lib64/libcrypto* ./build/exe.linux-x86_64-3.7/lib \
&& cp /root/.pyenv/versions/${OPENPYPE_PYTHON_VERSION}/lib/libpython* ./build/exe.linux-x86_64-3.7/lib
&& cp /root/.pyenv/versions/${OPENPYPE_PYTHON_VERSION}/lib/libpython* ./build/exe.linux-x86_64-3.7/lib \
&& cp /usr/lib64/libxcb* ./build/exe.linux-x86_64-3.7/vendor/python/PySide2/Qt/lib

RUN cd /opt/openpype \
rm -rf ./vendor/bin
49 changes: 49 additions & 0 deletions app_launcher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""Launch process that is not child process of python or OpenPype.
This is written for linux distributions where process tree may affect what
is when closed or blocked to be closed.
"""

import os
import sys
import subprocess
import json


def main(input_json_path):
"""Read launch arguments from json file and launch the process.
Expected that json contains "args" key with string or list of strings.
Arguments are converted to string using `list2cmdline`. At the end is added
`&` which will cause that launched process is detached and running as
"background" process.
## Notes
@iLLiCiT: This should be possible to do with 'disown' or double forking but
I didn't find a way how to do it properly. Disown didn't work as
expected for me and double forking killed parent process which is
unexpected too.
"""
with open(input_json_path, "r") as stream:
data = json.load(stream)

# Change environment variables
env = data.get("env") or {}
for key, value in env.items():
os.environ[key] = value

# Prepare launch arguments
args = data["args"]
if isinstance(args, list):
args = subprocess.list2cmdline(args)

# Run the command as background process
shell_cmd = args + " &"
os.system(shell_cmd)
sys.exit(0)


if __name__ == "__main__":
# Expect that last argument is path to a json with launch args information
main(sys.argv[-1])
42 changes: 39 additions & 3 deletions igniter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@

os.chdir(os.path.dirname(__file__)) # for override sys.path in Deadline

from .bootstrap_repos import BootstrapRepos
from .bootstrap_repos import (
BootstrapRepos,
OpenPypeVersion
)
from .version import __version__ as version

# Store OpenPypeVersion to 'sys.modules'
# - this makes it available in OpenPype processes without modifying
# 'sys.path' or 'PYTHONPATH'
if "OpenPypeVersion" not in sys.modules:
sys.modules["OpenPypeVersion"] = OpenPypeVersion


def open_dialog():
"""Show Igniter dialog."""
Expand All @@ -22,7 +31,9 @@ def open_dialog():
if scale_attr is not None:
QtWidgets.QApplication.setAttribute(scale_attr)

app = QtWidgets.QApplication(sys.argv)
app = QtWidgets.QApplication.instance()
if not app:
app = QtWidgets.QApplication(sys.argv)

d = InstallDialog()
d.open()
Expand All @@ -43,7 +54,9 @@ def open_update_window(openpype_version):
if scale_attr is not None:
QtWidgets.QApplication.setAttribute(scale_attr)

app = QtWidgets.QApplication(sys.argv)
app = QtWidgets.QApplication.instance()
if not app:
app = QtWidgets.QApplication(sys.argv)

d = UpdateWindow(version=openpype_version)
d.open()
Expand All @@ -53,9 +66,32 @@ def open_update_window(openpype_version):
return version_path


def show_message_dialog(title, message):
"""Show dialog with a message and title to user."""
if os.getenv("OPENPYPE_HEADLESS_MODE"):
print("!!! Can't open dialog in headless mode. Exiting.")
sys.exit(1)
from Qt import QtWidgets, QtCore
from .message_dialog import MessageDialog

scale_attr = getattr(QtCore.Qt, "AA_EnableHighDpiScaling", None)
if scale_attr is not None:
QtWidgets.QApplication.setAttribute(scale_attr)

app = QtWidgets.QApplication.instance()
if not app:
app = QtWidgets.QApplication(sys.argv)

dialog = MessageDialog(title, message)
dialog.open()

app.exec_()


__all__ = [
"BootstrapRepos",
"open_dialog",
"open_update_window",
"show_message_dialog",
"version"
]
Loading

0 comments on commit 91407aa

Please sign in to comment.