Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
Merge branch 'feature/addVersions' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mfe committed Dec 30, 2013
2 parents 0f8a251 + 83491ce commit 33bedbd
Show file tree
Hide file tree
Showing 16 changed files with 144 additions and 3 deletions.
15 changes: 15 additions & 0 deletions lutLab/ext_1d_lut.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import argparse
from utils.ocio_helper import (
OCIO_3D_LUTS_FORMATS, create_ocio_processor, is_3d_lut
Expand All @@ -14,6 +15,8 @@

from scipy.interpolate import PchipInterpolator
import numpy
import sys
from utils import debug_helper


class Ext1DLutException(Exception):
Expand Down Expand Up @@ -136,6 +139,18 @@ def __get_options():
parser.add_argument("-d", "--display",
help="Display result using matplotlib",
action="store_true")
# version
parser.add_argument('-v', "--version", action='version',
version='{0} - version {1}'.format(description,
__version__))
# full version
versions = debug_helper.get_imported_modules_versions(sys.modules,
globals())
versions = '{0} - version {1}\n\n{2}'.format(description,
__version__,
versions)
parser.add_argument('-V', "--full-versions",
action=debug_helper.make_full_version_action(versions))
return parser.parse_args()

if __name__ == '__main__':
Expand Down
15 changes: 15 additions & 0 deletions lutLab/lut_to_lut.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import argparse
from utils.ocio_helper import OCIO_LUTS_FORMATS, create_ocio_processor
from utils.csp_helper import write_2d_csp_lut
Expand All @@ -14,6 +15,8 @@
from PyOpenColorIO.Constants import (
INTERP_LINEAR, INTERP_TETRAHEDRAL
)
from utils import debug_helper
import sys


class LutToLutException(Exception):
Expand Down Expand Up @@ -121,6 +124,18 @@ def __get_options():
# inverse
parser.add_argument("-inv", "--inverse", help="Inverse input LUT",
action="store_true")
# version
parser.add_argument('-v', "--version", action='version',
version='{0} - version {1}'.format(description,
__version__))
# full version
versions = debug_helper.get_imported_modules_versions(sys.modules,
globals())
versions = '{0} - version {1}\n\n{2}'.format(description,
__version__,
versions)
parser.add_argument('-V', "--full-versions",
action=debug_helper.make_full_version_action(versions))
return parser.parse_args()

if __name__ == '__main__':
Expand Down
17 changes: 17 additions & 0 deletions lutLab/rgb_to_xyz_matrix.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#!/usr/bin/python

""" Display RGB colorspaces to XYZ conversion matrices and their inverses
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
from utils.colors_helper import xy_to_XYZ
from utils.colorspaces import COLORSPACES
from utils.private_colorspaces import PRIVATE_COLORSPACES
import numpy
import argparse
import sys
from utils import debug_helper


class RGBToXYZMatrixException(Exception):
Expand Down Expand Up @@ -165,6 +170,18 @@ def __get_options():
type=str,
choices=['matrix', 'spimtx', 'simple'],
default='matrix')
# version
parser.add_argument('-v', "--version", action='version',
version='{0} - version {1}'.format(description,
__version__))
# full version
versions = debug_helper.get_imported_modules_versions(sys.modules,
globals())
versions = '{0} - version {1}\n\n{2}'.format(description,
__version__,
versions)
parser.add_argument('-V', "--full-versions",
action=debug_helper.make_full_version_action(versions))
return parser.parse_args()


Expand Down
2 changes: 1 addition & 1 deletion plotThatLut/plot_that_lut.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""

__version__ = "0.1"
## imports
import os
# OpenColorIO
Expand Down
2 changes: 1 addition & 1 deletion plotThatLut/plot_that_lut_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""

__version__ = "Prototype"
from os import path
import ntpath
import sys
Expand Down
15 changes: 15 additions & 0 deletions plotThatLut/ptlut.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import plot_that_lut
import argparse
from utils import debug_helper
import sys


def __get_options():
Expand Down Expand Up @@ -51,6 +54,18 @@ def __get_options():
"Samples count. Ex : {0} for a curve or {1} for a cube."
).format(plot_that_lut.DEFAULT_SAMPLE, plot_that_lut.DEFAULT_CUBE_SIZE),
default=None, type=int)
# version
parser.add_argument('-v', "--version", action='version',
version='{0} - version {1}'.format(description,
__version__))
# full version
versions = debug_helper.get_imported_modules_versions(sys.modules,
globals())
versions = '{0} - version {1}\n\n{2}'.format(description,
__version__,
versions)
parser.add_argument('-V', "--full-versions",
action=debug_helper.make_full_version_action(versions))
## return args
return parser.parse_args()

Expand Down
1 change: 1 addition & 0 deletions utils/clcc_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import datetime


Expand Down
1 change: 1 addition & 0 deletions utils/colors_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import math


Expand Down
1 change: 1 addition & 0 deletions utils/colorspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
from utils import colors_helper
from abc import ABCMeta, abstractmethod
import math
Expand Down
1 change: 1 addition & 0 deletions utils/csp_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import itertools
from utils.lut_utils import check_arrays_length

Expand Down
1 change: 1 addition & 0 deletions utils/cube_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import itertools
from utils.lut_utils import check_arrays_length

Expand Down
71 changes: 71 additions & 0 deletions utils/debug_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
""" Debug helpers
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import os
import argparse
import sys


def get_imported_modules_versions(modules, glob):
"""Return a string containing imported modules versions.
(It isn't intended to be exhautive)
Args:
modules: sys.modules
glob: globals()
Returns:
.string
"""
# Retrieve ColorPipe-tools modules
path = os.path.dirname(os.path.dirname(__file__))
res = "ColorPipe-tools modules:\n------------------------------"
for name in modules:
if (path in str(modules[name])
and "debug_helper" not in str(modules[name])):
try:
res = "{0}\n{1} - version {2}".format(res, name,
modules[name].__version__)
except AttributeError:
pass
# Retrieve "interesting" external modules
module_selection = set(modules) & set(glob)
res = "{0}\n\nExternal modules:\n------------------------------".format(res)
for name in module_selection:
if "built-in" not in name and path not in str(modules[name]):
try:
res = "{0}\n{1} - version {2}".format(res, name,
modules[name].__version__)
except AttributeError:
pass
return res


def make_full_version_action(version_text):
"""Return a multi-lines version action for argparse
Args:
version_text (str): version text to print
Returns:
.argparse.Action
"""
class FullVersionAction(argparse.Action):
def __init__(self, option_strings, dest=None, nargs=0, default=None,
required=False, type=None, metavar=None,
help=("show version number of the program and its "
"dependencies. And then exit")):
super(FullVersionAction, self).__init__(
option_strings=option_strings,
dest=dest, nargs=nargs, default=default, required=required,
metavar=metavar, type=type, help=help)

def __call__(self, parser, namespace, values, option_string=None):
print(version_text)
sys.exit()
return FullVersionAction
1 change: 1 addition & 0 deletions utils/lut_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import os


Expand Down
1 change: 1 addition & 0 deletions utils/ocio_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import os
# import OpenColorIO
from PyOpenColorIO import (
Expand Down
2 changes: 1 addition & 1 deletion utils/spi_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""

__version__ = "0.1"

class SpiHelperException(Exception):
pass
Expand Down
1 change: 1 addition & 0 deletions utils/threedl_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
__version__ = "0.1"
import math


Expand Down

0 comments on commit 33bedbd

Please sign in to comment.