Skip to content

Commit 06f7d1d

Browse files
authored
Make 'contrib' installed by default. (#235)
* Make 'contrib' installed by default. - renames contrib 'opentimelineio_contrib' and installs it via the setup.py - add code in manifest.py to automatically look for the contrib manifest. - update makefile to run tests in new location * Minor fix for the ALE adapter that was causing a warning in python3.
1 parent 17791b4 commit 06f7d1d

33 files changed

+74
-9
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test-core: python-version
2424

2525
test-contrib: python-version
2626
@echo "Running Contrib tests..."
27-
@make -C contrib/adapters test VERBOSE=$(VERBOSE)
27+
@make -C opentimelineio_contrib/adapters test VERBOSE=$(VERBOSE)
2828

2929
python-version:
3030
@python --version

opentimelineio/plugins/manifest.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"""Implementation of an adapter registry system for OTIO."""
2626

2727
import os
28+
import inspect
2829

2930
from .. import (
3031
core,
@@ -120,16 +121,40 @@ def load_manifest():
120121
# build the manifest of adapters, starting with builtin adapters
121122
result = manifest_from_file(
122123
os.path.join(
123-
os.path.dirname(os.path.dirname(__file__)),
124+
os.path.dirname(os.path.dirname(inspect.getsourcefile(core))),
124125
"adapters",
125126
"builtin_adapters.plugin_manifest.json"
126127
)
127128
)
128129

130+
# layer contrib plugins after built in ones
131+
try:
132+
import opentimelineio_contrib as otio_c
133+
134+
contrib_manifest = manifest_from_file(
135+
os.path.join(
136+
os.path.dirname(inspect.getsourcefile(otio_c)),
137+
"adapters",
138+
"contrib_adapters.plugin_manifest.json"
139+
)
140+
)
141+
result.adapters.extend(contrib_manifest.adapters)
142+
result.media_linkers.extend(contrib_manifest.media_linkers)
143+
except ImportError:
144+
pass
145+
129146
# read local adapter manifests, if they exist
130147
_local_manifest_path = os.environ.get("OTIO_PLUGIN_MANIFEST_PATH", None)
131148
if _local_manifest_path is not None:
132149
for json_path in _local_manifest_path.split(":"):
150+
if not os.path.exists(json_path):
151+
# XXX: In case error reporting is requested
152+
# print(
153+
# "Warning: OpenTimelineIO cannot access path '{}' from "
154+
# "$OTIO_PLUGIN_MANIFEST_PATH".format(json_path)
155+
# )
156+
continue
157+
133158
LOCAL_MANIFEST = manifest_from_file(json_path)
134159
result.adapters.extend(LOCAL_MANIFEST.adapters)
135160
result.media_linkers.extend(LOCAL_MANIFEST.media_linkers)

opentimelineio_contrib/__init__.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2018 Pixar Animation Studios
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "Apache License")
6+
# with the following modification; you may not use this file except in
7+
# compliance with the Apache License and the following modification to it:
8+
# Section 6. Trademarks. is deleted and replaced with:
9+
#
10+
# 6. Trademarks. This License does not grant permission to use the trade
11+
# names, trademarks, service marks, or product names of the Licensor
12+
# and its affiliates, except as required to comply with Section 4(c) of
13+
# the License and to reproduce the content of the NOTICE file.
14+
#
15+
# You may obtain a copy of the Apache License at
16+
#
17+
# http://www.apache.org/licenses/LICENSE-2.0
18+
#
19+
# Unless required by applicable law or agreed to in writing, software
20+
# distributed under the Apache License with the above modification is
21+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22+
# KIND, either express or implied. See the Apache License for the specific
23+
# language governing permissions and limitations under the Apache License.
24+
#
25+
26+
"""Unsupported contrib code for OpenTimelineIO."""
27+
28+
# flake8: noqa
29+
30+
from . import (
31+
adapters
32+
)

contrib/adapters/Makefile renamed to opentimelineio_contrib/adapters/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Makefile for the contrib area
22

33
export PYTHONPATH:=../../
4-
export OTIO_PLUGIN_MANIFEST_PATH:=contrib_adapters.plugin_manifest.json
54
TEST_ARGS=
65

76
ifeq ($(VERBOSE), 1)

opentimelineio_contrib/adapters/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)