3131from variantlib .constants import VARIANT_INFO_PROPERTY_KEY
3232from variantlib .constants import VARIANT_INFO_PROVIDER_DATA_KEY
3333from variantlib .constants import VARIANT_INFO_PROVIDER_ENABLE_IF_KEY
34+ from variantlib .constants import VARIANT_INFO_PROVIDER_INSTALL_TIME_KEY
3435from variantlib .constants import VARIANT_INFO_PROVIDER_OPTIONAL_KEY
3536from variantlib .constants import VARIANT_INFO_PROVIDER_PLUGIN_API_KEY
36- from variantlib .constants import VARIANT_INFO_PROVIDER_PLUGIN_USE_KEY
3737from variantlib .constants import VARIANT_INFO_PROVIDER_REQUIRES_KEY
38+ from variantlib .constants import VARIANT_INFO_STATIC_PROPERTIES_KEY
3839from variantlib .constants import VARIANT_LABEL_LENGTH
3940from variantlib .constants import VARIANTS_JSON_SCHEMA_KEY
4041from variantlib .constants import VARIANTS_JSON_SCHEMA_URL
5152from variantlib .models .variant import VariantFeature
5253from variantlib .models .variant import VariantProperty
5354from variantlib .models .variant import VariantValidationResult
54- from variantlib .models .variant_info import PluginUse
5555from variantlib .models .variant_info import ProviderInfo
5656from variantlib .models .variant_info import VariantInfo
5757from variantlib .pyproject_toml import VariantPyProjectToml
@@ -295,10 +295,6 @@ def test_validate_variant(optional: bool) -> None:
295295 "incompatible_namespace" ,
296296 "private" ,
297297 ],
298- feature_priorities = {
299- "private" : ["build_type" ],
300- },
301- property_priorities = {"private" : {"build_type" : ["debug" , "release" ]}},
302298 providers = {
303299 "test_namespace" : ProviderInfo (
304300 requires = ["variantlib" ],
@@ -309,7 +305,7 @@ def test_validate_variant(optional: bool) -> None:
309305 requires = ["variantlib" ],
310306 plugin_api = "tests.mocked_plugins:MockedPluginB" ,
311307 optional = optional ,
312- plugin_use = PluginUse . BUILD ,
308+ install_time = False ,
313309 ),
314310 "incompatible_namespace" : ProviderInfo (
315311 requires = ["variantlib" ],
@@ -318,11 +314,11 @@ def test_validate_variant(optional: bool) -> None:
318314 ),
319315 "private" : ProviderInfo (
320316 plugin_api = "donotuseme" ,
321- requires = ["donotuseme" ],
322317 optional = optional ,
323- plugin_use = PluginUse . NONE ,
318+ install_time = False ,
324319 ),
325320 },
321+ static_properties = {"private" : {"build_type" : ["debug" , "release" ]}},
326322 )
327323
328324 expected = {
@@ -399,13 +395,17 @@ def test_make_variant_dist_info(
399395 ],
400396 VARIANT_INFO_PROVIDER_PLUGIN_API_KEY : "ns2_provider:Plugin" ,
401397 VARIANT_INFO_PROVIDER_OPTIONAL_KEY : True ,
402- VARIANT_INFO_PROVIDER_PLUGIN_USE_KEY : "build" ,
398+ VARIANT_INFO_PROVIDER_INSTALL_TIME_KEY : False ,
399+ },
400+ "ns3" : {
401+ VARIANT_INFO_PROVIDER_INSTALL_TIME_KEY : False ,
403402 },
404403 }
405404 )
406405 expected [VARIANT_INFO_DEFAULT_PRIO_KEY ].update (
407406 {
408- VARIANT_INFO_NAMESPACE_KEY : ["ns1" , "ns2" ],
407+ VARIANT_INFO_NAMESPACE_KEY : ["ns1" , "ns2" , "ns3" ],
408+ VARIANT_INFO_FEATURE_KEY : {"ns3" : ["f2" , "f1" ]},
409409 },
410410 )
411411
@@ -415,6 +415,7 @@ def test_make_variant_dist_info(
415415 VARIANT_INFO_FEATURE_KEY : {
416416 "ns1" : ["f2" ],
417417 "ns2" : ["f1" , "f2" ],
418+ "ns3" : ["f2" , "f1" ],
418419 },
419420 VARIANT_INFO_PROPERTY_KEY : {
420421 "ns1" : {
@@ -441,7 +442,7 @@ def test_make_variant_dist_info(
441442 if pyproject_toml is not None
442443 else None ,
443444 variant_label = label ,
444- expand_build_plugin_properties = False ,
445+ expand_aot_plugin_properties = False ,
445446 )
446447 )
447448 == expected
@@ -683,9 +684,12 @@ def test_get_variant_label() -> None:
683684 )
684685
685686
686- @pytest .mark .parametrize ("plugin_use" , PluginUse .__members__ .values ())
687- def test_make_variant_dist_info_expand_build_plugin_properties (
688- plugin_use : PluginUse ,
687+ @pytest .mark .parametrize (
688+ ("install_time" , "requires" ), [(False , False ), (False , True ), (True , True )]
689+ )
690+ def test_make_variant_dist_info_expand_aot_plugin_properties (
691+ install_time : bool ,
692+ requires : bool ,
689693) -> None :
690694 vdesc = VariantDescription (
691695 [
@@ -697,10 +701,10 @@ def test_make_variant_dist_info_expand_build_plugin_properties(
697701 namespace_priorities = ["aot_plugin" ],
698702 providers = {
699703 "aot_plugin" : ProviderInfo (
700- requires = ["variantlib" ],
701- plugin_api = plugin_api ,
704+ install_time = install_time ,
702705 optional = True ,
703- plugin_use = plugin_use ,
706+ plugin_api = plugin_api ,
707+ requires = ["variantlib" ] if requires else [],
704708 )
705709 },
706710 )
@@ -712,7 +716,6 @@ def test_make_variant_dist_info_expand_build_plugin_properties(
712716 },
713717 VARIANT_INFO_PROVIDER_DATA_KEY : {
714718 "aot_plugin" : {
715- VARIANT_INFO_PROVIDER_REQUIRES_KEY : ["variantlib" ],
716719 VARIANT_INFO_PROVIDER_OPTIONAL_KEY : True ,
717720 VARIANT_INFO_PROVIDER_PLUGIN_API_KEY : plugin_api ,
718721 },
@@ -726,18 +729,16 @@ def test_make_variant_dist_info_expand_build_plugin_properties(
726729 },
727730 }
728731
729- if plugin_use == PluginUse .NONE :
730- expected [VARIANT_INFO_PROVIDER_DATA_KEY ]["aot_plugin" ][
731- VARIANT_INFO_PROVIDER_PLUGIN_USE_KEY
732- ] = "none"
733- if plugin_use == PluginUse .BUILD :
734- expected [VARIANT_INFO_PROVIDER_DATA_KEY ]["aot_plugin" ][
735- VARIANT_INFO_PROVIDER_PLUGIN_USE_KEY
736- ] = "build"
732+ provider_data = expected [VARIANT_INFO_PROVIDER_DATA_KEY ]["aot_plugin" ]
733+ if requires :
734+ provider_data [VARIANT_INFO_PROVIDER_REQUIRES_KEY ] = ["variantlib" ]
735+ if not install_time :
736+ provider_data [VARIANT_INFO_PROVIDER_INSTALL_TIME_KEY ] = False
737+ if requires and not install_time :
737738 expected [VARIANT_INFO_DEFAULT_PRIO_KEY ][VARIANT_INFO_FEATURE_KEY ] = {
738739 "aot_plugin" : ["name1" , "name2" ],
739740 }
740- expected [VARIANT_INFO_DEFAULT_PRIO_KEY ][ VARIANT_INFO_PROPERTY_KEY ] = {
741+ expected [VARIANT_INFO_STATIC_PROPERTIES_KEY ] = {
741742 "aot_plugin" : {
742743 "name1" : ["val1a" , "val1b" ],
743744 "name2" : ["val2a" , "val2b" , "val2c" ],
@@ -750,7 +751,7 @@ def test_make_variant_dist_info_expand_build_plugin_properties(
750751 vdesc ,
751752 variant_info = vinfo ,
752753 variant_label = "test" ,
753- expand_build_plugin_properties = True ,
754+ expand_aot_plugin_properties = True ,
754755 )
755756 )
756757 == expected
@@ -771,7 +772,7 @@ def test_make_variant_dist_info_invalid_aot_plugin_property() -> None:
771772 requires = ["variantlib" ],
772773 plugin_api = plugin_api ,
773774 optional = True ,
774- plugin_use = PluginUse . BUILD ,
775+ install_time = False ,
775776 )
776777 },
777778 )
@@ -784,7 +785,7 @@ def test_make_variant_dist_info_invalid_aot_plugin_property() -> None:
784785 make_variant_dist_info (
785786 vdesc ,
786787 variant_info = vinfo ,
787- expand_build_plugin_properties = True ,
788+ expand_aot_plugin_properties = True ,
788789 )
789790
790791
@@ -802,7 +803,7 @@ def test_make_variant_dist_info_invalid_aot_plugin_multi_value() -> None:
802803 requires = ["variantlib" ],
803804 plugin_api = plugin_api ,
804805 optional = True ,
805- plugin_use = PluginUse . BUILD ,
806+ install_time = False ,
806807 )
807808 },
808809 )
@@ -814,7 +815,7 @@ def test_make_variant_dist_info_invalid_aot_plugin_multi_value() -> None:
814815 make_variant_dist_info (
815816 vdesc ,
816817 variant_info = vinfo ,
817- expand_build_plugin_properties = True ,
818+ expand_aot_plugin_properties = True ,
818819 )
819820
820821
@@ -831,7 +832,7 @@ def test_make_variant_dist_info_really_invalid_build_plugin() -> None:
831832 "second_namespace" : ProviderInfo (
832833 requires = ["variantlib" ],
833834 plugin_api = plugin_api ,
834- plugin_use = PluginUse . BUILD ,
835+ install_time = False ,
835836 )
836837 },
837838 )
@@ -844,5 +845,5 @@ def test_make_variant_dist_info_really_invalid_build_plugin() -> None:
844845 make_variant_dist_info (
845846 vdesc ,
846847 variant_info = vinfo ,
847- expand_build_plugin_properties = True ,
848+ expand_aot_plugin_properties = True ,
848849 )
0 commit comments