summaryrefslogtreecommitdiffstats
path: root/SCons/Conftest.py
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2023-05-01 17:54:48 (GMT)
committerMats Wichmann <mats@linux.com>2023-05-01 18:06:45 (GMT)
commit1a103470a13a83590b3fc06e8779494e2b99751d (patch)
treeab4b5fcdbc2504ff1436387dbe82db2dcedff22b /SCons/Conftest.py
parent0ef81fc03600cd275a8e6733aeca26e0db268dad (diff)
downloadSCons-1a103470a13a83590b3fc06e8779494e2b99751d.zip
SCons-1a103470a13a83590b3fc06e8779494e2b99751d.tar.gz
SCons-1a103470a13a83590b3fc06e8779494e2b99751d.tar.bz2
Add some cheap return and parameter annotations
Use: https://github.com/JelleZijlstra/autotyping to add "safe" return annotations. Where a parameter has a default value that is an obvious scalar type (bool, int, str, etc.) add those annotations as well. Also fixed two small bugs that popped up when sanity-checking with mypy. One in FortranCommon, where a return had been previously annotated to be a tuple of Action, which should be ActionBase - Action is the factory function, not the base class. The other was a typo in the error raised in _add_cppdefines - the message was formatted with the value of "define" which should have been "defines". Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'SCons/Conftest.py')
-rw-r--r--SCons/Conftest.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/SCons/Conftest.py b/SCons/Conftest.py
index 3c52ef4..3541bce 100644
--- a/SCons/Conftest.py
+++ b/SCons/Conftest.py
@@ -215,7 +215,7 @@ int main(void)
_YesNoResult(context, ret, None, text)
return ret
-def _check_empty_program(context, comp, text, language, use_shared = False):
+def _check_empty_program(context, comp, text, language, use_shared: bool = False):
"""Return 0 on success, 1 otherwise."""
if comp not in context.env or not context.env[comp]:
# The compiler construction variable is not set or empty
@@ -626,8 +626,8 @@ int main(void) {
return ret
def CheckLib(context, libs, func_name = None, header = None,
- extra_libs = None, call = None, language = None, autoadd = 1,
- append=True, unique=False):
+ extra_libs = None, call = None, language = None, autoadd: int = 1,
+ append: bool=True, unique: bool=False):
"""
Configure check for a C or C++ libraries "libs". Searches through
the list of libraries, until one is found where the test succeeds.
@@ -753,7 +753,7 @@ def CheckProg(context, prog_name):
# END OF PUBLIC FUNCTIONS
#
-def _YesNoResult(context, ret, key, text, comment = None):
+def _YesNoResult(context, ret, key, text, comment = None) -> None:
r"""
Handle the result of a test with a "yes" or "no" result.
@@ -772,7 +772,7 @@ def _YesNoResult(context, ret, key, text, comment = None):
context.Display("yes\n")
-def _Have(context, key, have, comment = None):
+def _Have(context, key, have, comment = None) -> None:
r"""
Store result of a test in context.havedict and context.headerfilename.
@@ -815,7 +815,7 @@ def _Have(context, key, have, comment = None):
context.config_h = context.config_h + lines
-def _LogFailed(context, text, msg):
+def _LogFailed(context, text, msg) -> None:
"""
Write to the log about a failed program.
Add line numbers, so that error messages can be understood.