-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Resolve menu.py not found error when running pip install deadlin…
…e-cloud-for-nuke -t <folder> (#165) * fix: Resolve menu.py not found error when running `pip install deadline-cloud-for-nuke -t <folder>` Signed-off-by: Cherie-Chen <[email protected]> Signed-off-by: Haejung Choi <[email protected]> --------- Signed-off-by: Cherie-Chen <[email protected]> Signed-off-by: Haejung Choi <[email protected]> Co-authored-by: Cherie-Chen <[email protected]> Co-authored-by: Haejung Choi <[email protected]>
- Loading branch information
1 parent
a0704a3
commit 82b7eb2
Showing
6 changed files
with
98 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
|
||
""" | ||
DO NOT CHANGE THIS FILE's NAME | ||
Nuke loads this "init.py" or "menu.py" when looking in its plugin folder. | ||
You can inform nuke to look in additional locations by setting via the | ||
NUKE_PATH environment variable. | ||
""" | ||
|
||
import sys | ||
import traceback | ||
import nuke | ||
import os | ||
|
||
from deadline.nuke_submitter import ( | ||
show_nuke_render_submitter_noargs, | ||
run_render_submitter_job_bundle_output_test, | ||
) | ||
|
||
|
||
def add_deadline_menu() -> None: | ||
try: | ||
menu_bar = nuke.menu("Nuke") | ||
aws_deadline_menu = menu_bar.addMenu("&AWS Deadline") | ||
aws_deadline_menu.addCommand( | ||
"Submit to Deadline Cloud", show_nuke_render_submitter_noargs, "" | ||
) | ||
# Set the environment variable DEADLINE_ENABLE_DEVELOPER_OPTIONS to "true" to get this menu. | ||
if os.environ.get("DEADLINE_ENABLE_DEVELOPER_OPTIONS", "").upper() == "TRUE": | ||
aws_deadline_menu.addCommand( | ||
"Run Nuke Submitter Job Bundle Output Tests...", | ||
run_render_submitter_job_bundle_output_test, | ||
"", | ||
) | ||
except Exception: | ||
print("Failed to load deadline.nuke_submitter. Reason:", file=sys.stderr) | ||
print(traceback.format_exc(), file=sys.stderr) | ||
|
||
|
||
add_deadline_menu() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import nuke | ||
from unittest.mock import ANY | ||
from deadline.nuke_submitter.menu import add_deadline_menu | ||
|
||
|
||
def test_add_deadline_menu_env_var_true() -> None: | ||
# GIVEN | ||
os.environ["DEADLINE_ENABLE_DEVELOPER_OPTIONS"] = "true" | ||
|
||
# WHEN | ||
add_deadline_menu() | ||
|
||
# THEN | ||
nuke.menu("Nuke").addMenu.assert_called_with("&AWS Deadline") | ||
nuke.menu("Nuke").addMenu("&AWS Deadline").addCommand.assert_called_with( | ||
"Run Nuke Submitter Job Bundle Output Tests...", ANY, ANY | ||
) | ||
|
||
|
||
def test_add_deadline_menu_env_var_false() -> None: | ||
# GIVEN | ||
os.environ["DEADLINE_ENABLE_DEVELOPER_OPTIONS"] = "false" | ||
|
||
# WHEN | ||
add_deadline_menu() | ||
|
||
# THEN | ||
nuke.menu("Nuke").addMenu.assert_called_with("&AWS Deadline") | ||
nuke.menu("Nuke").addMenu("&AWS Deadline").addCommand.assert_called_with( | ||
"Submit to Deadline Cloud", ANY, ANY | ||
) |