Skip to content

Commit 3f8b21b

Browse files
committed
fix: reject duplicate adaptor wheels before submission
Signed-off-by: Karthik Bekal Pattathana <133984042+karthikbekalp@users.noreply.github.com>
1 parent 6e975fe commit 3f8b21b

2 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/deadline/cinema4d_submitter/cinema4d_render_submitter.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from .font_utils import FONTS_DIR, get_font_manager_environment, scene_has_fonts
4343
from .platform_utils import is_macos, is_windows
4444
from .scene import Animation, Scene, get_renderer_warning
45+
from .setup_adaptor_wheels import _find_wheels
4546
from .style import C4D_STYLE
4647
from .takes import TakeSelection
4748
from .template_timeout_patcher import add_timeouts_to_job_template
@@ -263,19 +264,13 @@ def _get_adaptor_override_environment(wheels_path: Path) -> dict[str, Any]:
263264
f"directory does not exist:\n{wheels_path}"
264265
)
265266

266-
wheels_path_package_names = {path.name.split("-", 1)[0] for path in wheels_path.glob("*.whl")}
267-
expected_package_names = {
268-
"openjd_adaptor_runtime",
269-
"deadline",
270-
"deadline_cloud_for_cinema_4d",
271-
}
272-
if wheels_path_package_names != expected_package_names:
267+
try:
268+
_find_wheels(wheels_path)
269+
except RuntimeError as exc:
273270
raise RuntimeError(
274271
"The Developer Option 'Include Adaptor Wheels' is enabled, but the wheels "
275-
"directory contains the wrong wheels:\n"
276-
f"Expected: {expected_package_names}\n"
277-
f"Actual: {wheels_path_package_names}"
278-
)
272+
f"directory contains the wrong wheels:\n{exc}"
273+
) from exc
279274

280275
with open(Path(__file__).parent / "adaptor_override_environment.yaml") as file:
281276
override_environment = yaml.safe_load(file)

test/unit/deadline_submitter_for_cinema4d/test_adaptor_override.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ def test_get_adaptor_override_environment_rejects_missing_directory(tmp_path):
6666
_get_adaptor_override_environment(wheels_dir)
6767

6868

69+
def test_get_adaptor_override_environment_rejects_duplicate_package_wheels(tmp_path):
70+
wheels_dir = tmp_path / "wheels"
71+
_create_wheels(wheels_dir)
72+
(wheels_dir / "deadline_cloud_for_cinema_4d-0.12.2-py3-none-any.whl").touch()
73+
74+
with pytest.raises(RuntimeError, match="Expected exactly one wheel"):
75+
_get_adaptor_override_environment(wheels_dir)
76+
77+
6978
def test_find_wheels_requires_exact_expected_set(tmp_path):
7079
wheels_dir = tmp_path / "wheels"
7180
_create_wheels(wheels_dir)

0 commit comments

Comments
 (0)