diff --git a/src/libcalamares/PythonJobApi.cpp b/src/libcalamares/PythonJobApi.cpp index 5d0960885..595f53a76 100644 --- a/src/libcalamares/PythonJobApi.cpp +++ b/src/libcalamares/PythonJobApi.cpp @@ -46,50 +46,50 @@ mount( const std::string& device_path, const std::string& options ) { return CalamaresUtils::System::instance()-> - mount( QString::fromStdString( device_path ), - QString::fromStdString( mount_point ), - QString::fromStdString( filesystem_name ), - QString::fromStdString( options ) ); + mount( QString::fromStdString( device_path ), + QString::fromStdString( mount_point ), + QString::fromStdString( filesystem_name ), + QString::fromStdString( options ) ); } int target_env_call( const std::string& command, - const std::string& stdin, - int timeout ) + const std::string& stdin, + int timeout ) { return CalamaresUtils::System::instance()-> - targetEnvCall( QString::fromStdString( command ), - QString(), - QString::fromStdString( stdin ), - timeout ); + targetEnvCall( QString::fromStdString( command ), + QString(), + QString::fromStdString( stdin ), + timeout ); } int target_env_call( const bp::list& args, - const std::string& stdin, - int timeout ) + const std::string& stdin, + int timeout ) { QStringList list; for ( int i = 0; i < bp::len( args ); ++i ) { list.append( QString::fromStdString( - bp::extract< std::string >( args[ i ] ) ) ); + bp::extract< std::string >( args[ i ] ) ) ); } return CalamaresUtils::System::instance()-> - targetEnvCall( list, - QString(), - QString::fromStdString( stdin ), - timeout ); + targetEnvCall( list, + QString(), + QString::fromStdString( stdin ), + timeout ); } int check_target_env_call( const std::string& command, - const std::string& stdin, - int timeout ) + const std::string& stdin, + int timeout ) { int ec = target_env_call( command, stdin, timeout ); return _handle_check_target_env_call_error( ec, QString::fromStdString( command ) ); @@ -98,8 +98,8 @@ check_target_env_call( const std::string& command, int check_target_env_call( const bp::list& args, - const std::string& stdin, - int timeout ) + const std::string& stdin, + int timeout ) { int ec = target_env_call( args, stdin, timeout ); if ( !ec ) @@ -109,7 +109,7 @@ check_target_env_call( const bp::list& args, for ( int i = 0; i < bp::len( args ); ++i ) { failedCmdList.append( QString::fromStdString( - bp::extract< std::string >( args[ i ] ) ) ); + bp::extract< std::string >( args[ i ] ) ) ); } return _handle_check_target_env_call_error( ec, failedCmdList.join( ' ' ) ); @@ -118,8 +118,8 @@ check_target_env_call( const bp::list& args, std::string check_target_env_output( const std::string& command, - const std::string& stdin, - int timeout ) + const std::string& stdin, + int timeout ) { QString output; int ec = CalamaresUtils::System::instance()-> @@ -135,15 +135,15 @@ check_target_env_output( const std::string& command, std::string check_target_env_output( const bp::list& args, - const std::string& stdin, - int timeout ) + const std::string& stdin, + int timeout ) { QString output; QStringList list; for ( int i = 0; i < bp::len( args ); ++i ) { list.append( QString::fromStdString( - bp::extract< std::string >( args[ i ] ) ) ); + bp::extract< std::string >( args[ i ] ) ) ); } int ec = CalamaresUtils::System::instance()-> @@ -165,8 +165,8 @@ _handle_check_target_env_call_error( int ec, const QString& cmd ) QString raise = QString( "import subprocess\n" "raise subprocess.CalledProcessError(%1,\"%2\")" ) - .arg( ec ) - .arg( cmd ); + .arg( ec ) + .arg( cmd ); bp::exec( raise.toStdString().c_str() ); bp::throw_error_already_set(); return ec; @@ -226,16 +226,16 @@ _gettext_languages() if ( lang_.canConvert< QString >() ) { QString lang = lang_.value< QString >(); - languages.append(lang); - if ( lang.indexOf( '.' ) > 0) + languages.append( lang ); + if ( lang.indexOf( '.' ) > 0 ) { lang.truncate( lang.indexOf( '.' ) ); - languages.append(lang); + languages.append( lang ); } - if ( lang.indexOf( '_' ) > 0) + if ( lang.indexOf( '_' ) > 0 ) { lang.truncate( lang.indexOf( '_' ) ); - languages.append(lang); + languages.append( lang ); } } } @@ -246,21 +246,19 @@ bp::list gettext_languages() { bp::list pyList; - for (auto lang : _gettext_languages()) + for ( auto lang : _gettext_languages() ) pyList.append( lang.toStdString() ); return pyList; } static void -_add_localedirs(QStringList &pathList, const QString &candidate) +_add_localedirs( QStringList& pathList, const QString& candidate ) { - if (!candidate.isEmpty() && !pathList.contains(candidate)) + if ( !candidate.isEmpty() && !pathList.contains( candidate ) ) { - pathList.prepend(candidate); - if (QDir(candidate).cd("lang")) - { - pathList.prepend(candidate + "/lang"); - } + pathList.prepend( candidate ); + if ( QDir( candidate ).cd( "lang" ) ) + pathList.prepend( candidate + "/lang" ); } } @@ -269,27 +267,25 @@ gettext_path() { // TODO: distinguish between -d runs and normal runs // TODO: can we detect DESTDIR-installs? - QStringList candidatePaths = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "locale", QStandardPaths::LocateDirectory); + QStringList candidatePaths = QStandardPaths::locateAll( QStandardPaths::GenericDataLocation, "locale", QStandardPaths::LocateDirectory ); QString extra = QCoreApplication::applicationDirPath(); - _add_localedirs(candidatePaths, extra); // Often /usr/local/bin + _add_localedirs( candidatePaths, extra ); // Often /usr/local/bin if ( !extra.isEmpty() ) { - QDir d(extra); - if (d.cd("../share/locale")) // Often /usr/local/bin/../share/locale -> /usr/local/share/locale - { - _add_localedirs(candidatePaths, d.canonicalPath()); - } + QDir d( extra ); + if ( d.cd( "../share/locale" ) ) // Often /usr/local/bin/../share/locale -> /usr/local/share/locale + _add_localedirs( candidatePaths, d.canonicalPath() ); } - _add_localedirs(candidatePaths, QDir().canonicalPath()); // . + _add_localedirs( candidatePaths, QDir().canonicalPath() ); // . cDebug() << "Standard paths" << candidatePaths; - for (auto lang : _gettext_languages()) - for (auto localedir : candidatePaths) + for ( auto lang : _gettext_languages() ) + for ( auto localedir : candidatePaths ) { - QDir ldir(localedir); + QDir ldir( localedir ); cDebug() << "Checking" << lang << "in" <