libcalamares: apply coding style
This commit is contained in:
parent
ac265e6ff7
commit
6e9dac3417
@ -258,9 +258,10 @@ PythonJob::exec()
|
|||||||
QDir workingDir( m_workingPath );
|
QDir workingDir( m_workingPath );
|
||||||
if ( !workingDir.exists() || !workingDir.isReadable() )
|
if ( !workingDir.exists() || !workingDir.isReadable() )
|
||||||
{
|
{
|
||||||
return JobResult::error(
|
return JobResult::error( tr( "Bad working directory path", "@error" ),
|
||||||
tr( "Bad working directory path", "@error" ),
|
tr( "Working directory %1 for python job %2 is not readable.", "@error" )
|
||||||
tr( "Working directory %1 for python job %2 is not readable.", "@error" ).arg( m_workingPath ).arg( prettyName() ) );
|
.arg( m_workingPath )
|
||||||
|
.arg( prettyName() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo scriptFI( workingDir.absoluteFilePath( m_scriptFile ) );
|
QFileInfo scriptFI( workingDir.absoluteFilePath( m_scriptFile ) );
|
||||||
@ -339,8 +340,9 @@ PythonJob::exec()
|
|||||||
}
|
}
|
||||||
bp::handle_exception();
|
bp::handle_exception();
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
return JobResult::internalError(
|
return JobResult::internalError( tr( "Boost.Python error in job \"%1\"", "@error" ).arg( prettyName() ),
|
||||||
tr( "Boost.Python error in job \"%1\"", "@error" ).arg( prettyName() ), msg, JobResult::PythonUncaughtException );
|
msg,
|
||||||
|
JobResult::PythonUncaughtException );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,10 +272,10 @@ Job::exec()
|
|||||||
// Now `import libcalamares` in modules will find the already-
|
// Now `import libcalamares` in modules will find the already-
|
||||||
// loaded module.
|
// loaded module.
|
||||||
auto scope = py::module_::import( "__main__" ).attr( "__dict__" );
|
auto scope = py::module_::import( "__main__" ).attr( "__dict__" );
|
||||||
scope["libcalamares"] = calamaresModule;
|
scope[ "libcalamares" ] = calamaresModule;
|
||||||
|
|
||||||
auto sys = scope["sys"].attr("modules");
|
auto sys = scope[ "sys" ].attr( "modules" );
|
||||||
sys["libcalamares"] = calamaresModule;
|
sys[ "libcalamares" ] = calamaresModule;
|
||||||
|
|
||||||
calamaresModule.attr( "job" ) = Calamares::Python::JobProxy( this );
|
calamaresModule.attr( "job" ) = Calamares::Python::JobProxy( this );
|
||||||
calamaresModule.attr( "globalstorage" )
|
calamaresModule.attr( "globalstorage" )
|
||||||
|
@ -98,8 +98,10 @@ log_implementation( const char* msg, unsigned int debugLevel, const char* funcin
|
|||||||
logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel << "]: " << funcinfo
|
logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel << "]: " << funcinfo
|
||||||
<< '\n';
|
<< '\n';
|
||||||
}
|
}
|
||||||
if (msg) {
|
if ( msg )
|
||||||
logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel << (funcinfo ? "]: " : "]: ") << msg << '\n';
|
{
|
||||||
|
logfile << date.toUtf8().data() << " - " << time.toUtf8().data() << " [" << debugLevel
|
||||||
|
<< ( funcinfo ? "]: " : "]: " ) << msg << '\n';
|
||||||
}
|
}
|
||||||
logfile.flush();
|
logfile.flush();
|
||||||
|
|
||||||
@ -107,10 +109,11 @@ log_implementation( const char* msg, unsigned int debugLevel, const char* funcin
|
|||||||
{
|
{
|
||||||
if ( funcinfo )
|
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)
|
// 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 )
|
CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& msg )
|
||||||
{
|
{
|
||||||
unsigned int level = LOGVERBOSE;
|
unsigned int level = LOGVERBOSE;
|
||||||
const char * funcinfo = nullptr;
|
const char* funcinfo = nullptr;
|
||||||
switch ( type )
|
switch ( type )
|
||||||
{
|
{
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
@ -145,7 +148,8 @@ CalamaresLogHandler( QtMsgType type, const QMessageLogContext&, const QString& m
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_implementation( nullptr, level, (QString(funcinfo) + QStringLiteral(" (Qt): ") + msg).toUtf8().constData() );
|
log_implementation(
|
||||||
|
nullptr, level, ( QString( funcinfo ) + QStringLiteral( " (Qt): " ) + msg ).toUtf8().constData() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
|
Loading…
Reference in New Issue
Block a user