mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-30 10:47:34 +02:00
[core] add utility functions to get nodes and modules versions
This commit is contained in:
parent
e776d99944
commit
95ca93c977
1 changed files with 28 additions and 0 deletions
|
@ -11,6 +11,8 @@ import uuid
|
||||||
import logging
|
import logging
|
||||||
import pkgutil
|
import pkgutil
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
from meshroom.core.submitter import BaseSubmitter
|
from meshroom.core.submitter import BaseSubmitter
|
||||||
from . import desc
|
from . import desc
|
||||||
|
|
||||||
|
@ -82,6 +84,32 @@ def loadPlugins(folder, packageName, classType):
|
||||||
return pluginTypes
|
return pluginTypes
|
||||||
|
|
||||||
|
|
||||||
|
def moduleVersion(moduleName, default=None):
|
||||||
|
""" Return the version of a module indicated with '__version__' keyword.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
moduleName (str): the name of the module to get the version of
|
||||||
|
default: the value to return if no version info is available
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: the version of the module
|
||||||
|
"""
|
||||||
|
return getattr(sys.modules[moduleName], "__version__", default)
|
||||||
|
|
||||||
|
|
||||||
|
def nodeVersion(nodeDesc, default=None):
|
||||||
|
""" Return node type version for the given node description class.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
nodeDesc (desc.Node): the node description class
|
||||||
|
default: the value to return if no version info is available
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
str: the version of the node type
|
||||||
|
"""
|
||||||
|
return moduleVersion(nodeDesc.__module__, default)
|
||||||
|
|
||||||
|
|
||||||
def registerNodeType(nodeType):
|
def registerNodeType(nodeType):
|
||||||
""" Register a Node Type based on a Node Description class.
|
""" Register a Node Type based on a Node Description class.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue