Improve paths handling on remaining occurrences.
[OpenColorIO-Configs.git] / aces_1.0.0 / python / aces_ocio / create_aces_config.py
index a18ba48..6d37f71 100755 (executable)
@@ -18,7 +18,7 @@ import sys
 # dedicated executable in a /bin directory.
 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 
-import PyOpenColorIO as OCIO
+import PyOpenColorIO as ocio
 
 import aces_ocio.create_arri_colorspaces as arri
 import aces_ocio.create_canon_colorspaces as canon
@@ -58,15 +58,15 @@ ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON = 'ACES_OCIO_CONFIGURATION_DIRECTORY'
 
 
 def set_config_default_roles(config,
-                             color_picking="",
-                             color_timing="",
-                             compositing_log="",
-                             data="",
-                             default="",
-                             matte_paint="",
-                             reference="",
-                             scene_linear="",
-                             texture_paint=""):
+                             color_picking='',
+                             color_timing='',
+                             compositing_log='',
+                             data='',
+                             default='',
+                             matte_paint='',
+                             reference='',
+                             scene_linear='',
+                             texture_paint=''):
     """
     Sets given *OCIO* configuration default roles.
 
@@ -100,23 +100,23 @@ def set_config_default_roles(config,
     """
 
     if color_picking:
-        config.setRole(OCIO.Constants.ROLE_COLOR_PICKING, color_picking)
+        config.setRole(ocio.Constants.ROLE_COLOR_PICKING, color_picking)
     if color_timing:
-        config.setRole(OCIO.Constants.ROLE_COLOR_TIMING, color_timing)
+        config.setRole(ocio.Constants.ROLE_COLOR_TIMING, color_timing)
     if compositing_log:
-        config.setRole(OCIO.Constants.ROLE_COMPOSITING_LOG, compositing_log)
+        config.setRole(ocio.Constants.ROLE_COMPOSITING_LOG, compositing_log)
     if data:
-        config.setRole(OCIO.Constants.ROLE_DATA, data)
+        config.setRole(ocio.Constants.ROLE_DATA, data)
     if default:
-        config.setRole(OCIO.Constants.ROLE_DEFAULT, default)
+        config.setRole(ocio.Constants.ROLE_DEFAULT, default)
     if matte_paint:
-        config.setRole(OCIO.Constants.ROLE_MATTE_PAINT, matte_paint)
+        config.setRole(ocio.Constants.ROLE_MATTE_PAINT, matte_paint)
     if reference:
-        config.setRole(OCIO.Constants.ROLE_REFERENCE, reference)
+        config.setRole(ocio.Constants.ROLE_REFERENCE, reference)
     if scene_linear:
-        config.setRole(OCIO.Constants.ROLE_SCENE_LINEAR, scene_linear)
+        config.setRole(ocio.Constants.ROLE_SCENE_LINEAR, scene_linear)
     if texture_paint:
-        config.setRole(OCIO.Constants.ROLE_TEXTURE_PAINT, texture_paint)
+        config.setRole(ocio.Constants.ROLE_TEXTURE_PAINT, texture_paint)
 
     return True
 
@@ -141,7 +141,7 @@ def write_config(config, config_path, sanity_check=True):
             config.sanityCheck()
         except Exception, e:
             print e
-            print "Configuration was not written due to a failed Sanity Check"
+            print 'Configuration was not written due to a failed Sanity Check'
             return
             # sys.exit()
 
@@ -165,30 +165,30 @@ def generate_OCIO_transform(transforms):
          Return value description.
     """
 
-    # print("Generating transforms")
+    # print('Generating transforms')
 
     interpolation_options = {
-        'linear': OCIO.Constants.INTERP_LINEAR,
-        'nearest': OCIO.Constants.INTERP_NEAREST,
-        'tetrahedral': OCIO.Constants.INTERP_TETRAHEDRAL
+        'linear': ocio.Constants.INTERP_LINEAR,
+        'nearest': ocio.Constants.INTERP_NEAREST,
+        'tetrahedral': ocio.Constants.INTERP_TETRAHEDRAL
     }
     direction_options = {
-        'forward': OCIO.Constants.TRANSFORM_DIR_FORWARD,
-        'inverse': OCIO.Constants.TRANSFORM_DIR_INVERSE
+        'forward': ocio.Constants.TRANSFORM_DIR_FORWARD,
+        'inverse': ocio.Constants.TRANSFORM_DIR_INVERSE
     }
 
     ocio_transforms = []
 
     for transform in transforms:
         if transform['type'] == 'lutFile':
-            ocio_transform = OCIO.FileTransform(
+            ocio_transform = ocio.FileTransform(
                 src=transform['path'],
                 interpolation=interpolation_options[
                     transform['interpolation']],
                 direction=direction_options[transform['direction']])
             ocio_transforms.append(ocio_transform)
         elif transform['type'] == 'matrix':
-            ocio_transform = OCIO.MatrixTransform()
+            ocio_transform = ocio.MatrixTransform()
             # MatrixTransform member variables can't be initialized directly.
             # Each must be set individually.
             ocio_transform.setMatrix(transform['matrix'])
@@ -202,21 +202,21 @@ def generate_OCIO_transform(transforms):
 
             ocio_transforms.append(ocio_transform)
         elif transform['type'] == 'exponent':
-            ocio_transform = OCIO.ExponentTransform()
+            ocio_transform = ocio.ExponentTransform()
             ocio_transform.setValue(transform['value'])
             ocio_transforms.append(ocio_transform)
         elif transform['type'] == 'log':
-            ocio_transform = OCIO.LogTransform(
+            ocio_transform = ocio.LogTransform(
                 base=transform['base'],
                 direction=direction_options[transform['direction']])
 
             ocio_transforms.append(ocio_transform)
         else:
-            print("Ignoring unknown transform type : %s" % transform['type'])
+            print('Ignoring unknown transform type : %s' % transform['type'])
 
     # Build a group transform if necessary
     if len(ocio_transforms) > 1:
-        transform_G = OCIO.GroupTransform()
+        transform_G = ocio.GroupTransform()
         for transform in ocio_transforms:
             transform_G.push_back(transform)
         transform = transform_G
@@ -244,22 +244,22 @@ def create_config(config_data, nuke=False):
     """
 
     # Create the config
-    config = OCIO.Config()
+    config = ocio.Config()
 
     #
     # Set config wide values
     #
-    config.setDescription("An ACES config generated from python")
-    config.setSearchPath("luts")
+    config.setDescription('An ACES config generated from python')
+    config.setSearchPath('luts')
 
     #
     # Define the reference color space
     #
     reference_data = config_data['referenceColorSpace']
-    print("Adding the reference color space : %s" % reference_data.name)
+    print('Adding the reference color space : %s' % reference_data.name)
 
     # Create a color space
-    reference = OCIO.ColorSpace(
+    reference = ocio.ColorSpace(
         name=reference_data.name,
         bitDepth=reference_data.bit_depth,
         description=reference_data.description,
@@ -276,9 +276,9 @@ def create_config(config_data, nuke=False):
     # Create the rest of the color spaces
     #
     for colorspace in sorted(config_data['colorSpaces']):
-        print("Creating new color space : %s" % colorspace.name)
+        print('Creating new color space : %s' % colorspace.name)
 
-        ocio_colorspace = OCIO.ColorSpace(
+        ocio_colorspace = ocio.ColorSpace(
             name=colorspace.name,
             bitDepth=colorspace.bit_depth,
             description=colorspace.description,
@@ -289,24 +289,24 @@ def create_config(config_data, nuke=False):
             allocationVars=colorspace.allocation_vars)
 
         if colorspace.to_reference_transforms != []:
-            print("Generating To-Reference transforms")
+            print('Generating To-Reference transforms')
             ocio_transform = generate_OCIO_transform(
                 colorspace.to_reference_transforms)
             ocio_colorspace.setTransform(
                 ocio_transform,
-                OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
+                ocio.Constants.COLORSPACE_DIR_TO_REFERENCE)
 
         if colorspace.from_reference_transforms != []:
-            print("Generating From-Reference transforms")
+            print('Generating From-Reference transforms')
             ocio_transform = generate_OCIO_transform(
                 colorspace.from_reference_transforms)
             ocio_colorspace.setTransform(
                 ocio_transform,
-                OCIO.Constants.COLORSPACE_DIR_FROM_REFERENCE)
+                ocio.Constants.COLORSPACE_DIR_FROM_REFERENCE)
 
         config.addColorSpace(ocio_colorspace)
 
-        print("")
+        print('')
 
     #
     # Define the views and displays
@@ -393,7 +393,7 @@ def generate_LUTs(odt_info,
          the reference colorspace, *ACES*.
     """
 
-    print("generateLUTs - begin")
+    print('generateLUTs - begin')
     config_data = {}
 
     #
@@ -405,7 +405,7 @@ def generate_LUTs(odt_info,
     ACES.equality_group = ''
     ACES.family = 'ACES'
     ACES.is_data = False
-    ACES.allocation_type = OCIO.Constants.ALLOCATION_LG2
+    ACES.allocation_type = ocio.Constants.ALLOCATION_LG2
     ACES.allocation_vars = [-15, 6]
 
     config_data['referenceColorSpace'] = ACES
@@ -438,25 +438,27 @@ def generate_LUTs(odt_info,
                       max_value=1.0,
                       input_scale=1.0):
         cs = ColorSpace(name)
-        cs.description = "The %s color space" % name
+        cs.description = 'The %s color space' % name
         cs.equality_group = ''
         cs.family = 'ACES'
         cs.is_data = False
 
-        ctls = [
-            '%s/ACEScc/ACEScsc.ACEScc_to_ACES.a1.0.0.ctl' % aces_CTL_directory,
-            # This transform gets back to the AP1 primaries
-            # Useful as the 1d LUT is only covering the transfer function
-            # The primaries switch is covered by the matrix below
-            '%s/ACEScg/ACEScsc.ACES_to_ACEScg.a1.0.0.ctl' % aces_CTL_directory
-        ]
-        lut = "%s_to_ACES.spi1d" % name
+        ctls = [os.path.join(aces_CTL_directory,
+                             'ACEScc',
+                             'ACEScsc.ACEScc_to_ACES.a1.0.0.ctl'),
+                # This transform gets back to the AP1 primaries
+                # Useful as the 1d LUT is only covering the transfer function
+                # The primaries switch is covered by the matrix below
+                os.path.join(aces_CTL_directory,
+                             'ACEScg',
+                             'ACEScsc.ACES_to_ACEScg.a1.0.0.ctl')]
+        lut = '%s_to_ACES.spi1d' % name
 
         # Remove spaces and parentheses
         lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
         generate_1d_LUT_from_CTL(
-            lut_directory + "/" + lut,
+            os.path.join(lut_directory, lut),
             ctls,
             lut_resolution_1d,
             'float',
@@ -494,26 +496,28 @@ def generate_LUTs(odt_info,
     #
     def create_ACESproxy(name='ACESproxy'):
         cs = ColorSpace(name)
-        cs.description = "The %s color space" % name
+        cs.description = 'The %s color space' % name
         cs.equality_group = ''
         cs.family = 'ACES'
         cs.is_data = False
 
         ctls = [
-            '%s/ACESproxy/ACEScsc.ACESproxy10i_to_ACES.a1.0.0.ctl' % (
-                aces_CTL_directory),
+            os.path.join(aces_CTL_directory,
+                         'ACESproxy',
+                         'ACEScsc.ACESproxy10i_to_ACES.a1.0.0.ctl'),
             # This transform gets back to the AP1 primaries
             # Useful as the 1d LUT is only covering the transfer function
             # The primaries switch is covered by the matrix below
-            '%s/ACEScg/ACEScsc.ACES_to_ACEScg.a1.0.0.ctl' % aces_CTL_directory
-        ]
-        lut = "%s_to_aces.spi1d" % name
+            os.path.join(aces_CTL_directory,
+                         'ACEScg',
+                         'ACEScsc.ACES_to_ACEScg.a1.0.0.ctl')]
+        lut = '%s_to_aces.spi1d' % name
 
         # Remove spaces and parentheses
         lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
         generate_1d_LUT_from_CTL(
-            lut_directory + "/" + lut,
+            os.path.join(lut_directory, lut),
             ctls,
             lut_resolution_1d,
             'uint16',
@@ -549,7 +553,7 @@ def generate_LUTs(odt_info,
     #
     def create_ACEScg(name='ACEScg'):
         cs = ColorSpace(name)
-        cs.description = "The %s color space" % name
+        cs.description = 'The %s color space' % name
         cs.equality_group = ''
         cs.family = 'ACES'
         cs.is_data = False
@@ -573,22 +577,22 @@ def generate_LUTs(odt_info,
     # ADX
     #
     def create_ADX(bit_depth=10, name='ADX'):
-        name = "%s%s" % (name, bit_depth)
+        name = '%s%s' % (name, bit_depth)
         cs = ColorSpace(name)
-        cs.description = "%s color space - used for film scans" % name
+        cs.description = '%s color space - used for film scans' % name
         cs.equality_group = ''
         cs.family = 'ADX'
         cs.is_data = False
 
         if bit_depth == 10:
-            cs.bit_depth = bit_depth = OCIO.Constants.BIT_DEPTH_UINT10
+            cs.bit_depth = bit_depth = ocio.Constants.BIT_DEPTH_UINT10
             adx_to_cdd = [1023.0 / 500.0, 0.0, 0.0, 0.0,
                           0.0, 1023.0 / 500.0, 0.0, 0.0,
                           0.0, 0.0, 1023.0 / 500.0, 0.0,
                           0.0, 0.0, 0.0, 1.0]
             offset = [-95.0 / 500.0, -95.0 / 500.0, -95.0 / 500.0, 0.0]
         elif bit_depth == 16:
-            cs.bit_depth = bit_depth = OCIO.Constants.BIT_DEPTH_UINT16
+            cs.bit_depth = bit_depth = ocio.Constants.BIT_DEPTH_UINT16
             adx_to_cdd = [65535.0 / 8000.0, 0.0, 0.0, 0.0,
                           0.0, 65535.0 / 8000.0, 0.0, 0.0,
                           0.0, 0.0, 65535.0 / 8000.0, 0.0,
@@ -655,7 +659,7 @@ def generate_LUTs(odt_info,
 
             def fit(value, from_min, from_max, to_min, to_max):
                 if from_min == from_max:
-                    raise ValueError("from_min == from_max")
+                    raise ValueError('from_min == from_max')
                 return (value - from_min) / (from_max - from_min) * (
                     to_max - to_min) + to_min
 
@@ -668,7 +672,9 @@ def generate_LUTs(odt_info,
                 data.append(cid_to_rle(x))
 
             lut = 'ADX_CID_to_RLE.spi1d'
-            write_SPI_1d(lut_directory + "/" + lut, RANGE[0], RANGE[1],
+            write_SPI_1d(os.path.join(lut_directory, lut),
+                         RANGE[0],
+                         RANGE[1],
                          data,
                          NUM_SAMPLES, 1)
 
@@ -749,21 +755,22 @@ def generate_LUTs(odt_info,
                            max_exposure=6.5,
                            lut_resolution_1d=lut_resolution_1d):
         cs = ColorSpace(name)
-        cs.description = "The %s color space" % name
+        cs.description = 'The %s color space' % name
         cs.equality_group = name
         cs.family = 'Utility'
         cs.is_data = False
 
         ctls = [
-            '%s/utilities/ACESlib.OCIO_shaper_log2_to_lin_param.a1.0.0.ctl' % (
-                aces_CTL_directory)]
-        lut = "%s_to_aces.spi1d" % name
+            os.path.join(aces_CTL_directory,
+                         'utilities',
+                         'ACESlib.OCIO_shaper_log2_to_lin_param.a1.0.0.ctl')]
+        lut = '%s_to_aces.spi1d' % name
 
         # Remove spaces and parentheses
         lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
         generate_1d_LUT_from_CTL(
-            lut_directory + "/" + lut,
+            os.path.join(lut_directory, lut),
             ctls,
             lut_resolution_1d,
             'float',
@@ -799,8 +806,8 @@ def generate_LUTs(odt_info,
                         lut_resolution_1d=1024,
                         lut_resolution_3d=64,
                         cleanup=True):
-        cs = ColorSpace("%s" % lmt_name)
-        cs.description = "The ACES Look Transform: %s" % lmt_name
+        cs = ColorSpace('%s' % lmt_name)
+        cs.description = 'The ACES Look Transform: %s' % lmt_name
         cs.equality_group = ''
         cs.family = 'Look'
         cs.is_data = False
@@ -816,8 +823,8 @@ def generate_LUTs(odt_info,
          shaper_input_scale,
          shaper_params) = shaper_info
 
-        shaper_lut = "%s_to_aces.spi1d" % shaper_name
-        if (not os.path.exists(lut_directory + "/" + shaper_lut)):
+        shaper_lut = '%s_to_aces.spi1d' % shaper_name
+        if (not os.path.exists(os.path.join(lut_directory, shaper_lut))):
             ctls = [shaper_to_ACES_CTL % aces_CTL_directory]
 
             # Remove spaces and parentheses
@@ -825,7 +832,7 @@ def generate_LUTs(odt_info,
                 ' ', '_').replace(')', '_').replace('(', '_')
 
             generate_1d_LUT_from_CTL(
-                lut_directory + "/" + shaper_lut,
+                os.path.join(lut_directory, shaper_lut),
                 ctls,
                 lut_resolution_1d,
                 'float',
@@ -850,15 +857,14 @@ def generate_LUTs(odt_info,
         if 'transformCTL' in lmt_values:
             ctls = [
                 shaper_to_ACES_CTL % aces_CTL_directory,
-                '%s/%s' % (aces_CTL_directory, lmt_values['transformCTL'])
-            ]
-            lut = "%s.%s.spi3d" % (shaper_name, lmt_name)
+                os.path.join(aces_CTL_directory, lmt_values['transformCTL'])]
+            lut = '%s.%s.spi3d' % (shaper_name, lmt_name)
 
             # Remove spaces and parentheses
             lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
             generate_3d_LUT_from_CTL(
-                lut_directory + "/" + lut,
+                os.path.join(lut_directory, lut),
                 ctls,
                 lut_resolution_3d,
                 'float',
@@ -883,17 +889,17 @@ def generate_LUTs(odt_info,
 
         if 'transformCTLInverse' in lmt_values:
             ctls = [
-                '%s/%s' % (
-                    aces_CTL_directory, odt_values['transformCTLInverse']),
+                os.path.join(aces_CTL_directory,
+                             odt_values['transformCTLInverse']),
                 shaper_from_ACES_CTL % aces_CTL_directory
             ]
-            lut = "Inverse.%s.%s.spi3d" % (odt_name, shaper_name)
+            lut = 'Inverse.%s.%s.spi3d' % (odt_name, shaper_name)
 
             # Remove spaces and parentheses
             lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
             generate_3d_LUT_from_CTL(
-                lut_directory + "/" + lut,
+                os.path.join(lut_directory, lut),
                 ctls,
                 lut_resolution_3d,
                 'half',
@@ -942,11 +948,14 @@ def generate_LUTs(odt_info,
     # Log 2 shaper name and CTL transforms bundled up
     lmt_shaper_data = [
         lmt_shaper_name,
-        '%s/utilities/ACESlib.OCIO_shaper_log2_to_lin_param.a1.0.0.ctl',
-        '%s/utilities/ACESlib.OCIO_shaper_lin_to_log2_param.a1.0.0.ctl',
+        os.path.join('%s',
+                     'utilities',
+                     'ACESlib.OCIO_shaper_log2_to_lin_param.a1.0.0.ctl'),
+        os.path.join('%s',
+                     'utilities',
+                     'ACESlib.OCIO_shaper_lin_to_log2_param.a1.0.0.ctl'),
         shaper_input_scale_generic_log2,
-        lmt_params
-    ]
+        lmt_params]
 
     sorted_LMTs = sorted(lmt_info.iteritems(), key=lambda x: x[1])
     print(sorted_LMTs)
@@ -970,8 +979,8 @@ def generate_LUTs(odt_info,
                                  lut_resolution_1d=1024,
                                  lut_resolution_3d=64,
                                  cleanup=True):
-        cs = ColorSpace("%s" % odt_name)
-        cs.description = "%s - %s Output Transform" % (
+        cs = ColorSpace('%s' % odt_name)
+        cs.description = '%s - %s Output Transform' % (
             odt_values['transformUserNamePrefix'], odt_name)
         cs.equality_group = ''
         cs.family = 'Output'
@@ -994,8 +1003,8 @@ def generate_LUTs(odt_info,
         else:
             shaper_params['legalRange'] = 0
 
-        shaper_lut = "%s_to_aces.spi1d" % shaper_name
-        if (not os.path.exists(lut_directory + "/" + shaper_lut)):
+        shaper_lut = '%s_to_aces.spi1d' % shaper_name
+        if (not os.path.exists(os.path.join(lut_directory, shaper_lut))):
             ctls = [shaper_to_ACES_CTL % aces_CTL_directory]
 
             # Remove spaces and parentheses
@@ -1003,7 +1012,7 @@ def generate_LUTs(odt_info,
                 ' ', '_').replace(')', '_').replace('(', '_')
 
             generate_1d_LUT_from_CTL(
-                lut_directory + "/" + shaper_lut,
+                os.path.join(lut_directory, shaper_lut),
                 ctls,
                 lut_resolution_1d,
                 'float',
@@ -1029,7 +1038,7 @@ def generate_LUTs(odt_info,
             # Copy into the lut dir
             transform_LUT_file_name = os.path.basename(
                 odt_values['transformLUT'])
-            lut = lut_directory + "/" + transform_LUT_file_name
+            lut = os.path.join(lut_directory, transform_LUT_file_name)
             shutil.copy(odt_values['transformLUT'], lut)
 
             cs.from_reference_transforms.append(shaper_OCIO_transform)
@@ -1044,24 +1053,28 @@ def generate_LUTs(odt_info,
 
             ctls = [
                 shaper_to_ACES_CTL % aces_CTL_directory,
-                '%s/rrt/RRT.a1.0.0.ctl' % aces_CTL_directory,
-                '%s/odt/%s' % (aces_CTL_directory, odt_values['transformCTL'])
-            ]
-            lut = "%s.RRT.a1.0.0.%s.spi3d" % (shaper_name, odt_name)
+                os.path.join(aces_CTL_directory,
+                             'rrt',
+                             'RRT.a1.0.0.ctl'),
+                os.path.join(aces_CTL_directory,
+                             'odt',
+                             odt_values['transformCTL'])]
+            lut = '%s.RRT.a1.0.0.%s.spi3d' % (shaper_name, odt_name)
 
             # Remove spaces and parentheses
             lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
-            generate_3d_LUT_from_CTL(lut_directory + "/" + lut,
-                                     # shaperLUT,
-                                     ctls,
-                                     lut_resolution_3d,
-                                     'float',
-                                     1.0 / shaper_input_scale,
-                                     1.0,
-                                     shaper_params,
-                                     cleanup,
-                                     aces_CTL_directory)
+            generate_3d_LUT_from_CTL(
+                os.path.join(lut_directory, lut),
+                # shaperLUT,
+                ctls,
+                lut_resolution_3d,
+                'float',
+                1.0 / shaper_input_scale,
+                1.0,
+                shaper_params,
+                cleanup,
+                aces_CTL_directory)
 
             cs.from_reference_transforms.append(shaper_OCIO_transform)
             cs.from_reference_transforms.append({
@@ -1080,7 +1093,7 @@ def generate_LUTs(odt_info,
             # Copy into the lut dir
             transform_LUT_inverse_file_name = os.path.basename(
                 odt_values['transformLUTInverse'])
-            lut = lut_directory + "/" + transform_LUT_inverse_file_name
+            lut = os.path.join(lut_directory, transform_LUT_inverse_file_name)
             shutil.copy(odt_values['transformLUTInverse'], lut)
 
             cs.to_reference_transforms.append({
@@ -1095,18 +1108,21 @@ def generate_LUTs(odt_info,
             cs.to_reference_transforms.append(shaper_inverse)
         elif 'transformCTLInverse' in odt_values:
             ctls = [
-                '%s/odt/%s' % (
-                    aces_CTL_directory, odt_values['transformCTLInverse']),
-                '%s/rrt/InvRRT.a1.0.0.ctl' % aces_CTL_directory,
+                os.path.join(aces_CTL_directory,
+                             'odt',
+                             odt_values['transformCTLInverse']),
+                os.path.join(aces_CTL_directory,
+                             'rrt',
+                             'InvRRT.a1.0.0.ctl'),
                 shaper_from_ACES_CTL % aces_CTL_directory
             ]
-            lut = "InvRRT.a1.0.0.%s.%s.spi3d" % (odt_name, shaper_name)
+            lut = 'InvRRT.a1.0.0.%s.%s.spi3d' % (odt_name, shaper_name)
 
             # Remove spaces and parentheses
             lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
 
             generate_3d_LUT_from_CTL(
-                lut_directory + "/" + lut,
+                os.path.join(lut_directory, lut),
                 # None,
                 ctls,
                 lut_resolution_3d,
@@ -1154,11 +1170,14 @@ def generate_LUTs(odt_info,
     # Log 2 shaper name and CTL transforms bundled up
     log2_shaper_data = [
         log2_shaper_name,
-        '%s/utilities/ACESlib.OCIO_shaper_log2_to_lin_param.a1.0.0.ctl',
-        '%s/utilities/ACESlib.OCIO_shaper_lin_to_log2_param.a1.0.0.ctl',
+        os.path.join('%s',
+                     'utilities',
+                     'ACESlib.OCIO_shaper_log2_to_lin_param.a1.0.0.ctl'),
+        os.path.join('%s',
+                     'utilities',
+                     'ACESlib.OCIO_shaper_lin_to_log2_param.a1.0.0.ctl'),
         shaper_input_scale_generic_log2,
-        log2_params
-    ]
+        log2_params]
 
     shaper_data[log2_shaper_name] = log2_shaper_data
 
@@ -1171,7 +1190,7 @@ def generate_LUTs(odt_info,
         middle_grey=log2_params['middleGrey'],
         min_exposure=log2_params['minExposure'],
         max_exposure=log2_params['maxExposure'])
-    log2_shaper_AP1.name = "%s - AP1" % log2_shaper_AP1.name
+    log2_shaper_AP1.name = '%s - AP1' % log2_shaper_AP1.name
     # AP1 primaries to AP0 primaries
     log2_shaper_AP1.to_reference_transforms.append({
         'type': 'matrix',
@@ -1223,9 +1242,9 @@ def generate_LUTs(odt_info,
         if odt_name in ['Academy.Rec2020_100nits_dim.a1.0.0',
                         'Academy.Rec709_100nits_dim.a1.0.0',
                         'Academy.Rec709_D60sim_100nits_dim.a1.0.0']:
-            print("Generating full range ODT for %s" % odt_name)
+            print('Generating full range ODT for %s' % odt_name)
 
-            odt_name_full = "%s - Full" % odt_values['transformUserName']
+            odt_name_full = '%s - Full' % odt_values['transformUserName']
             odt_full = odt_values.copy()
             odt_full['legalRange'] = 0
 
@@ -1251,7 +1270,7 @@ def generate_LUTs(odt_info,
                               from_reference_values=[],
                               to_reference_values=[]):
         cs = ColorSpace(name)
-        cs.description = "The %s color space" % name
+        cs.description = 'The %s color space' % name
         cs.equality_group = name
         cs.family = 'Utility'
         cs.is_data = False
@@ -1323,7 +1342,7 @@ def generate_LUTs(odt_info,
         from_reference_values=[ACES_AP0_to_XYZ, XYZ_to_Rec2020])
     config_data['colorSpaces'].append(cs)
 
-    print("generateLUTs - end")
+    print('generateLUTs - end')
     return config_data
 
 
@@ -1354,103 +1373,118 @@ def generate_baked_LUTs(odt_info,
         if odt_CTL_name in ['Academy.Rec2020_100nits_dim.a1.0.0',
                             'Academy.Rec709_100nits_dim.a1.0.0',
                             'Academy.Rec709_D60sim_100nits_dim.a1.0.0']:
-            odt_name = odt_values["transformUserName"]
+            odt_name = odt_values['transformUserName']
 
             odt_values_legal = dict(odt_values)
-            odt_values_legal["transformUserName"] = "%s - Legal" % odt_name
-            odt_info_C["%s - Legal" % odt_CTL_name] = odt_values_legal
+            odt_values_legal['transformUserName'] = '%s - Legal' % odt_name
+            odt_info_C['%s - Legal' % odt_CTL_name] = odt_values_legal
 
             odt_values_full = dict(odt_values)
-            odt_values_full["transformUserName"] = "%s - Full" % odt_name
-            odt_info_C["%s - Full" % odt_CTL_name] = odt_values_full
+            odt_values_full['transformUserName'] = '%s - Full' % odt_name
+            odt_info_C['%s - Full' % odt_CTL_name] = odt_values_full
 
             del (odt_info_C[odt_CTL_name])
 
     for odt_CTL_name, odt_values in odt_info_C.iteritems():
-        odt_prefix = odt_values["transformUserNamePrefix"]
-        odt_name = odt_values["transformUserName"]
+        odt_prefix = odt_values['transformUserNamePrefix']
+        odt_name = odt_values['transformUserName']
 
         # For Photoshop
-        for input_space in ["ACEScc", "ACESproxy"]:
-            args = ["--iconfig", config_path,
-                    "-v",
-                    "--inputspace", input_space]
-            args += ["--outputspace", "%s" % odt_name]
-            args += ["--description",
-                     "%s - %s for %s data" % (odt_prefix,
+        for input_space in ['ACEScc', 'ACESproxy']:
+            args = ['--iconfig', config_path,
+                    '-v',
+                    '--inputspace', input_space]
+            args += ['--outputspace', '%s' % odt_name]
+            args += ['--description',
+                     '%s - %s for %s data' % (odt_prefix,
                                               odt_name,
                                               input_space)]
-            args += ["--shaperspace", shaper_name,
-                     "--shapersize", str(lut_resolution_shaper)]
-            args += ["--cubesize", str(lut_resolution_3d)]
-            args += ["--format",
-                     "icc",
-                     "%s/photoshop/%s for %s.icc" % (baked_directory,
-                                                     odt_name,
-                                                     input_space)]
-
-            bake_LUT = Process(description="bake a LUT",
-                               cmd="ociobakelut",
+            args += ['--shaperspace', shaper_name,
+                     '--shapersize', str(lut_resolution_shaper)]
+            args += ['--cubesize', str(lut_resolution_3d)]
+            args += ['--format',
+                     'icc',
+                     os.path.join(baked_directory,
+                                  'photoshop',
+                                  '%s for %s.icc' % (odt_name, input_space))]
+
+            bake_LUT = Process(description='bake a LUT',
+                               cmd='ociobakelut',
                                args=args)
             bake_LUT.execute()
 
         # For Flame, Lustre
-        for input_space in ["ACEScc", "ACESproxy"]:
-            args = ["--iconfig", config_path,
-                    "-v",
-                    "--inputspace", input_space]
-            args += ["--outputspace", "%s" % odt_name]
-            args += ["--description",
-                     "%s - %s for %s data" % (
+        for input_space in ['ACEScc', 'ACESproxy']:
+            args = ['--iconfig', config_path,
+                    '-v',
+                    '--inputspace', input_space]
+            args += ['--outputspace', '%s' % odt_name]
+            args += ['--description',
+                     '%s - %s for %s data' % (
                          odt_prefix, odt_name, input_space)]
-            args += ["--shaperspace", shaper_name,
-                     "--shapersize", str(lut_resolution_shaper)]
-            args += ["--cubesize", str(lut_resolution_3d)]
-
-            fargs = ["--format", "flame", "%s/flame/%s for %s Flame.3dl" % (
-                baked_directory, odt_name, input_space)]
-            bake_LUT = Process(description="bake a LUT",
-                               cmd="ociobakelut",
+            args += ['--shaperspace', shaper_name,
+                     '--shapersize', str(lut_resolution_shaper)]
+            args += ['--cubesize', str(lut_resolution_3d)]
+
+            fargs = ['--format',
+                     'flame',
+                     os.path.join(
+                         baked_directory,
+                         'flame',
+                         '%s for %s Flame.3dl' % (odt_name, input_space))]
+            bake_LUT = Process(description='bake a LUT',
+                               cmd='ociobakelut',
                                args=(args + fargs))
             bake_LUT.execute()
 
-            largs = ["--format", "lustre", "%s/lustre/%s for %s Lustre.3dl" % (
-                baked_directory, odt_name, input_space)]
-            bake_LUT = Process(description="bake a LUT",
-                               cmd="ociobakelut",
+            largs = ['--format',
+                     'lustre',
+                     os.path.join(
+                         baked_directory,
+                         'lustre',
+                         '%s for %s Lustre.3dl' % (odt_name, input_space))]
+            bake_LUT = Process(description='bake a LUT',
+                               cmd='ociobakelut',
                                args=(args + largs))
             bake_LUT.execute()
 
         # For Maya, Houdini
-        for input_space in ["ACEScg", "ACES2065-1"]:
-            args = ["--iconfig", config_path,
-                    "-v",
-                    "--inputspace", input_space]
-            args += ["--outputspace", "%s" % odt_name]
-            args += ["--description",
-                     "%s - %s for %s data" % (
+        for input_space in ['ACEScg', 'ACES2065-1']:
+            args = ['--iconfig', config_path,
+                    '-v',
+                    '--inputspace', input_space]
+            args += ['--outputspace', '%s' % odt_name]
+            args += ['--description',
+                     '%s - %s for %s data' % (
                          odt_prefix, odt_name, input_space)]
             if input_space == 'ACEScg':
-                lin_shaper_name = "%s - AP1" % shaper_name
+                lin_shaper_name = '%s - AP1' % shaper_name
             else:
                 lin_shaper_name = shaper_name
-            args += ["--shaperspace", lin_shaper_name,
-                     "--shapersize", str(lut_resolution_shaper)]
-
-            args += ["--cubesize", str(lut_resolution_3d)]
-
-            margs = ["--format", "cinespace", "%s/maya/%s for %s Maya.csp" % (
-                baked_directory, odt_name, input_space)]
-            bake_LUT = Process(description="bake a LUT",
-                               cmd="ociobakelut",
+            args += ['--shaperspace', lin_shaper_name,
+                     '--shapersize', str(lut_resolution_shaper)]
+
+            args += ['--cubesize', str(lut_resolution_3d)]
+
+            margs = ['--format',
+                     'cinespace',
+                     os.path.join(
+                         baked_directory,
+                         'maya',
+                         '%s for %s Maya.csp' % (odt_name, input_space))]
+            bake_LUT = Process(description='bake a LUT',
+                               cmd='ociobakelut',
                                args=(args + margs))
             bake_LUT.execute()
 
-            hargs = ["--format", "houdini",
-                     "%s/houdini/%s for %s Houdini.lut" % (
-                         baked_directory, odt_name, input_space)]
-            bake_LUT = Process(description="bake a LUT",
-                               cmd="ociobakelut",
+            hargs = ['--format',
+                     'houdini',
+                     os.path.join(
+                         baked_directory,
+                         'houdini',
+                         '%s for %s Houdini.lut' % (odt_name, input_space))]
+            bake_LUT = Process(description='bake a LUT',
+                               cmd='ociobakelut',
                                args=(args + hargs))
             bake_LUT.execute()
 
@@ -1470,14 +1504,14 @@ def create_config_dir(config_directory, bake_secondary_LUTs):
          Return value description.
     """
 
-    dirs = [config_directory, "%s/luts" % config_directory]
+    dirs = [config_directory, os.path.join(config_directory, 'luts')]
     if bake_secondary_LUTs:
-        dirs.extend(["%s/baked" % config_directory,
-                     "%s/baked/flame" % config_directory,
-                     "%s/baked/photoshop" % config_directory,
-                     "%s/baked/houdini" % config_directory,
-                     "%s/baked/lustre" % config_directory,
-                     "%s/baked/maya" % config_directory])
+        dirs.extend([os.path.join(config_directory, 'baked'),
+                     os.path.join(config_directory, 'baked', 'flame'),
+                     os.path.join(config_directory, 'baked', 'photoshop'),
+                     os.path.join(config_directory, 'baked', 'houdini'),
+                     os.path.join(config_directory, 'baked', 'lustre'),
+                     os.path.join(config_directory, 'baked', 'maya')])
 
     for d in dirs:
         not os.path.exists(d) and os.mkdir(d)
@@ -1536,14 +1570,14 @@ def get_ODT_info(aces_CTL_directory):
 
     # TODO: Investigate usage of *files_walker* definition here.
     # Credit to Alex Fry for the original approach here
-    odt_dir = os.path.join(aces_CTL_directory, "odt")
+    odt_dir = os.path.join(aces_CTL_directory, 'odt')
     all_odt = []
     for dir_name, subdir_list, file_list in os.walk(odt_dir):
         for fname in file_list:
             all_odt.append((os.path.join(dir_name, fname)))
 
     odt_CTLs = [x for x in all_odt if
-                ("InvODT" not in x) and (os.path.split(x)[-1][0] != '.')]
+                ('InvODT' not in x) and (os.path.split(x)[-1][0] != '.')]
 
     # print odtCTLs
 
@@ -1561,7 +1595,7 @@ def get_ODT_info(aces_CTL_directory):
             odt_dir = os.path.join(odt_path_tokens[-1], odt_dir)
 
         # Build full name
-        # print("odtDir : %s" % odtDir)
+        # print('odtDir : %s' % odtDir)
         transform_CTL = odt_tokens[-1]
         # print(transformCTL)
         odt_name = string.join(transform_CTL.split('.')[1:-1], '.')
@@ -1571,10 +1605,10 @@ def get_ODT_info(aces_CTL_directory):
         (transform_ID,
          transform_user_name,
          transform_user_name_prefix) = get_transform_info(
-            "%s/odt/%s/%s" % (aces_CTL_directory, odt_dir, transform_CTL))
+            os.path.join(aces_CTL_directory, 'odt', odt_dir, transform_CTL))
 
         # Find inverse
-        transform_CTL_inverse = "InvODT.%s.ctl" % odt_name
+        transform_CTL_inverse = 'InvODT.%s.ctl' % odt_name
         if not os.path.exists(
                 os.path.join(odt_tokens[-2], transform_CTL_inverse)):
             transform_CTL_inverse = None
@@ -1591,19 +1625,19 @@ def get_ODT_info(aces_CTL_directory):
         odts[odt_name]['transformUserNamePrefix'] = transform_user_name_prefix
         odts[odt_name]['transformUserName'] = transform_user_name
 
-        print("ODT : %s" % odt_name)
-        print("\tTransform ID               : %s" % transform_ID)
-        print("\tTransform User Name Prefix : %s" % transform_user_name_prefix)
-        print("\tTransform User Name        : %s" % transform_user_name)
-        print("\tForward ctl                : %s" % (
+        print('ODT : %s' % odt_name)
+        print('\tTransform ID               : %s' % transform_ID)
+        print('\tTransform User Name Prefix : %s' % transform_user_name_prefix)
+        print('\tTransform User Name        : %s' % transform_user_name)
+        print('\tForward ctl                : %s' % (
             odts[odt_name]['transformCTL']))
         if 'transformCTLInverse' in odts[odt_name]:
-            print("\tInverse ctl                : %s" % (
+            print('\tInverse ctl                : %s' % (
                 odts[odt_name]['transformCTLInverse']))
         else:
-            print("\tInverse ctl                : %s" % "None")
+            print('\tInverse ctl                : %s' % 'None')
 
-    print("\n")
+    print('\n')
 
     return odts
 
@@ -1628,14 +1662,14 @@ def get_LMT_info(aces_CTL_directory):
     # TODO: Investigate refactoring with previous definition.
 
     # Credit to Alex Fry for the original approach here
-    lmt_dir = os.path.join(aces_CTL_directory, "lmt")
+    lmt_dir = os.path.join(aces_CTL_directory, 'lmt')
     all_lmt = []
     for dir_name, subdir_list, file_list in os.walk(lmt_dir):
         for fname in file_list:
             all_lmt.append((os.path.join(dir_name, fname)))
 
     lmt_CTLs = [x for x in all_lmt if
-                ("InvLMT" not in x) and ("README" not in x) and (
+                ('InvLMT' not in x) and ('README' not in x) and (
                     os.path.split(x)[-1][0] != '.')]
 
     # print lmtCTLs
@@ -1654,7 +1688,7 @@ def get_LMT_info(aces_CTL_directory):
             lmt_dir = os.path.join(lmt_path_tokens[-1], lmt_dir)
 
         # Build full name
-        # print("lmtDir : %s" % lmtDir)
+        # print('lmtDir : %s' % lmtDir)
         transform_CTL = lmt_tokens[-1]
         # print(transformCTL)
         lmt_name = string.join(transform_CTL.split('.')[1:-1], '.')
@@ -1664,10 +1698,10 @@ def get_LMT_info(aces_CTL_directory):
         (transform_ID,
          transform_user_name,
          transform_user_name_prefix) = get_transform_info(
-            "%s/%s/%s" % (aces_CTL_directory, lmt_dir, transform_CTL))
+            os.path.join(aces_CTL_directory, lmt_dir, transform_CTL))
 
         # Find inverse
-        transform_CTL_inverse = "InvLMT.%s.ctl" % lmt_name
+        transform_CTL_inverse = 'InvLMT.%s.ctl' % lmt_name
         if not os.path.exists(
                 os.path.join(lmt_tokens[-2], transform_CTL_inverse)):
             transform_CTL_inverse = None
@@ -1685,18 +1719,18 @@ def get_LMT_info(aces_CTL_directory):
         lmts[lmt_name]['transformUserNamePrefix'] = transform_user_name_prefix
         lmts[lmt_name]['transformUserName'] = transform_user_name
 
-        print("LMT : %s" % lmt_name)
-        print("\tTransform ID               : %s" % transform_ID)
-        print("\tTransform User Name Prefix : %s" % transform_user_name_prefix)
-        print("\tTransform User Name        : %s" % transform_user_name)
-        print("\t Forward ctl : %s" % lmts[lmt_name]['transformCTL'])
+        print('LMT : %s' % lmt_name)
+        print('\tTransform ID               : %s' % transform_ID)
+        print('\tTransform User Name Prefix : %s' % transform_user_name_prefix)
+        print('\tTransform User Name        : %s' % transform_user_name)
+        print('\t Forward ctl : %s' % lmts[lmt_name]['transformCTL'])
         if 'transformCTLInverse' in lmts[lmt_name]:
-            print("\t Inverse ctl : %s" % (
+            print('\t Inverse ctl : %s' % (
                 lmts[lmt_name]['transformCTLInverse']))
         else:
-            print("\t Inverse ctl : %s" % "None")
+            print('\t Inverse ctl : %s' % 'None')
 
-    print("\n")
+    print('\n')
 
     return lmts
 
@@ -1731,7 +1765,7 @@ def create_ACES_config(aces_CTL_directory,
     create_config_dir(config_directory, bake_secondary_LUTs)
 
     # Generate config data and LUTs for different transforms
-    lut_directory = "%s/luts" % config_directory
+    lut_directory = os.path.join(config_directory, 'luts')
     shaper_name = 'Output Shaper'
     config_data = generate_LUTs(odt_info,
                                 lmt_info,
@@ -1743,28 +1777,30 @@ def create_ACES_config(aces_CTL_directory,
                                 cleanup)
 
     # Create the config using the generated LUTs
-    print("Creating generic config")
+    print('Creating generic config')
     config = create_config(config_data)
-    print("\n\n\n")
+    print('\n\n\n')
 
     # Write the config to disk
-    write_config(config, "%s/config.ocio" % config_directory)
+    write_config(config,
+                 os.path.join(config_directory, 'config.ocio'))
 
     # Create a config that will work well with Nuke using the previously
     # generated LUTs.
-    print("Creating Nuke-specific config")
+    print('Creating Nuke-specific config')
     nuke_config = create_config(config_data, nuke=True)
-    print("\n\n\n")
+    print('\n\n\n')
 
     # Write the config to disk
-    write_config(nuke_config, "%s/nuke_config.ocio" % config_directory)
+    write_config(nuke_config,
+                 os.path.join(config_directory, 'nuke_config.ocio'))
 
     # Bake secondary LUTs using the config
     if bake_secondary_LUTs:
         generate_baked_LUTs(odt_info,
                             shaper_name,
-                            "%s/baked" % config_directory,
-                            "%s/config.ocio" % config_directory,
+                            os.path.join(config_directory, 'baked'),
+                            os.path.join(config_directory, 'config.ocio'),
                             lut_resolution_1d,
                             lut_resolution_3d,
                             lut_resolution_1d)
@@ -1799,8 +1835,8 @@ def main():
         'ACES_OCIO_CONFIGURATION_DIRECTORY', None))
     p.add_option('--lutResolution1d', default=4096)
     p.add_option('--lutResolution3d', default=64)
-    p.add_option('--dontBakeSecondaryLUTs', action="store_true")
-    p.add_option('--keepTempImages', action="store_true")
+    p.add_option('--dontBakeSecondaryLUTs', action='store_true')
+    p.add_option('--keepTempImages', action='store_true')
 
     options, arguments = p.parse_args()
 
@@ -1821,14 +1857,14 @@ def main():
         args_start = len(sys.argv) + 1
         args = []
 
-    print("command line : \n%s\n" % " ".join(sys.argv))
+    print('command line : \n%s\n' % ' '.join(sys.argv))
 
     # TODO: Use assertion and mention environment variables.
     if not aces_CTL_directory:
-        print("process: No ACES CTL directory specified")
+        print('process: No ACES CTL directory specified')
         return
     if not config_directory:
-        print("process: No configuration directory specified")
+        print('process: No configuration directory specified')
         return
     #
     # Generate the configuration