From 6f9548af34e33f95cbf35988186755fc57342555 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Sat, 27 Apr 2019 11:30:16 -0400 Subject: [PATCH] CMake: Check module interfaces - Only allow meaningful interface strings - Improve documentation of which interfaces work for which module types. --- CMakeModules/CalamaresAddModuleSubdirectory.cmake | 8 +++++++- src/modules/README.md | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CMakeModules/CalamaresAddModuleSubdirectory.cmake b/CMakeModules/CalamaresAddModuleSubdirectory.cmake index 74ff640d9..2e0a80723 100644 --- a/CMakeModules/CalamaresAddModuleSubdirectory.cmake +++ b/CMakeModules/CalamaresAddModuleSubdirectory.cmake @@ -71,9 +71,15 @@ function( calamares_add_module_subdirectory ) elseif ( MODULE_INTERFACE MATCHES "python" ) set( _mod_enabled ${WITH_PYTHON} ) set( _mod_reason "No Python support" ) - else() + elseif ( MODULE_INTERFACE MATCHES "qtplugin" ) + set( _mod_enabled OFF ) + set( _mod_reason "C++ modules must have a CMakeLists.txt instead" ) + elseif ( MODULE_INTERFACE MATCHES "process" ) set( _mod_enabled ON ) set( _mod_reason "" ) + else() + set( _mod_enabled OFF ) + set( _mod_reason "Unknown module interface '${MODULE_INTERFACE}'" ) endif() if ( _mod_enabled ) diff --git a/src/modules/README.md b/src/modules/README.md index 7f67cfe6d..5a7a16f37 100644 --- a/src/modules/README.md +++ b/src/modules/README.md @@ -112,6 +112,9 @@ in `/etc/calamares/modules`. ## C++ modules +> Type: viewmodule, jobmodule +> Interface: qtplugin + Currently the recommended way to write a module which exposes one or more installer pages (viewmodule) is through a C++ and Qt plugin. Viewmodules must implement `Calamares::ViewStep`. They can also implement `Calamares::Job` @@ -152,6 +155,9 @@ fakes a limited Calamares Python environment for running a single jobmodule. ### Python Jobmodule +> Type: jobmodule +> Interface: python + A Python jobmodule is a Python program which imports libcalamares and has a function `run()` as entry point. The function `run()` must return `None` if everything went well, or a tuple `(str,str)` with an error message and @@ -165,6 +171,9 @@ description if something went wrong. ## PythonQt modules +> Type: viewmodule, jobmodule +> Interface: pythonqt + The PythonQt modules are considered experimental and may be removed again due to low uptake. Their documentation is also almost completely lacking. @@ -186,6 +195,9 @@ a subclass of something. ## Process jobmodules +> Type: jobmodule +> Interface: process + A process jobmodule runs a (single) command. The interface is *process*, while the module type must be *job* or *jobmodule*.