From ba549be1a368453b02d4b23e899172aea9dfd1e1 Mon Sep 17 00:00:00 2001 From: apetrynet Date: Mon, 17 Apr 2023 14:06:17 +0200 Subject: [PATCH 1/2] Added "version" serializable field to the PythonPlugin class. The version number is defined in the manifest. Signed-off-by: apetrynet --- docs/tutorials/otio-serialized-schema-only-fields.md | 5 +++++ docs/tutorials/otio-serialized-schema.md | 5 +++++ .../opentimelineio/plugins/python_plugin.py | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/docs/tutorials/otio-serialized-schema-only-fields.md b/docs/tutorials/otio-serialized-schema-only-fields.md index 6c70a0bf0..32cad9f44 100644 --- a/docs/tutorials/otio-serialized-schema-only-fields.md +++ b/docs/tutorials/otio-serialized-schema-only-fields.md @@ -28,6 +28,7 @@ parameters: - *filepath* - *name* - *suffixes* +- *version* ## Module: opentimelineio.core @@ -78,6 +79,7 @@ parameters: parameters: - *filepath* - *name* +- *version* ## Module: opentimelineio.media_linker @@ -86,6 +88,7 @@ parameters: parameters: - *filepath* - *name* +- *version* ## Module: opentimelineio.opentime @@ -125,6 +128,7 @@ parameters: parameters: - *filepath* - *name* +- *version* ## Module: opentimelineio.schema @@ -280,3 +284,4 @@ parameters: parameters: - *filepath* - *name* +- *version* diff --git a/docs/tutorials/otio-serialized-schema.md b/docs/tutorials/otio-serialized-schema.md index d109d14fd..f7e007582 100644 --- a/docs/tutorials/otio-serialized-schema.md +++ b/docs/tutorials/otio-serialized-schema.md @@ -53,6 +53,7 @@ parameters: - *filepath*: Absolute path or relative path to adapter module from location of json. - *name*: Adapter name. - *suffixes*: File suffixes associated with this adapter. +- *version*: Version number of plugin defined in manifest. ## Module: opentimelineio.core @@ -158,6 +159,7 @@ None parameters: - *filepath*: Absolute path or relative path to adapter module from location of json. - *name*: Adapter name. +- *version*: Version number of plugin defined in manifest. ## Module: opentimelineio.media_linker @@ -174,6 +176,7 @@ None parameters: - *filepath*: Absolute path or relative path to adapter module from location of json. - *name*: Adapter name. +- *version*: Version number of plugin defined in manifest. ## Module: opentimelineio.opentime @@ -271,6 +274,7 @@ A class of plugin that is encoded in a python module, exposed via a parameters: - *filepath*: Absolute path or relative path to adapter module from location of json. - *name*: Adapter name. +- *version*: Version number of plugin defined in manifest. ## Module: opentimelineio.schema @@ -675,3 +679,4 @@ None parameters: - *filepath*: Absolute path or relative path to adapter module from location of json. - *name*: Adapter name. +- *version*: Version number of plugin defined in manifest. diff --git a/src/py-opentimelineio/opentimelineio/plugins/python_plugin.py b/src/py-opentimelineio/opentimelineio/plugins/python_plugin.py index 7a5d3be27..77aa25abc 100644 --- a/src/py-opentimelineio/opentimelineio/plugins/python_plugin.py +++ b/src/py-opentimelineio/opentimelineio/plugins/python_plugin.py @@ -61,6 +61,7 @@ def __init__( core.SerializableObject.__init__(self) self.name = name self.filepath = filepath + self.version = None self._json_path = None self._module = None @@ -73,6 +74,13 @@ def __init__( " json." ) ) + version = core.serializable_field( + "version", + str, + doc=( + "Version number of plugin defined in manifest." + ) + ) def plugin_info_map(self): """Returns a map with information about the plugin.""" From f8e0c8123a0a0a9ed90bf7396b27ce9bbb31f299 Mon Sep 17 00:00:00 2001 From: apetrynet Date: Mon, 17 Apr 2023 14:07:44 +0200 Subject: [PATCH 2/2] Added "version" information to otiopluginfo next to adapter name. Plugins without version numbers defined in the manifest get "version: unknown" Signed-off-by: apetrynet --- src/py-opentimelineio/opentimelineio/console/otiopluginfo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/py-opentimelineio/opentimelineio/console/otiopluginfo.py b/src/py-opentimelineio/opentimelineio/console/otiopluginfo.py index ffcd1fb7f..d76d40332 100644 --- a/src/py-opentimelineio/opentimelineio/console/otiopluginfo.py +++ b/src/py-opentimelineio/opentimelineio/console/otiopluginfo.py @@ -220,7 +220,7 @@ def main(): print(" (none found)") for plug in plugins: - print(f" {plug.name}") + print(f" {plug.name} - version: {getattr(plug, 'version') or'unknown'}") try: info = plug.plugin_info_map()