CMake: Check module interfaces

- Only allow meaningful interface strings
 - Improve documentation of which interfaces work for
   which module types.
This commit is contained in:
Adriaan de Groot 2019-04-27 11:30:16 -04:00
parent f8bc40ba91
commit 6f9548af34
2 changed files with 19 additions and 1 deletions

View File

@ -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 )

View File

@ -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*.