Skip to content

Commit fa5bfbb

Browse files
perseoGImemsharded
andauthored
Fix docstring making compatible with sphinx (#18857)
* Fix docstring making compatible with sphinx * Update conan/tools/build/compiler.py Co-authored-by: James <memsharded@gmail.com> --------- Co-authored-by: James <memsharded@gmail.com>
1 parent ee8bcf0 commit fa5bfbb

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

conan/tools/build/compiler.py

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,29 @@
33

44

55
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:
911
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.
1819
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
2422
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)
3229
"""
3330
compiler_value = conanfile.settings.get_safe("compiler")
3431
if not compiler_value:

0 commit comments

Comments
 (0)