[core] Add default relative paths to the command line variables

Add 2 default entries to the command line variables:
- `nodeCacheFolder`, which contains the location of the cache folder
- `nodeSourceCodeFolder`, which contains the location of the file
describing the node
This commit is contained in:
Candice Bentéjac 2025-01-08 18:20:59 +01:00
parent 40fd46d476
commit 6cbb97d9a8
2 changed files with 15 additions and 4 deletions

View file

@ -758,6 +758,8 @@ class BaseNode(BaseObject):
""" Generate command variables using input attributes and resolved output attributes names and values. """
self._cmdVars["uid"] = self._uid
self._cmdVars["nodeCacheFolder"] = self.internalFolder
self._cmdVars["nodeSourceCodeFolder"] = self.sourceCodeFolder
# Evaluate input params
for name, attr in self._attributes.objects.items():
@ -1022,8 +1024,10 @@ class BaseNode(BaseObject):
# Update command variables / output attributes
self._cmdVars = {
'cache': cacheDir or self.graph.cacheDir,
'nodeType': self.nodeType,
"cache": cacheDir or self.graph.cacheDir,
"nodeType": self.nodeType,
"nodeCacheFolder": self._internalFolder,
"nodeSourceCodeFolder": self.sourceCodeFolder
}
self._computeUid()
self._buildCmdVars()
@ -1445,7 +1449,7 @@ class Node(BaseNode):
self.packageName = self.nodeDesc.packageName
self.packageVersion = self.nodeDesc.packageVersion
self._internalFolder = self.nodeDesc.internalFolder
self._internalFolder = "{cache}/{nodeType}/{uid}"
self._sourceCodeFolder = self.nodeDesc.sourceCodeFolder
for attrDesc in self.nodeDesc.inputs: