Skip to content

Commit

Permalink
Load entrypoint plugins before builtin and contrib.
Browse files Browse the repository at this point in the history
Allows for overriding builtin plugins via entrypoint method.

Signed-off-by: Mark Reid <[email protected]>
  • Loading branch information
markreidvfx committed Aug 29, 2022
1 parent bb49bed commit a09effd
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/py-opentimelineio/opentimelineio/plugins/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ def load_manifest():
The order of loading (and precedence) is:
1. manifests specfied via the ``OTIO_PLUGIN_MANIFEST_PATH`` variable
2. builtin plugin manifest
3. contrib plugin manifest
4. ``setuptools.pkg_resources`` based plugin manifests
1. Manifests specified via the ``OTIO_PLUGIN_MANIFEST_PATH`` variable
2. Entrypoint based plugin manifests
3. Builtin plugin manifest
4. Contrib plugin manifest
"""

result = Manifest()
Expand Down Expand Up @@ -242,22 +242,6 @@ def load_manifest():
plugin_manifest = manifest_from_file(builtin_manifest_path)
result.extend(plugin_manifest)

# the contrib plugin manifest (located in the opentimelineio_contrib package)
try:
import opentimelineio_contrib as otio_c

contrib_manifest_path = os.path.join(
os.path.dirname(inspect.getsourcefile(otio_c)),
"adapters",
"contrib_adapters.plugin_manifest.json"
)
if os.path.abspath(contrib_manifest_path) not in result.source_files:
contrib_manifest = manifest_from_file(contrib_manifest_path)
result.extend(contrib_manifest)

except ImportError:
pass

# setuptools.pkg_resources based plugins
if pkg_resources:
for plugin in pkg_resources.iter_entry_points(
Expand Down Expand Up @@ -324,6 +308,22 @@ def load_manifest():
# available?
pass

# the contrib plugin manifest (located in the opentimelineio_contrib package)
try:
import opentimelineio_contrib as otio_c

contrib_manifest_path = os.path.join(
os.path.dirname(inspect.getsourcefile(otio_c)),
"adapters",
"contrib_adapters.plugin_manifest.json"
)
if os.path.abspath(contrib_manifest_path) not in result.source_files:
contrib_manifest = manifest_from_file(contrib_manifest_path)
result.extend(contrib_manifest)

except ImportError:
pass

# force the schemadefs to load and add to schemadef module namespace
for s in result.schemadefs:
s.module()
Expand Down

0 comments on commit a09effd

Please sign in to comment.