1818#[ allow( clippy:: too_many_arguments) ]
1919#[ pyo3:: pyfunction]
2020#[ pyo3( name = "componentize" ) ]
21- #[ pyo3( signature = ( wit_path, worlds, features, all_features, bindings_module, python_path, module_worlds, app_name, output_path, stub_wasi, import_interface_names, export_interface_names, full_names = None , intersect_world = None , world_module = None ) ) ]
21+ #[ pyo3( signature = ( wit_path, worlds, features, all_features, bindings_module, python_path, module_worlds, app_name, output_path, stub_wasi, import_interface_names, export_interface_names, full_names = None , intersect_world = None , world_module = None , registry_config = None , no_default_registries = false ) ) ]
2222fn python_componentize (
2323 wit_path : Vec < PathBuf > ,
2424 worlds : Vec < String > ,
@@ -35,6 +35,8 @@ fn python_componentize(
3535 full_names : Option < bool > ,
3636 intersect_world : Option < & str > ,
3737 world_module : Option < & str > ,
38+ registry_config : Option < PathBuf > ,
39+ no_default_registries : bool ,
3840) -> PyResult < ( ) > {
3941 let bindings_module = crate :: resolve_deprecated (
4042 bindings_module. map ( str:: to_owned) ,
@@ -72,6 +74,8 @@ fn python_componentize(
7274 . map ( |( a, b) | ( a. as_ref ( ) , b. as_ref ( ) ) )
7375 . collect ( ) ,
7476 intersect_world,
77+ registry_config : registry_config. as_deref ( ) ,
78+ default_registries : !no_default_registries,
7579 }
7680 . generate ( ) ,
7781 )
@@ -82,7 +86,7 @@ fn python_componentize(
8286#[ allow( clippy:: too_many_arguments) ]
8387#[ pyo3:: pyfunction]
8488#[ pyo3( name = "generate_bindings" ) ]
85- #[ pyo3( signature = ( wit_path, worlds, features, all_features, bindings_module, output_dir, import_interface_names, export_interface_names, allow_existing = false , full_names = None , world_module = None ) ) ]
89+ #[ pyo3( signature = ( wit_path, worlds, features, all_features, bindings_module, output_dir, import_interface_names, export_interface_names, allow_existing = false , full_names = None , world_module = None , registry_config = None , no_default_registries = false ) ) ]
8690fn python_generate_bindings (
8791 wit_path : Vec < PathBuf > ,
8892 worlds : Vec < String > ,
@@ -95,6 +99,8 @@ fn python_generate_bindings(
9599 allow_existing : bool ,
96100 full_names : Option < bool > ,
97101 world_module : Option < & str > ,
102+ registry_config : Option < PathBuf > ,
103+ no_default_registries : bool ,
98104) -> PyResult < ( ) > {
99105 let bindings_module = crate :: resolve_deprecated (
100106 bindings_module. map ( str:: to_owned) ,
@@ -103,24 +109,30 @@ fn python_generate_bindings(
103109 false ,
104110 )
105111 . map_err ( |e| PyAssertionError :: new_err ( format ! ( "{e:?}" ) ) ) ?;
106- BindingsGenerator {
107- wit_paths : & wit_path. iter ( ) . map ( |v| v. as_path ( ) ) . collect :: < Vec < _ > > ( ) ,
108- worlds : & worlds. iter ( ) . map ( |v| v. as_str ( ) ) . collect :: < Vec < _ > > ( ) ,
109- features : & features. iter ( ) . map ( |v| v. as_str ( ) ) . collect :: < Vec < _ > > ( ) ,
110- all_features,
111- bindings_module : bindings_module. as_deref ( ) ,
112- output_dir : & output_dir,
113- allow_existing,
114- import_interface_names : & import_interface_names
115- . iter ( )
116- . map ( |( a, b) | ( a. as_ref ( ) , b. as_ref ( ) ) )
117- . collect ( ) ,
118- export_interface_names : & export_interface_names
119- . iter ( )
120- . map ( |( a, b) | ( a. as_ref ( ) , b. as_ref ( ) ) )
121- . collect ( ) ,
122- }
123- . generate ( )
112+ ( || {
113+ Runtime :: new ( ) ?. block_on (
114+ BindingsGenerator {
115+ wit_paths : & wit_path. iter ( ) . map ( |v| v. as_path ( ) ) . collect :: < Vec < _ > > ( ) ,
116+ worlds : & worlds. iter ( ) . map ( |v| v. as_str ( ) ) . collect :: < Vec < _ > > ( ) ,
117+ features : & features. iter ( ) . map ( |v| v. as_str ( ) ) . collect :: < Vec < _ > > ( ) ,
118+ all_features,
119+ bindings_module : bindings_module. as_deref ( ) ,
120+ output_dir : & output_dir,
121+ allow_existing,
122+ import_interface_names : & import_interface_names
123+ . iter ( )
124+ . map ( |( a, b) | ( a. as_ref ( ) , b. as_ref ( ) ) )
125+ . collect ( ) ,
126+ export_interface_names : & export_interface_names
127+ . iter ( )
128+ . map ( |( a, b) | ( a. as_ref ( ) , b. as_ref ( ) ) )
129+ . collect ( ) ,
130+ registry_config : registry_config. as_deref ( ) ,
131+ default_registries : !no_default_registries,
132+ }
133+ . generate ( ) ,
134+ )
135+ } ) ( )
124136 . map_err ( |e| PyAssertionError :: new_err ( format ! ( "{e:?}" ) ) )
125137}
126138
0 commit comments