2424 unclassify_clf_transforms ,
2525)
2626from opencolorio_config_aces .config .generation import (
27+ BUILD_CONFIGURATIONS ,
28+ BUILD_VARIANT_FILTERERS ,
2729 BUILTIN_TRANSFORMS ,
28- DEPENDENCY_VERSIONS ,
2930 SEPARATOR_BUILTIN_TRANSFORM_NAME ,
3031 SEPARATOR_COLORSPACE_FAMILY ,
3132 SEPARATOR_COLORSPACE_NAME ,
32- DependencyVersions ,
33+ BuildConfiguration ,
3334 beautify_alias ,
3435 beautify_colorspace_name ,
3536 colorspace_factory ,
7879 "config_name_cg" ,
7980 "config_description_cg" ,
8081 "generate_config_cg" ,
82+ "main" ,
8183]
8284
8385LOGGER = logging .getLogger (__name__ )
@@ -652,15 +654,15 @@ def style_to_named_transform(
652654 return colorspace
653655
654656
655- def config_basename_cg (dependency_versions ):
657+ def config_basename_cg (build_configuration ):
656658 """
657659 Generate the ACES* Computer Graphics (CG) *OpenColorIO* config
658660 basename, i.e., the filename devoid of directory affix.
659661
660662 Parameters
661663 ----------
662- dependency_versions: DependencyVersions
663- Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO* .
664+ build_configuration: BuildConfiguration
665+ Build configuration .
664666
665667 Returns
666668 -------
@@ -669,23 +671,25 @@ def config_basename_cg(dependency_versions):
669671
670672 Examples
671673 --------
672- >>> config_basename_cg(DependencyVersions ())
674+ >>> config_basename_cg(BuildConfiguration ())
673675 'cg-config-v0.0.0_aces-v0.0_ocio-v2.0.ocio'
674676 """
675677
676- return ("cg-config-{colorspaces}_aces-{aces}_ocio-{ocio}.ocio" ).format (
677- ** dependency_versions .to_regularised_versions ()
678+ return (
679+ ("cg-config-{variant}-{colorspaces}_aces-{aces}_ocio-{ocio}.ocio" )
680+ .format (** build_configuration .compact_fields ())
681+ .replace ("--" , "-" )
678682 )
679683
680684
681- def config_name_cg (dependency_versions ):
685+ def config_name_cg (build_configuration ):
682686 """
683687 Generate the ACES* Computer Graphics (CG) *OpenColorIO* config name.
684688
685689 Parameters
686690 ----------
687- dependency_versions: DependencyVersions
688- Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO* .
691+ build_configuration: BuildConfiguration
692+ Build configuration .
689693
690694 Returns
691695 -------
@@ -694,21 +698,25 @@ def config_name_cg(dependency_versions):
694698
695699 Examples
696700 --------
697- >>> config_name_cg(DependencyVersions ())
701+ >>> config_name_cg(BuildConfiguration ())
698702 'Academy Color Encoding System - CG Config [COLORSPACES v0.0.0] \
699703 [ACES v0.0] [OCIO v2.0]'
700704 """
701705
702706 return (
703- "Academy Color Encoding System - CG Config "
704- "[COLORSPACES {colorspaces}] "
705- "[ACES {aces}] "
706- "[OCIO {ocio}]"
707- ).format (** dependency_versions .to_regularised_versions ())
707+ (
708+ "Academy Color Encoding System - CG Config {variant}"
709+ "[COLORSPACES {colorspaces}] "
710+ "[ACES {aces}] "
711+ "[OCIO {ocio}]"
712+ )
713+ .format (** build_configuration .extended_fields ())
714+ .replace (")[" , ") [" )
715+ )
708716
709717
710718def config_description_cg (
711- dependency_versions ,
719+ build_configuration ,
712720 describe = DescriptionStyle .SHORT_UNION ,
713721):
714722 """
@@ -717,8 +725,8 @@ def config_description_cg(
717725
718726 Parameters
719727 ----------
720- dependency_versions: DependencyVersions
721- Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO* .
728+ build_configuration: BuildConfiguration
729+ Build configuration .
722730 describe : int, optional
723731 Any value from the
724732 :class:`opencolorio_config_aces.DescriptionStyle` enum.
@@ -729,7 +737,7 @@ def config_description_cg(
729737 ACES* Computer Graphics (CG) *OpenColorIO* config description.
730738 """
731739
732- name = config_name_cg (dependency_versions )
740+ name = config_name_cg (build_configuration )
733741
734742 underline = "-" * len (name )
735743
@@ -750,7 +758,7 @@ def config_description_cg(
750758def generate_config_cg (
751759 data = None ,
752760 config_name = None ,
753- dependency_versions = DependencyVersions (),
761+ build_configuration = BuildConfiguration (),
754762 validate = True ,
755763 describe = DescriptionStyle .SHORT_UNION ,
756764 config_mapping_file_path = PATH_TRANSFORMS_MAPPING_FILE_CG ,
@@ -792,8 +800,8 @@ def generate_config_cg(
792800 config_name : unicode, optional
793801 *OpenColorIO* config file name, if given the config will be written to
794802 disk.
795- dependency_versions: DependencyVersions , optional
796- Dependency versions, e.g., *aces-dev*, *colorspaces*, and *OpenColorIO* .
803+ build_configuration: BuildConfiguration , optional
804+ Build configuration .
797805 validate : bool, optional
798806 Whether to validate the config.
799807 describe : int, optional
@@ -835,7 +843,7 @@ def generate_config_cg(
835843
836844 LOGGER .info (
837845 'Generating "%s" config...' ,
838- config_name_cg (dependency_versions ),
846+ config_name_cg (build_configuration ),
839847 )
840848
841849 clf_transforms = unclassify_clf_transforms (
@@ -846,7 +854,7 @@ def generate_config_cg(
846854
847855 if data is None :
848856 _config , data , ctl_transforms , amf_components = generate_config_aces (
849- dependency_versions = dependency_versions ,
857+ build_configuration = build_configuration ,
850858 describe = describe ,
851859 scheme = scheme ,
852860 analytical = False ,
@@ -926,12 +934,12 @@ def clf_transform_from_style(style):
926934 f'"{ style } " "BuiltinTransform" style does not exist!' ,
927935 )
928936
929- if BUILTIN_TRANSFORMS [style ] > dependency_versions .ocio :
937+ if BUILTIN_TRANSFORMS [style ] > build_configuration .ocio :
930938 LOGGER .warning (
931939 '"%s" style is unavailable for "%s" profile version, '
932940 "skipping transform!" ,
933941 style ,
934- dependency_versions .ocio ,
942+ build_configuration .ocio ,
935943 )
936944 continue
937945
@@ -970,9 +978,9 @@ def yield_from_config_mapping():
970978 data .name = re .sub (
971979 r"\.ocio$" ,
972980 "" ,
973- config_basename_cg (dependency_versions ),
981+ config_basename_cg (build_configuration ),
974982 )
975- data .description = config_description_cg (dependency_versions , describe )
983+ data .description = config_description_cg (build_configuration , describe )
976984
977985 # Colorspaces, Looks and View Transforms Filtering
978986 transforms = data .colorspaces + data .view_transforms
@@ -1261,13 +1269,13 @@ def view_filterer(transform):
12611269 }
12621270 )
12631271
1264- data .profile_version = dependency_versions .ocio
1272+ data .profile_version = build_configuration .ocio
12651273
12661274 config = generate_config (data , config_name , validate )
12671275
12681276 LOGGER .info (
12691277 '"%s" config generation complete!' ,
1270- config_name_cg (dependency_versions ),
1278+ config_name_cg (build_configuration ),
12711279 )
12721280
12731281 if additional_data :
@@ -1276,21 +1284,28 @@ def view_filterer(transform):
12761284 return config
12771285
12781286
1279- if __name__ == "__main__" :
1280- from opencolorio_config_aces import serialize_config_data
1281- from opencolorio_config_aces .utilities import ROOT_BUILD_DEFAULT
1287+ def main (build_directory ):
1288+ """
1289+ Define the main entry point for the generation of all the *ACES* Computer
1290+ Graphics (CG) *OpenColorIO* config versions and variants.
12821291
1283- logging .basicConfig ()
1284- logging .getLogger ().setLevel (logging .INFO )
1292+ Parameters
1293+ ----------
1294+ build_directory : Path
1295+ Build directory.
12851296
1286- build_directory = (ROOT_BUILD_DEFAULT / "config" / "aces" / "cg" ).resolve ()
1297+ Returns
1298+ -------
1299+ :class:`int`
1300+ Return code.
1301+ """
12871302
12881303 logging .info ('Using "%s" build directory...' , build_directory )
12891304
12901305 build_directory .mkdir (parents = True , exist_ok = True )
12911306
1292- for dependency_versions in DEPENDENCY_VERSIONS :
1293- config_basename = config_basename_cg (dependency_versions )
1307+ for build_configuration in BUILD_CONFIGURATIONS :
1308+ config_basename = config_basename_cg (build_configuration )
12941309 (
12951310 config ,
12961311 data ,
@@ -1299,7 +1314,8 @@ def view_filterer(transform):
12991314 amf_components ,
13001315 ) = generate_config_cg (
13011316 config_name = build_directory / config_basename ,
1302- dependency_versions = dependency_versions ,
1317+ build_configuration = build_configuration ,
1318+ additional_filterers = BUILD_VARIANT_FILTERERS [build_configuration .variant ],
13031319 additional_data = True ,
13041320 )
13051321
@@ -1309,3 +1325,17 @@ def view_filterer(transform):
13091325 )
13101326 except TypeError as error :
13111327 logging .critical (error )
1328+
1329+ return 0
1330+
1331+
1332+ if __name__ == "__main__" :
1333+ import sys
1334+
1335+ from opencolorio_config_aces import serialize_config_data
1336+ from opencolorio_config_aces .utilities import ROOT_BUILD_DEFAULT
1337+
1338+ logging .basicConfig ()
1339+ logging .getLogger ().setLevel (logging .INFO )
1340+
1341+ sys .exit (main ((ROOT_BUILD_DEFAULT / "config" / "aces" / "cg" ).resolve ()))
0 commit comments