From 3494131597b69a355474b348a4b890668e9f30be Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 6 May 2020 09:06:54 -0600 Subject: Commit the files changed for Sphinx docbuild [ci skip] Signed-off-by: Mats Wichmann --- SCons/Environment.py | 6 +++--- SCons/Errors.py | 7 ++----- SCons/Platform/__init__.py | 13 ++++++++----- SCons/Script/SConsOptions.py | 4 +++- SCons/Tool/dmd.py | 35 +++++++++++++++++++++++------------ SCons/Tool/intelc.py | 14 +++++++------- SCons/Tool/packaging/rpm.py | 22 ++++++++++++---------- SCons/Util.py | 27 ++++++++++++++++----------- SCons/cpp.py | 3 +-- doc/sphinx/index.rst | 2 +- 10 files changed, 76 insertions(+), 57 deletions(-) diff --git a/SCons/Environment.py b/SCons/Environment.py index cd52ee5..7d4db39 100644 --- a/SCons/Environment.py +++ b/SCons/Environment.py @@ -1502,11 +1502,11 @@ class Base(SubstitutionEnvironment): def Dictionary(self, *args): """Return construction variables from an environment. - :param *args: (optional) variable names to look up + :param args: (optional) variable names to look up :returns: if args omitted, the dictionary of all constr. vars. If one arg, the corresponding value is returned. If more than one arg, a list of values is returned. - :raises KeyError: if any of *args is not in the construction env. + :raises KeyError: if any of args is not in the construction env. """ if not args: @@ -2017,7 +2017,7 @@ class Base(SubstitutionEnvironment): pass else: del kw['target_factory'] - + bld = SCons.Builder.Builder(**bkw) return bld(self, target, source, **kw) diff --git a/SCons/Errors.py b/SCons/Errors.py index a3a891f..882ae82 100644 --- a/SCons/Errors.py +++ b/SCons/Errors.py @@ -35,13 +35,11 @@ import SCons.Util class BuildError(Exception): - """ Errors occurring while building. + """SCons Errors that can occur while building. - BuildError have the following attributes: - ========================================= + BuildError has the following attributes: Information about the cause of the build error: - ----------------------------------------------- errstr : a description of the error message @@ -71,7 +69,6 @@ class BuildError(Exception): Information about the cause of the location of the error: - --------------------------------------------------------- node : the error occured while building this target node(s) diff --git a/SCons/Platform/__init__.py b/SCons/Platform/__init__.py index 12db824..b6a7b97 100644 --- a/SCons/Platform/__init__.py +++ b/SCons/Platform/__init__.py @@ -58,8 +58,8 @@ import SCons.Tool def platform_default(): """Return the platform string for our execution environment. - The returned value should map to one of the SCons/Platform/*.py - files. Since we're architecture independent, though, we don't + The returned value should map to one of the SCons/Platform/\*.py + files. Since scons is architecture independent, though, we don't care about the machine architecture. """ osname = os.name @@ -136,20 +136,23 @@ class TempFileMunge: file substitution on it. This is used to circumvent the long command line limitation. - Example usage: + Example: + env["TEMPFILE"] = TempFileMunge env["LINKCOM"] = "${TEMPFILE('$LINK $TARGET $SOURCES','$LINKCOMSTR')}" By default, the name of the temporary file used begins with a prefix of '@'. This may be configured for other tool chains by - setting '$TEMPFILEPREFIX': + setting '$TEMPFILEPREFIX'. Example: + env["TEMPFILEPREFIX"] = '-@' # diab compiler env["TEMPFILEPREFIX"] = '-via' # arm tool chain env["TEMPFILEPREFIX"] = '' # (the empty string) PC Lint You can configure the extension of the temporary file through the TEMPFILESUFFIX variable, which defaults to '.lnk' (see comments - in the code below): + in the code below). Example: + env["TEMPFILESUFFIX"] = '.lnt' # PC Lint """ def __init__(self, cmd, cmdstr = None): diff --git a/SCons/Script/SConsOptions.py b/SCons/Script/SConsOptions.py index 10600b6..5d61e32 100644 --- a/SCons/Script/SConsOptions.py +++ b/SCons/Script/SConsOptions.py @@ -345,7 +345,8 @@ class SConsOptionParser(optparse.OptionParser): Else, this would lead to problems in add_local_option() below. When called from there, we try to reparse the - command-line arguments that + command-line arguments that: + 1. haven't been processed so far (self.largs), but 2. are possibly not added to the list of options yet. @@ -355,6 +356,7 @@ class SConsOptionParser(optparse.OptionParser): _match_long_opt(), which allows for partial matches of the option name, as long as the common prefix appears to be unique. + This would lead to further confusion, because we might want to add another option "--myarg" later on (see issue #2929). diff --git a/SCons/Tool/dmd.py b/SCons/Tool/dmd.py index 3cc4ed0..32b9c02 100644 --- a/SCons/Tool/dmd.py +++ b/SCons/Tool/dmd.py @@ -10,22 +10,33 @@ Evolved by Russel Winder (russel@winder.org.uk) 2010-02-07 onwards Compiler variables: - DC - The name of the D compiler to use. Defaults to dmd or gdmd, - whichever is found. - DPATH - List of paths to search for import modules. - DVERSIONS - List of version tags to enable when compiling. - DDEBUG - List of debug tags to enable when compiling. + + DC + The name of the D compiler to use. Defaults to dmd or gdmd, whichever is found. + DPATH + List of paths to search for import modules. + DVERSIONS + List of version tags to enable when compiling. + DDEBUG + List of debug tags to enable when compiling. Linker related variables: - LIBS - List of library files to link in. - DLINK - Name of the linker to use. Defaults to dmd or gdmd, - whichever is found. - DLINKFLAGS - List of linker flags. + + LIBS + List of library files to link in. + DLINK + Name of the linker to use. Defaults to dmd or gdmd, whichever is found. + DLINKFLAGS + List of linker flags. Lib tool variables: - DLIB - Name of the lib tool to use. Defaults to lib. - DLIBFLAGS - List of flags to pass to the lib tool. - LIBS - Same as for the linker. (libraries to pull into the .lib) + + DLIB + Name of the lib tool to use. Defaults to lib. + DLIBFLAGS + List of flags to pass to the lib tool. + LIBS + Same as for the linker. (libraries to pull into the .lib) """ # diff --git a/SCons/Tool/intelc.py b/SCons/Tool/intelc.py index 0880976..2242e60 100644 --- a/SCons/Tool/intelc.py +++ b/SCons/Tool/intelc.py @@ -387,13 +387,13 @@ def get_intel_compiler_top(version, abi): def generate(env, version=None, abi=None, topdir=None, verbose=0): r"""Add Builders and construction variables for Intel C/C++ compiler to an Environment. - args: - version: (string) compiler version to use, like "80" - abi: (string) 'win32' or whatever Itanium version wants - topdir: (string) compiler top dir, like - "c:\Program Files\Intel\Compiler70" - If topdir is used, version and abi are ignored. - verbose: (int) if >0, prints compiler version used. + + :param string version: compiler version to use, like "80" + :param string abi: 'win32' or whatever Itanium version wants + :param string topdir: directory containing compiler tree, e.g. + "c:\\Program Files\\Intel\\Compiler70". + If `topdir` is used, `version` and `abi` are ignored. + :param int verbose: if >0, prints compiler version used. """ if not (is_mac or is_linux or is_windows): # can't handle this platform diff --git a/SCons/Tool/packaging/rpm.py b/SCons/Tool/packaging/rpm.py index 0e44bf9..9e2bbb0 100644 --- a/SCons/Tool/packaging/rpm.py +++ b/SCons/Tool/packaging/rpm.py @@ -302,21 +302,23 @@ def build_specfile_filesection(spec, files): return str class SimpleTagCompiler: - """ This class is a simple string substition utility: - the replacement specfication is stored in the tagset dictionary, something - like: - { "abc" : "cdef %s ", - "abc_" : "cdef %s %s" } + """ Compile RPM tags by doing simple string substitution. - the compile function gets a value dictionary, which may look like: - { "abc" : "ghij", - "abc_gh" : "ij" } + The replacement specfication is stored in the *tagset* dictionary, + something like: + + {"abc" : "cdef %s ", "abc_": "cdef %s %s"} + + The :func:`compile` function gets a value dictionary, which may look like: + + {"abc": "ghij", "abc_gh": "ij"} The resulting string will be: - "cdef ghij cdef gh ij" + + "cdef ghij cdef gh ij" """ def __init__(self, tagset, mandatory=1): - self.tagset = tagset + self.tagset = tagset self.mandatory = mandatory def compile(self, values): diff --git a/SCons/Util.py b/SCons/Util.py index 1ec0cf8..effe4c4 100644 --- a/SCons/Util.py +++ b/SCons/Util.py @@ -1611,16 +1611,18 @@ def cmp(a, b): def get_env_bool(env, name, default=False): - """Get a value of env[name] converted to boolean. The value of env[name] is - interpreted as follows: 'true', 'yes', 'y', 'on' (case insensitive) and - anything convertible to int that yields non-zero integer are True values; - '0', 'false', 'no', 'n' and 'off' (case insensitive) are False values. For - all other cases, default value is returned. - - :Parameters: - - `env` - dict or dict-like object, a convainer with variables - - `name` - name of the variable in env to be returned - - `default` - returned when env[name] does not exist or can't be converted to bool + """Convert a construction variable to bool. + + If the value of *name* in *env* is 'true', 'yes', 'y', 'on' (case + insensitive) or anything convertible to int that yields non-zero then + return True; if 'false', 'no', 'n', 'off' (case insensitive) + or a number that converts to integer zero return False. + Otherwise, return *default*. + + :param env: construction environment, or any dict-like object + :param name: name of the variable + :param default: value to return if name not in env or cannot be converted (default: False) + :rtype: bool """ try: var = env[name] @@ -1638,7 +1640,10 @@ def get_env_bool(env, name, default=False): def get_os_env_bool(name, default=False): - """Same as get_env_bool(os.environ, name, default).""" + """Convert an environment variable to bool. + + Conversion is the same as for :func:`get_env_bool`. + """ return get_env_bool(os.environ, name, default) # Local Variables: diff --git a/SCons/cpp.py b/SCons/cpp.py index 1113be5..0811c71 100644 --- a/SCons/cpp.py +++ b/SCons/cpp.py @@ -603,8 +603,7 @@ class PreProcessor: This handles recursive expansion of values without "" or <> surrounding the name until an initial " or < is found, to handle - #include FILE - where FILE is a #define somewhere else. + #include FILE where FILE is a #define somewhere else. """ s = t[1].strip() while not s[0] in '<"': diff --git a/doc/sphinx/index.rst b/doc/sphinx/index.rst index 996d258..3c3ee0e 100644 --- a/doc/sphinx/index.rst +++ b/doc/sphinx/index.rst @@ -20,7 +20,7 @@ SCons Project API Documentation SCons.Tool.clangCommon SCons.Tool.docbook SCons.Tool.MSCommon - SCons.Tool.packaging. + SCons.Tool.packaging SCons.Variables -- cgit v0.12