Commit graph

26 commits

Author SHA1 Message Date
Candice Bentéjac
3d2dfcb91e [core] Simplify access to commands' prefix and suffix 2025-06-16 18:01:06 +02:00
Candice Bentéjac
102bb7f8ef [core] plugins: Correctly resolve Rez environment for processes 2025-06-16 14:43:53 +02:00
Candice Bentéjac
3e6948d8e3 [core] plugins: Simplify the types of ProcessEnv objects
Instead of a distinguishing the type of `DirTreeProcessEnv`, simply
use it whenever the process environment differs from rez.
2025-06-16 09:50:43 +01:00
Candice Bentéjac
5b0c1b6719 [core] plugins: Improve constructors for DirTree/RezProcessEnv 2025-06-16 09:50:42 +01:00
Candice Bentéjac
0efc6c3d2f [core] plugins: Add direct accessor for the process env dictionary 2025-06-16 09:50:41 +01:00
Candice Bentéjac
7fc3727c7b [core] plugins: Add factory method to generate a ProcessEnv object 2025-06-16 09:50:40 +01:00
Candice Bentéjac
a8d2747427 [core] plugins: Add backbone for RezProcessEnv
The command's prefix and suffix are correctly set, but Meshroom still
needs to be injected to the list of rez packages in order to be available
in the `PYTHONPATH`.
2025-06-16 09:50:39 +01:00
Candice Bentéjac
dc0059132f [core] plugins: Add class for DirTreeProcessEnv
This class handles processes without a specific environment as well
as those using Conda or a VirtualEnv.
2025-06-16 09:50:39 +01:00
Candice Bentéjac
210d1fba4e [core] plugins: Make ProcessEnv a generic parent class
More specific classes will inherit from it.
2025-06-16 09:50:39 +01:00
Candice Bentéjac
97f2e0f198 [core] plugins: Add ProcessEnvType enum class 2025-06-16 09:50:38 +01:00
Candice Bentéjac
3857daa4e4 [core] desc.node: Add reference to containing plugin in desc.BaseNode 2025-06-16 09:50:38 +01:00
Candice Bentéjac
c58cf99920 [core] plugins: reload: Return a bool depending on the reloading status
If the plugin has successfully been reloaded, return `True`. If it has
not been reloaded for any reason (either an error or because no
modification has been made to it since it has been loaded last), then
return `False`.
2025-06-06 17:53:38 +02:00
Candice Bentéjac
91e753c114 [core] plugins: Handle corner cases when reloading nodes 2025-06-05 16:12:32 +02:00
Candice Bentéjac
a19c306cf3 [core] plugins: Remove register/unregisterPlugin methods
Remove the methods and perform the registration/unregistration directly
within the functions that called them. This simplifies the code and
prevents ambiguity between the different functions.
2025-06-05 14:40:14 +02:00
Candice Bentéjac
424abbff82 [core] plugins: Check NodePlugin's timestamp before reloading it
When calling the `reload()` method for `NodePlugins`, we now check that
the timestamp of the node's description file doesn't match with the
timestamp of that same file when the `NodePlugin` was created. If it
does match, then nothing happens during the `reload()`.
2025-06-05 14:40:14 +02:00
Candice Bentéjac
5bc09c8847 [core] plugins: Add a method to reload a NodePlugin
Additionnally, add a new error status to distinguish an error during
the registration of the plugin (`LOADING_ERROR`) and an error when
the module itself is reloaded (through the `reload` function from
importlib).
2025-06-05 14:40:13 +02:00
Candice Bentéjac
b3ee2ad329 [core] plugins: Add new methods to the manager to manipulate plugins 2025-06-05 14:40:12 +02:00
Candice Bentéjac
a8a54f67fb [core] plugins: Support finding unregistered nodes in plugins
A `NodePlugin` may be part of a `Plugin` even if it has not been
registered. `containsNode` allows to check whether a `NodePlugin` is
contained within a `Plugin`, and `belongsToPlugin`
2025-06-05 14:40:11 +02:00
Candice Bentéjac
98d90dae81 [core] plugins: Rename getNodePlugin... to getRegisteredNodePlugin...
This prevents ambiguities between `NodePlugin` objects that have been
registered (and are thus instantiable) and those that belong to `Plugin`
objects but have not been registered.
2025-06-05 14:40:11 +02:00
Candice Bentéjac
56eebe4caf [core] plugins: Add templates handling in the Plugin class
Templates that are available for a plugin are detected and gathered
upon the plugin's creation.
2025-06-05 14:40:07 +02:00
Candice Bentéjac
836a351cc9 [core] plugins: Add a NodePluginManager class
The `NodePluginManager` class manages is used to load, manage,
and register plugins and nodes.
2025-06-05 14:40:06 +02:00
Candice Bentéjac
63e01d43bf [core] plugins: Add working NodePlugin class to represent nodes 2025-06-05 14:40:06 +02:00
Candice Bentéjac
fa3cb8c4d6 [core] plugins: Move validateNodeDesc from __init__.py to plugins.py
The validation of the node descriptions will be handled directly within
the `NodePlugin` objects and there is thus no need for this method to
exist outside of plugins.py.
2025-06-05 14:40:06 +02:00
Candice Bentéjac
1531e11b83 [core] plugins: Add NodePluginStatus enum for NodePlugin objects 2025-06-05 14:40:05 +02:00
Candice Bentéjac
f6694022a3 [core] plugins: Add a Plugin class that contains a set of nodes
A `Plugin` object contains a collection of nodes, represented as
`NodePlugin` objects. This commit adds the implementation of the `Plugin`
class with the methods to add and remove `NodePlugins`, as well as an
empty class for the `NodePlugin` objects themselves.
2025-06-05 14:40:05 +02:00
Candice Bentéjac
b56420318d [core] Add ProcessEnv class in new plugins module
Add a new module named `plugins` with a `ProcessEnv` class which
contains the paths describing the environment needed for the plugin's
(node's) process.
2025-06-05 14:38:54 +02:00