summaryrefslogtreecommitdiff
path: root/engine/SCons/Conftest.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-09-28 10:21:25 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-09-28 10:21:25 +0200
commit4f3ca5f60f4de1aca6e3b9d7f30467ba0f724c27 (patch)
treed47e14dc637e15861e9ba7d65e5f4aae5d79df6d /engine/SCons/Conftest.py
parent3765e33b76c51c81dd7bbbfacab0c4e76a1713cb (diff)
parent7c651e273c4db37f4babd91aaecf26800c50dd79 (diff)
Updated version 3.0.0 from 'upstream/3.0.0'
with Debian dir f5f84710e04b09c178d76c96bcda7517932c0c17
Diffstat (limited to 'engine/SCons/Conftest.py')
-rw-r--r--engine/SCons/Conftest.py45
1 files changed, 24 insertions, 21 deletions
diff --git a/engine/SCons/Conftest.py b/engine/SCons/Conftest.py
index 87a3022..abaf00d 100644
--- a/engine/SCons/Conftest.py
+++ b/engine/SCons/Conftest.py
@@ -101,7 +101,6 @@ Autoconf-like configuration support; low level implementation of tests.
#
import re
-from types import IntType
#
# PUBLIC VARIABLES
@@ -707,11 +706,12 @@ def CheckProg(context, prog_name):
def _YesNoResult(context, ret, key, text, comment = None):
"""
Handle the result of a test with a "yes" or "no" result.
- "ret" is the return value: empty if OK, error message when not.
- "key" is the name of the symbol to be defined (HAVE_foo).
- "text" is the source code of the program used for testing.
- "comment" is the C comment to add above the line defining the symbol (the
- comment is automatically put inside a /* */). If None, no comment is added.
+
+ :Parameters:
+ - `ret` is the return value: empty if OK, error message when not.
+ - `key` is the name of the symbol to be defined (HAVE_foo).
+ - `text` is the source code of the program used for testing.
+ - `comment` is the C comment to add above the line defining the symbol (the comment is automatically put inside a /\* \*/). If None, no comment is added.
"""
if key:
_Have(context, key, not ret, comment)
@@ -725,18 +725,20 @@ def _YesNoResult(context, ret, key, text, comment = None):
def _Have(context, key, have, comment = None):
"""
Store result of a test in context.havedict and context.headerfilename.
- "key" is a "HAVE_abc" name. It is turned into all CAPITALS and non-
- alphanumerics are replaced by an underscore.
+
+ :Parameters:
+ - `key` - is a "HAVE_abc" name. It is turned into all CAPITALS and non-alphanumerics are replaced by an underscore.
+ - `have` - value as it should appear in the header file, include quotes when desired and escape special characters!
+ - `comment` is the C comment to add above the line defining the symbol (the comment is automatically put inside a /\* \*/). If None, no comment is added.
+
+
The value of "have" can be:
- 1 - Feature is defined, add "#define key".
- 0 - Feature is not defined, add "/* #undef key */".
- Adding "undef" is what autoconf does. Not useful for the
- compiler, but it shows that the test was done.
- number - Feature is defined to this number "#define key have".
- Doesn't work for 0 or 1, use a string then.
- string - Feature is defined to this string "#define key have".
- Give "have" as is should appear in the header file, include quotes
- when desired and escape special characters!
+ - 1 - Feature is defined, add "#define key".
+ - 0 - Feature is not defined, add "/\* #undef key \*/". Adding "undef" is what autoconf does. Not useful for the compiler, but it shows that the test was done.
+ - number - Feature is defined to this number "#define key have". Doesn't work for 0 or 1, use a string then.
+ - string - Feature is defined to this string "#define key have".
+
+
"""
key_up = key.upper()
key_up = re.sub('[^A-Z0-9_]', '_', key_up)
@@ -745,7 +747,7 @@ def _Have(context, key, have, comment = None):
line = "#define %s 1\n" % key_up
elif have == 0:
line = "/* #undef %s */\n" % key_up
- elif isinstance(have, IntType):
+ elif isinstance(have, int):
line = "#define %s %d\n" % (key_up, have)
else:
line = "#define %s %s\n" % (key_up, str(have))
@@ -787,10 +789,11 @@ def _lang2suffix(lang):
When "lang" is empty or None C is assumed.
Returns a tuple (lang, suffix, None) when it works.
For an unrecognized language returns (None, None, msg).
+
Where:
- lang = the unified language name
- suffix = the suffix, including the leading dot
- msg = an error message
+ - lang = the unified language name
+ - suffix = the suffix, including the leading dot
+ - msg = an error message
"""
if not lang or lang in ["C", "c"]:
return ("C", ".c", None)