Skip to content

Commit

Permalink
Make 'contrib' installed by default. (#235)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
ssteinbach authored Feb 22, 2018
1 parent 17791b4 commit 06f7d1d
Show file tree
Hide file tree
Showing 33 changed files with 74 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test-core: python-version

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

python-version:
@python --version
Expand Down
27 changes: 26 additions & 1 deletion opentimelineio/plugins/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"""Implementation of an adapter registry system for OTIO."""

import os
import inspect

from .. import (
core,
Expand Down Expand Up @@ -120,16 +121,40 @@ def load_manifest():
# build the manifest of adapters, starting with builtin adapters
result = manifest_from_file(
os.path.join(
os.path.dirname(os.path.dirname(__file__)),
os.path.dirname(os.path.dirname(inspect.getsourcefile(core))),
"adapters",
"builtin_adapters.plugin_manifest.json"
)
)

# layer contrib plugins after built in ones
try:
import opentimelineio_contrib as otio_c

contrib_manifest = manifest_from_file(
os.path.join(
os.path.dirname(inspect.getsourcefile(otio_c)),
"adapters",
"contrib_adapters.plugin_manifest.json"
)
)
result.adapters.extend(contrib_manifest.adapters)
result.media_linkers.extend(contrib_manifest.media_linkers)
except ImportError:
pass

# read local adapter manifests, if they exist
_local_manifest_path = os.environ.get("OTIO_PLUGIN_MANIFEST_PATH", None)
if _local_manifest_path is not None:
for json_path in _local_manifest_path.split(":"):
if not os.path.exists(json_path):
# XXX: In case error reporting is requested
# print(
# "Warning: OpenTimelineIO cannot access path '{}' from "
# "$OTIO_PLUGIN_MANIFEST_PATH".format(json_path)
# )
continue

LOCAL_MANIFEST = manifest_from_file(json_path)
result.adapters.extend(LOCAL_MANIFEST.adapters)
result.media_linkers.extend(LOCAL_MANIFEST.media_linkers)
Expand Down
32 changes: 32 additions & 0 deletions opentimelineio_contrib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env python
#
# Copyright 2018 Pixar Animation Studios
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
# 6. Trademarks. This License does not grant permission to use the trade
# names, trademarks, service marks, or product names of the Licensor
# and its affiliates, except as required to comply with Section 4(c) of
# the License and to reproduce the content of the NOTICE file.
#
# You may obtain a copy of the Apache License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Apache License with the above modification is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the Apache License for the specific
# language governing permissions and limitations under the Apache License.
#

"""Unsupported contrib code for OpenTimelineIO."""

# flake8: noqa

from . import (
adapters
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Makefile for the contrib area

export PYTHONPATH:=../../
export OTIO_PLUGIN_MANIFEST_PATH:=contrib_adapters.plugin_manifest.json
TEST_ARGS=

ifeq ($(VERBOSE), 1)
Expand Down
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ def test_ale_read2(self):

def test_ale_roundtrip(self):
ale_path = EXAMPLE_PATH
original = open(ale_path, "r").read()
collection = otio.adapters.read_from_string(original, "ale")
output = otio.adapters.write_to_string(collection, "ale")
self.maxDiff = None
self.assertMultiLineEqual(original, output)

with open(ale_path, 'r') as fi:
original = fi.read()
collection = otio.adapters.read_from_string(original, "ale")
output = otio.adapters.write_to_string(collection, "ale")
self.maxDiff = None
self.assertMultiLineEqual(original, output)


if __name__ == '__main__':
Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,18 @@
'opentimelineio.core',
'opentimelineio.schema',
'opentimelineio.plugins',
'opentimelineio_contrib',
'opentimelineio_contrib.adapters',
'opentimelineview'
],

package_data={
'opentimelineio': ['adapters/builtin_adapters.plugin_manifest.json']
'opentimelineio': [
'adapters/builtin_adapters.plugin_manifest.json',
],
'opentimelineio_contrib': [
'adapters/contrib_adapters.plugin_manifest.json',
]
},

scripts=[
Expand Down

0 comments on commit 06f7d1d

Please sign in to comment.