From 7ea666723c18c7fbd13fe282697591a0a2fd26d2 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 27 May 2020 12:10:44 -0600 Subject: More sphinx build tweaks [ci skip] Signed-off-by: Mats Wichmann --- SCons/Environment.py | 39 ++++++++++++++++++++++++--------------- SCons/Script/SConsOptions.py | 2 +- SCons/Variables/__init__.py | 43 +++++++++++++++++++++++++------------------ doc/sphinx/conf.py | 2 +- 4 files changed, 51 insertions(+), 35 deletions(-) diff --git a/SCons/Environment.py b/SCons/Environment.py index 28906ea..188631e 100644 --- a/SCons/Environment.py +++ b/SCons/Environment.py @@ -1500,13 +1500,18 @@ class Base(SubstitutionEnvironment): def Dictionary(self, *args): - r"""Return construction variables from an environment. + """Return construction variables from an environment. - :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. + Args: + args: (optional) variable names to look up + + Returns: + if args omitted, the dictionary of all consvars. + 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. """ if not args: @@ -1520,12 +1525,13 @@ class Base(SubstitutionEnvironment): def Dump(self, key=None, format='pretty'): """ Serialize the construction variables to a string. - :param key: if None, format the whole dict of variables. - Else look up and format just the value for key. - - :param format: specify the format of the variables to be serialized: + Args: + key: if None, format the whole dict of variables. + Else format just the value for key (Default value = None) + format: specify the format of the variables to be serialized: - pretty: pretty-printed string. - json: JSON-formatted string. + (Default value = None) """ if key: @@ -1556,12 +1562,15 @@ class Base(SubstitutionEnvironment): def FindIxes(self, paths, prefix, suffix): - """ - Search a list of paths for something that matches the prefix and suffix. + """Search a list of paths for something that matches the prefix and suffix. + + Args: + paths: the list of paths or nodes. + prefix: construction variable for the prefix. + suffix: construction variable for the suffix. + + Returns: the matched path or None - paths - the list of paths or nodes. - prefix - construction variable for the prefix. - suffix - construction variable for the suffix. """ suffix = self.subst('$'+suffix) diff --git a/SCons/Script/SConsOptions.py b/SCons/Script/SConsOptions.py index 9d5fb47..ffd3c4a 100644 --- a/SCons/Script/SConsOptions.py +++ b/SCons/Script/SConsOptions.py @@ -345,7 +345,7 @@ 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. diff --git a/SCons/Variables/__init__.py b/SCons/Variables/__init__.py index 59b63eb..832ee58 100644 --- a/SCons/Variables/__init__.py +++ b/SCons/Variables/__init__.py @@ -49,16 +49,22 @@ class Variables: Holds all the options, updates the environment with the variables, and renders the help text. """ - instance=None + instance = None - def __init__(self, files=None, args=None, is_global=1): - """ - files - [optional] List of option configuration files to load - (backward compatibility) If a single string is passed it is - automatically placed in a file list - args - dictionary to override values set from files. - """ + def __init__(self, files=None, args=None, is_global=True): + """Create Variables instance. + + If is_global is True, this is a singleton, create only once. + + Args: + files: [optional] List of option configuration files to load + (backward compatibility). If a single string is passed it is + automatically placed in a file list (Default value = None) + args - dictionary to override values set from files. + (Default value = None) + is_global - global instance? (Default value = True) + """ if args is None: args = {} self.options = [] @@ -112,18 +118,19 @@ class Variables: return [o.key for o in self.options] def Add(self, key, help="", default=None, validator=None, converter=None, **kw): - """ - Add an option. + """Add an option. + + Args: + key: the name of the variable, or a list or tuple of arguments + help: optional help text for the options (Default value = "") + default: optional default value for option (Default value = None) + validator: optional function called to validate the option's value + (Default value = None) + converter: optional function to be called to convert the option's + value before putting it in the environment. (Default value = None) + kw: keyword args, unused. - - @param key: the name of the variable, or a list or tuple of arguments - @param help: optional help text for the options - @param default: optional default value - @param validator: optional function that is called to validate the option's value - @type validator: Called with (key, value, environment) - @param converter: optional function that is called to convert the option's value before putting it in the environment. """ - if SCons.Util.is_List(key) or isinstance(key, tuple): self._do_add(*key) return diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py index bfd7057..141d089 100644 --- a/doc/sphinx/conf.py +++ b/doc/sphinx/conf.py @@ -19,7 +19,7 @@ # import os import sys -sys.path.insert(0, os.path.abspath('../../src/engine/')) +sys.path.insert(0, os.path.abspath('../../')) # -- General configuration ------------------------------------------------ -- cgit v0.12