Skip to content
Snippets Groups Projects
Commit 73fa5ba7 authored by Adriaan de Groot's avatar Adriaan de Groot
Browse files

[libcalamares] Add overload of target_env_call to pybind11

Python code that would run with Boost::Python, calling
target_env_call() with a single string parameter, would
fail in pybind11. Add the missing overload.
parent 3fc2fca9
No related branches found
No related tags found
No related merge requests found
......@@ -186,6 +186,17 @@ target_env_call( const List& args, const std::string& input, int timeout )
.first;
}
int
target_env_call( const std::string& command, const std::string& input, int timeout )
{
return Calamares::System::instance()
->targetEnvCommand( { QString::fromStdString( command ) },
QString(),
QString::fromStdString( input ),
std::chrono::seconds( timeout ) )
.first;
}
int
check_target_env_call( const List& args, const std::string& input, int timeout )
{
......
......@@ -30,6 +30,7 @@ class PythonJob;
namespace Python __attribute__( ( visibility( "hidden" ) ) )
{
int target_env_call( const List& args, const std::string& input, int timeout );
int target_env_call( const std::string& command, const std::string& input, int timeout );
int check_target_env_call( const List& args, const std::string& input, int timeout );
std::string check_target_env_output( const List& args, const std::string& input, int timeout );
......
......@@ -93,7 +93,13 @@ populate_utils( py::module_& m )
m.def( "load_yaml", &Calamares::Python::load_yaml, "Loads YAML from a file." );
m.def( "target_env_call",
&Calamares::Python::target_env_call,
py::overload_cast<const Calamares::Python::List& , const std::string& , int >(&Calamares::Python::target_env_call),
"Runs command_list in target, returns exit code.",
py::arg( "command_list" ),
py::arg( "input" ) = std::string(),
py::arg( "timeout" ) = 0 );
m.def( "target_env_call",
py::overload_cast<const std::string& , const std::string& , int >(&Calamares::Python::target_env_call),
"Runs command in target, returns exit code.",
py::arg( "command_list" ),
py::arg( "input" ) = std::string(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment