libcalamares: apply coding style

This commit is contained in:
Adriaan de Groot 2023-11-07 23:43:09 +01:00
parent ac265e6ff7
commit 6e9dac3417
3 changed files with 20 additions and 14 deletions

View File

@ -258,9 +258,10 @@ PythonJob::exec()
QDir workingDir( m_workingPath );
if ( !workingDir.exists() || !workingDir.isReadable() )
{
return JobResult::error(
tr( "Bad working directory path", "@error" ),
tr( "Working directory %1 for python job %2 is not readable.", "@error" ).arg( m_workingPath ).arg( prettyName() ) );
return JobResult::error( tr( "Bad working directory path", "@error" ),
tr( "Working directory %1 for python job %2 is not readable.", "@error" )
.arg( m_workingPath )
.arg( prettyName() ) );
}
QFileInfo scriptFI( workingDir.absoluteFilePath( m_scriptFile ) );
@ -339,8 +340,9 @@ PythonJob::exec()
}
bp::handle_exception();
PyErr_Clear();
return JobResult::internalError(
tr( "Boost.Python error in job \"%1\"", "@error" ).arg( prettyName() ), msg, JobResult::PythonUncaughtException );
return JobResult::internalError( tr( "Boost.Python error in job \"%1\"", "@error" ).arg( prettyName() ),
msg,
JobResult::PythonUncaughtException );
}
}

View File

@ -272,10 +272,10 @@ Job::exec()
// Now `import libcalamares` in modules will find the already-
// loaded module.
auto scope = py::module_::import( "__main__" ).attr( "__dict__" );
scope["libcalamares"] = calamaresModule;
scope[ "libcalamares" ] = calamaresModule;
auto sys = scope["sys"].attr("modules");
sys["libcalamares"] = calamaresModule;
auto sys = scope[ "sys" ].attr( "modules" );
sys[ "libcalamares" ] = calamaresModule;
calamaresModule.attr( "job" ) = Calamares::Python::JobProxy( this );
calamaresModule.attr( "globalstorage" )

View File

@ -98,8 +98,10 @@ log_implementation( const char* msg, unsigned int debugLevel, const char* funcin
logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel << "]: " << funcinfo
<< '\n';
}
if (msg) {
logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel << (funcinfo ? "]: " : "]: ") << msg << '\n';
if ( msg )
{
logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel
<< ( funcinfo ? "]: " : "]: " ) << msg << '\n';
}
logfile.flush();
@ -107,10 +109,11 @@ log_implementation( const char* msg, unsigned int debugLevel, const char* funcin
{
if ( funcinfo )
{
std::cout << time.toUtf8().data() << " [" << debugLevel << "]: " << funcinfo << (msg ? s_Continuation : "");
std::cout << time.toUtf8().data() << " [" << debugLevel << "]: " << funcinfo
<< ( msg ? s_Continuation : "" );
}
// The endl is desired, since it also flushes (like the logfile, above)
std::cout << (msg ? msg : "") << std::endl;
std::cout << ( msg ? msg : "" ) << std::endl;
}
}
@ -118,7 +121,7 @@ static void
CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& msg )
{
unsigned int level = LOGVERBOSE;
const char * funcinfo = nullptr;
const char* funcinfo = nullptr;
switch ( type )
{
case QtInfoMsg:
@ -145,7 +148,8 @@ CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& m
return;
}
log_implementation( nullptr, level, (QString(funcinfo) + QStringLiteral(" (Qt): ") + msg).toUtf8().constData() );
log_implementation(
nullptr, level, ( QString( funcinfo ) + QStringLiteral( " (Qt): " ) + msg ).toUtf8().constData() );
}
QString