Last active
July 17, 2019 23:59
-
-
Save KelSolaar/f930e8c35226fe7e090d9de3d4ffa710 to your computer and use it in GitHub Desktop.
ociolutimage - Docker Wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
RUN apt-get update | |
RUN apt-get install -y \ | |
build-essential \ | |
git \ | |
freeglut3-dev \ | |
libglew-dev \ | |
libilmbase-dev \ | |
libopenimageio-dev \ | |
libxmu-dev \ | |
libxi-dev \ | |
python2.7 \ | |
python-dev \ | |
wget | |
RUN wget https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-Linux-x86_64.sh && \ | |
mkdir /home/CMake && \ | |
sh cmake-3.14.0-Linux-x86_64.sh -- --skip-license --prefix=/home/CMake && \ | |
rm cmake-3.14.0-Linux-x86_64.sh | |
ENV PATH="/home/CMake/bin:${PATH}" | |
RUN git clone https://github.com/imageworks/OpenColorIO.git /home/OpenColorIO | |
RUN mkdir /home/OpenColorIO/build | |
WORKDIR /home/OpenColorIO/build | |
RUN cmake .. -DCMAKE_INSTALL_PREFIX=../install \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DOCIO_BUILD_TESTS=OFF \ | |
-DOCIO_BUILD_GPU_TESTS=OFF \ | |
-DOCIO_BUILD_DOCS=OFF \ | |
-DOCIO_WARNING_AS_ERROR=ON \ | |
-DOCIO_USE_SSE=OFF && \ | |
cmake --build . --target install | |
ENV PATH="/home/OpenColorIO/install/bin:${PATH}" | |
ENV LD_LIBRARY_PATH="/home/OpenColorIO/install/lib:${LD_LIBRARY_PATH}" | |
WORKDIR /tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
ociolutimage - Docker Wrapper | |
============================= | |
A wrapper to invoke *ociolutimage* from a Docker container. | |
""" | |
import os | |
import subprocess | |
import sys | |
__author__ = 'Colour Developers' | |
__copyright__ = 'Copyright (C) 2019 - Colour Developers' | |
__license__ = 'New BSD License - http://opensource.org/licenses/BSD-3-Clause' | |
__maintainer__ = 'Colour Developers' | |
__email__ = 'colour-science@googlegroups.com' | |
__status__ = 'Production' | |
__all__ = ['call_ociolutimage'] | |
def call_ociolutimage(arguments): | |
""" | |
Calls *ociolutimage* with given arguments. | |
Parameters | |
---------- | |
arguments : array_like | |
Arguments to call *ociolutimage* with. | |
Returns | |
------- | |
int | |
Error status. | |
""" | |
working_directory = os.getcwd() | |
for i, argument in enumerate(arguments): | |
if argument == '--output' and len(arguments) >= i + 1: | |
output_file = arguments[i + 1] | |
dirname = os.path.dirname(output_file) | |
working_directory = (working_directory | |
if not working_directory else dirname) | |
break | |
for i, argument in enumerate(arguments): | |
arguments[i] = argument.replace('{0}/'.format(working_directory), '') | |
command = ( | |
'docker run -it --rm -v {0}:/tmp -w /tmp opencolorio ociolutimage {1}'. | |
format(working_directory, ' '.join(arguments)).split(' ')) | |
return subprocess.call(command) | |
if __name__ == '__main__': | |
sys.exit(call_ociolutimage(sys.argv[1:])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment