GitHubのミラーです
https://github.com/FascodeNet/alterlinux-calamares
Révision | 96aa5b45328a4c2f76a016aa2c5cf4fd141ed0d6 (tree) |
---|---|
l'heure | 2021-09-27 21:27:50 |
Auteur | Adriaan de Groot <groot@kde....> |
Commiter | Adriaan de Groot |
Merge branch 'improve-loadmodule' into calamares
@@ -71,22 +71,20 @@ handle_args( QCoreApplication& a ) | ||
71 | 71 | { |
72 | 72 | QCommandLineOption debugLevelOption( |
73 | 73 | QStringLiteral( "D" ), "Verbose output for debugging purposes (0-8), ignored.", "level" ); |
74 | - QCommandLineOption globalOption( QStringList() << QStringLiteral( "g" ) << QStringLiteral( "global " ), | |
74 | + QCommandLineOption globalOption( { QStringLiteral( "g" ), QStringLiteral( "global" ) }, | |
75 | 75 | QStringLiteral( "Global settings document" ), |
76 | 76 | "global.yaml" ); |
77 | - QCommandLineOption jobOption( QStringList() << QStringLiteral( "j" ) << QStringLiteral( "job" ), | |
78 | - QStringLiteral( "Job settings document" ), | |
79 | - "job.yaml" ); | |
80 | - QCommandLineOption langOption( QStringList() << QStringLiteral( "l" ) << QStringLiteral( "language" ), | |
77 | + QCommandLineOption jobOption( | |
78 | + { QStringLiteral( "j" ), QStringLiteral( "job" ) }, QStringLiteral( "Job settings document" ), "job.yaml" ); | |
79 | + QCommandLineOption langOption( { QStringLiteral( "l" ), QStringLiteral( "language" ) }, | |
81 | 80 | QStringLiteral( "Language (global)" ), |
82 | 81 | "languagecode" ); |
83 | - QCommandLineOption brandOption( QStringList() << QStringLiteral( "b" ) << QStringLiteral( "branding" ), | |
82 | + QCommandLineOption brandOption( { QStringLiteral( "b" ), QStringLiteral( "branding" ) }, | |
84 | 83 | QStringLiteral( "Branding directory" ), |
85 | 84 | "path/to/branding.desc", |
86 | 85 | "src/branding/default/branding.desc" ); |
87 | - QCommandLineOption uiOption( QStringList() << QStringLiteral( "U" ) << QStringLiteral( "ui" ), | |
88 | - QStringLiteral( "Enable UI" ) ); | |
89 | - QCommandLineOption slideshowOption( QStringList() << QStringLiteral( "s" ) << QStringLiteral( "slideshow" ), | |
86 | + QCommandLineOption uiOption( { QStringLiteral( "U" ), QStringLiteral( "ui" ) }, QStringLiteral( "Enable UI" ) ); | |
87 | + QCommandLineOption slideshowOption( { QStringLiteral( "s" ), QStringLiteral( "slideshow" ) }, | |
90 | 88 | QStringLiteral( "Run slideshow module" ) ); |
91 | 89 | QCommandLineParser parser; |
92 | 90 | parser.setApplicationDescription( "Calamares module tester" ); |
@@ -101,7 +99,7 @@ handle_args( QCoreApplication& a ) | ||
101 | 99 | parser.addOption( uiOption ); |
102 | 100 | parser.addOption( slideshowOption ); |
103 | 101 | #ifdef WITH_PYTHON |
104 | - QCommandLineOption pythonOption( QStringList() << QStringLiteral( "P" ) << QStringLiteral( "no-injected-python" ), | |
102 | + QCommandLineOption pythonOption( { QStringLiteral( "P" ), QStringLiteral( "no-injected-python" ) }, | |
105 | 103 | QStringLiteral( "Do not disable potentially-harmful Python commands" ) ); |
106 | 104 | parser.addOption( pythonOption ); |
107 | 105 | #endif |
@@ -143,8 +141,7 @@ handle_args( QCoreApplication& a ) | ||
143 | 141 | parser.value( langOption ), |
144 | 142 | parser.value( brandOption ), |
145 | 143 | parser.isSet( slideshowOption ) || parser.isSet( uiOption ), |
146 | - pythonInjection | |
147 | - }; | |
144 | + pythonInjection }; | |
148 | 145 | } |
149 | 146 | } |
150 | 147 |
@@ -299,7 +296,8 @@ load_module( const ModuleConfig& moduleConfig ) | ||
299 | 296 | bool ok = false; |
300 | 297 | QVariantMap descriptor; |
301 | 298 | |
302 | - for ( const QString& prefix : QStringList { "./", "src/modules/", "modules/" } ) | |
299 | + QStringList moduleDirectories { "./", "src/modules/", "modules/", CMAKE_INSTALL_FULL_LIBDIR "/calamares/modules/" }; | |
300 | + for ( const QString& prefix : qAsConst( moduleDirectories ) ) | |
303 | 301 | { |
304 | 302 | // Could be a complete path, eg. src/modules/dummycpp/module.desc |
305 | 303 | fi = QFileInfo( prefix + moduleName ); |
@@ -325,12 +323,23 @@ load_module( const ModuleConfig& moduleConfig ) | ||
325 | 323 | { |
326 | 324 | break; |
327 | 325 | } |
326 | + else | |
327 | + { | |
328 | + if ( !fi.exists() ) | |
329 | + { | |
330 | + cDebug() << "Expected a descriptor file" << fi.path(); | |
331 | + } | |
332 | + else | |
333 | + { | |
334 | + cDebug() << "Read descriptor" << fi.path() << "and it was empty."; | |
335 | + } | |
336 | + } | |
328 | 337 | } |
329 | 338 | } |
330 | 339 | |
331 | 340 | if ( !ok ) |
332 | 341 | { |
333 | - cWarning() << "No suitable module descriptor found."; | |
342 | + cWarning() << "No suitable module descriptor found in" << Logger::DebugList( moduleDirectories ); | |
334 | 343 | return nullptr; |
335 | 344 | } |
336 | 345 |
@@ -461,7 +470,7 @@ main( int argc, char* argv[] ) | ||
461 | 470 | #ifdef WITH_PYTHON |
462 | 471 | if ( module.m_pythonInjection ) |
463 | 472 | { |
464 | - Calamares::PythonJob::setInjectedPreScript(pythonPreScript); | |
473 | + Calamares::PythonJob::setInjectedPreScript( pythonPreScript ); | |
465 | 474 | } |
466 | 475 | #endif |
467 | 476 | #ifdef WITH_QML |
@@ -330,7 +330,8 @@ void | ||
330 | 330 | PythonJob::setInjectedPreScript( const char* preScript ) |
331 | 331 | { |
332 | 332 | s_preScript = preScript; |
333 | - cDebug() << "Python pre-script set to" << Logger::Pointer( preScript ); | |
333 | + cDebug() << "Python pre-script set to string" << Logger::Pointer( preScript ) << "length" | |
334 | + << ( preScript ? strlen( preScript ) : 0 ); | |
334 | 335 | } |
335 | 336 | |
336 | 337 | } // namespace Calamares |