Collect Mocha executable paths.
CollectMochaPaths
Bases: ContextPlugin
Collect Mocha Pro project.
Source code in client/ayon_mocha/plugins/publish/collect_mocha_paths.py
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 | class CollectMochaPaths(pyblish.api.ContextPlugin):
"""Collect Mocha Pro project."""
order = pyblish.api.CollectorOrder - 0.45
label = "Collect Mocha Pro executables"
hosts: ClassVar[list[str]] = ["mochapro"]
log: Logger
def process(self, context: pyblish.api.Context) -> None:
"""Process the plugin."""
project: Project = context.data["project"]
self.log.info("Collected Mocha Pro project: %s", project)
mocha_executable_path = Path(get_mocha_exec_name("mochapro"))
context.data["mocha_executable_path"] = mocha_executable_path
mocha_install_dir = mocha_executable_path.parent.parent
if platform.system().lower() == "windows":
mocha_python_path = (
mocha_install_dir / "python" / "python.exe")
mocha_exporter_path = (
mocha_install_dir / "python" / "mochaexport.py")
elif platform.system().lower() == "darwin":
mocha_python_path = (
mocha_install_dir / "python3")
mocha_exporter_path = (
mocha_install_dir / "mochaexport.py")
elif platform.system().lower() == "linux":
mocha_python_path = (
mocha_install_dir / "python" / "bin" / "python3")
mocha_exporter_path = (
mocha_install_dir / "python" / "mochaexport.py")
else:
msg = f"Unsupported platform: {platform.system()}"
raise NotImplementedError(msg)
context.data["mocha_python_path"] = mocha_python_path
context.data["mocha_exporter_path"] = mocha_exporter_path
self.log.info("Collected Mocha Pro executable path: %s",
mocha_executable_path)
self.log.info("Collected Mocha Pro python executable path: %s",
mocha_python_path)
self.log.info("Collected Mocha Pro python export script path: %s",
mocha_exporter_path)
|
process(context)
Process the plugin.
Source code in client/ayon_mocha/plugins/publish/collect_mocha_paths.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 | def process(self, context: pyblish.api.Context) -> None:
"""Process the plugin."""
project: Project = context.data["project"]
self.log.info("Collected Mocha Pro project: %s", project)
mocha_executable_path = Path(get_mocha_exec_name("mochapro"))
context.data["mocha_executable_path"] = mocha_executable_path
mocha_install_dir = mocha_executable_path.parent.parent
if platform.system().lower() == "windows":
mocha_python_path = (
mocha_install_dir / "python" / "python.exe")
mocha_exporter_path = (
mocha_install_dir / "python" / "mochaexport.py")
elif platform.system().lower() == "darwin":
mocha_python_path = (
mocha_install_dir / "python3")
mocha_exporter_path = (
mocha_install_dir / "mochaexport.py")
elif platform.system().lower() == "linux":
mocha_python_path = (
mocha_install_dir / "python" / "bin" / "python3")
mocha_exporter_path = (
mocha_install_dir / "python" / "mochaexport.py")
else:
msg = f"Unsupported platform: {platform.system()}"
raise NotImplementedError(msg)
context.data["mocha_python_path"] = mocha_python_path
context.data["mocha_exporter_path"] = mocha_exporter_path
self.log.info("Collected Mocha Pro executable path: %s",
mocha_executable_path)
self.log.info("Collected Mocha Pro python executable path: %s",
mocha_python_path)
self.log.info("Collected Mocha Pro python export script path: %s",
mocha_exporter_path)
|