|
3 | 3 |
|
4 | 4 |
|
5 | 5 | def check_min_compiler_version(conanfile, compiler_restrictions):
|
6 |
| - """ |
7 |
| - Checks if the current compiler and its version meet the minimum requirements |
8 |
| - specified in a list of restrictions. |
| 6 | + """(Experimental) Checks if the current compiler and its version meet the minimum requirements. |
| 7 | +
|
| 8 | + :param conanfile: The current recipe object. Always use ``self``. |
| 9 | + :param compiler_restrictions: |
| 10 | + A list of tuples, where each tuple contains: |
9 | 11 |
|
10 |
| - :param conanfile: The ConanFile object, which provides access to |
11 |
| - settings like `conanfile.settings.compiler` and |
12 |
| - `conanfile.settings.compiler.version`. |
13 |
| - :param compiler_restrictions: A list of tuples, where each tuple contains |
14 |
| - (compiler, min_version, reason). |
15 |
| - - compiler (str): The name of the compiler (e.g., "gcc", "msvc"). |
16 |
| - - min_version (str): The minimum required version as a string (e.g., "14", "19.0"). |
17 |
| - - reason (str): A string explaining the reason for the version requirement. |
| 12 | + - **compiler** (*str*): The name of the compiler (e.g., "gcc", "msvc"). |
| 13 | + - **min_version** (*str*): The minimum required version as a string (e.g., "14", "19.0"). |
| 14 | + - **reason** (*str*): A string explaining the reason for the version requirement. |
| 15 | + :raises ConanException: |
| 16 | + If the 'compiler' or 'compiler.version' settings are not defined. |
| 17 | + :raises ConanInvalidConfiguration: |
| 18 | + If the found compiler version is less than the specified minimum version for that compiler. |
18 | 19 |
|
19 |
| - Raises: |
20 |
| - ConanException: If the 'compiler' or 'compiler.version' settings are not |
21 |
| - defined in the Conan file's settings. |
22 |
| - ConanInvalidConfiguration: If the found compiler version is less than the |
23 |
| - specified minimum version for that compiler. |
| 20 | + :Example: |
| 21 | + .. code-block:: python |
24 | 22 |
|
25 |
| - Example: |
26 |
| - def validate(self): |
27 |
| - compiler_restrictions = [ |
28 |
| - ("clang", "14", "requires C++20 coroutines support"), |
29 |
| - ("gcc", "12", "requires C++20 modules support") |
30 |
| - ] |
31 |
| - check_min_compiler_version(self, compiler_restrictions) |
| 23 | + def validate(self): |
| 24 | + compiler_restrictions = [ |
| 25 | + ("clang", "14", "requires C++20 coroutines support"), |
| 26 | + ("gcc", "12", "requires C++20 modules support") |
| 27 | + ] |
| 28 | + check_min_compiler_version(self, compiler_restrictions) |
32 | 29 | """
|
33 | 30 | compiler_value = conanfile.settings.get_safe("compiler")
|
34 | 31 | if not compiler_value:
|
|
0 commit comments