summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Variables
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2020-03-26 18:45:41 (GMT)
committerMats Wichmann <mats@linux.com>2020-03-26 19:22:22 (GMT)
commitad2380bcac6d2d63052147b423544bdcf5fddbd3 (patch)
treeb2949d21453d90cf82519a4dd8c058af36fe9c53 /src/engine/SCons/Variables
parentada9505d320990468ca0eea52375bb69a882fd94 (diff)
downloadSCons-ad2380bcac6d2d63052147b423544bdcf5fddbd3.zip
SCons-ad2380bcac6d2d63052147b423544bdcf5fddbd3.tar.gz
SCons-ad2380bcac6d2d63052147b423544bdcf5fddbd3.tar.bz2
Improve manpage treatment of Variables and Configure
Various cleansup to sections Configure Contexts, Command-Line Construction Variables and SConscript Variables. Stylesheet-level changes place multiple function signature entries each on their own line (affects primarily Configure Contexts). A couple of stylesheet files were checked in in DOS format, changed them to the same as the rest of the codebase (this shows lots of spurious diff). Discovered a few minor tweaks to make to code implementing the above, so this is not completely doc-only. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'src/engine/SCons/Variables')
-rw-r--r--src/engine/SCons/Variables/PathVariable.py15
-rw-r--r--src/engine/SCons/Variables/__init__.py13
2 files changed, 16 insertions, 12 deletions
diff --git a/src/engine/SCons/Variables/PathVariable.py b/src/engine/SCons/Variables/PathVariable.py
index 0ffcbc5..eb9b299 100644
--- a/src/engine/SCons/Variables/PathVariable.py
+++ b/src/engine/SCons/Variables/PathVariable.py
@@ -78,11 +78,13 @@ import SCons.Errors
class _PathVariableClass(object):
- def PathAccept(self, key, val, env):
+ @staticmethod
+ def PathAccept(key, val, env):
"""Accepts any path, no checking done."""
pass
- def PathIsDir(self, key, val, env):
+ @staticmethod
+ def PathIsDir(key, val, env):
"""Validator to check if Path is a directory."""
if not os.path.isdir(val):
if os.path.isfile(val):
@@ -91,7 +93,8 @@ class _PathVariableClass(object):
m = 'Directory path for option %s does not exist: %s'
raise SCons.Errors.UserError(m % (key, val))
- def PathIsDirCreate(self, key, val, env):
+ @staticmethod
+ def PathIsDirCreate(key, val, env):
"""Validator to check if Path is a directory,
creating it if it does not exist."""
if os.path.isfile(val):
@@ -100,7 +103,8 @@ class _PathVariableClass(object):
if not os.path.isdir(val):
os.makedirs(val)
- def PathIsFile(self, key, val, env):
+ @staticmethod
+ def PathIsFile(key, val, env):
"""Validator to check if Path is a file"""
if not os.path.isfile(val):
if os.path.isdir(val):
@@ -109,7 +113,8 @@ class _PathVariableClass(object):
m = 'File path for option %s does not exist: %s'
raise SCons.Errors.UserError(m % (key, val))
- def PathExists(self, key, val, env):
+ @staticmethod
+ def PathExists(key, val, env):
"""Validator to check if Path exists"""
if not os.path.exists(val):
m = 'Path for option %s does not exist: %s'
diff --git a/src/engine/SCons/Variables/__init__.py b/src/engine/SCons/Variables/__init__.py
index 4ff11d0..7bd4cd9 100644
--- a/src/engine/SCons/Variables/__init__.py
+++ b/src/engine/SCons/Variables/__init__.py
@@ -45,21 +45,20 @@ from .PathVariable import PathVariable # okay
class Variables(object):
- instance=None
-
"""
Holds all the options, updates the environment with the variables,
and renders the help text.
"""
+ 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
+ automatically placed in a file list
+ args - dictionary to override values set from files.
"""
- # initialize arguments
- if files is None:
- files = []
+
if args is None:
args = {}
self.options = []
@@ -74,7 +73,7 @@ class Variables(object):
# create the singleton instance
if is_global:
- self=Variables.instance
+ self = Variables.instance
if not Variables.instance:
Variables.instance=self