From 576f2cdf248efce2f7e16c51dbe08801811ab99b Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 7 May 2021 10:11:00 -0600 Subject: Make sure SetOption list is up to date Signed-off-by: Mats Wichmann --- SCons/Script/Main.xml | 62 +++++++++++++++++++++++++++++++++++++++----- SCons/Script/SConsOptions.py | 21 ++++++++------- doc/man/scons.xml | 3 ++- 3 files changed, 69 insertions(+), 17 deletions(-) diff --git a/SCons/Script/Main.xml b/SCons/Script/Main.xml index 4935f88..74bb40a 100644 --- a/SCons/Script/Main.xml +++ b/SCons/Script/Main.xml @@ -787,9 +787,9 @@ The settable variables with their associated command-line options are: - + -VariableCommand-line options +VariableCommand-line optionsNotes @@ -797,19 +797,19 @@ The settable variables with their associated command-line options are: , , + diskcheck - + duplicate - experimental @@ -817,30 +817,74 @@ The settable variables with their associated command-line options are: + + since 4.2 + + +hash_chunksize + + + +since 4.2 + + + +hash_format + + + +since 4.2 + help , + implicit_cache + + since 4.2 + +implicit_deps_changed + + + +Also sets +implicit_cache +(since 4.2) + + + +implicit_deps_unchanged + + + +Also sets +implicit_cache +(since 4.2) + + + max_drift + md5_chunksize + no_exec @@ -848,35 +892,41 @@ The settable variables with their associated command-line options are: , , + no_progress + num_jobs , + random + silent -. + + stack_size + warn -. + diff --git a/SCons/Script/SConsOptions.py b/SCons/Script/SConsOptions.py index 0233703..cb4cf1d 100644 --- a/SCons/Script/SConsOptions.py +++ b/SCons/Script/SConsOptions.py @@ -129,28 +129,31 @@ class SConsValues(optparse.Values): 'clean', 'diskcheck', 'duplicate', + 'experimental', + 'hash_chunksize', 'hash_format', 'help', 'implicit_cache', 'max_drift', 'md5_chunksize', 'no_exec', + 'no_progress', 'num_jobs', 'random', + 'silent', 'stack_size', 'warn', - 'silent', - 'no_progress', - 'experimental', ] def set_option(self, name, value): - """ - Sets an option from an SConscript file. - """ + """Sets an option from an SConscript file.""" + if name not in self.settable: - raise SCons.Errors.UserError("This option is not settable from a SConscript file: %s"%name) + raise SCons.Errors.UserError( + "This option is not settable from a SConscript file: %s" % name + ) + # the following are for options that need some extra processing if name == 'num_jobs': try: value = int(value) @@ -188,7 +191,7 @@ class SConsValues(optparse.Values): value = int(value) except ValueError: raise SCons.Errors.UserError("An integer is required: %s"%repr(value)) - elif name == 'md5_chunksize': + elif name in ('md5_chunksize', 'hash_chunksize'): try: value = int(value) except ValueError: @@ -205,8 +208,6 @@ class SConsValues(optparse.Values): value = [value] value = self.__SConscript_settings__.get(name, []) + value - - self.__SConscript_settings__[name] = value diff --git a/doc/man/scons.xml b/doc/man/scons.xml index 0fba467..165d906 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -1124,7 +1124,7 @@ the mechanisms in the specified order. - + , @@ -1132,6 +1132,7 @@ the mechanisms in the specified order. Enable experimental features and/or tools. No Support offered for any features or tools enabled by this flag The default setting is none. + Available since &scons; 4.2. -- cgit v0.12 From 17536127a3978b0ae816e3a1a17208aeaf7e8361 Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Sat, 8 May 2021 08:14:01 -0600 Subject: Enable SetOption for implicit_deps* The SetOption table in the docs is reformatted for easier editing. Signed-off-by: Mats Wichmann --- CHANGES.txt | 4 + SCons/Script/Main.xml | 282 +++++++++++++++++++++---------------------- SCons/Script/SConsOptions.py | 30 +++-- 3 files changed, 163 insertions(+), 153 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index ff4ae28..7f6f7cb 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -93,6 +93,10 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER of warnings in some tools which instantiated the class but did nothing with them, need to instead call SCons.Warnings.warn with the warn class. - Drop overridden changed_since_last_build method in Value class. + - Resync the SetOption implementation and the manpage, making sure new + options are available and adding a notes column for misc information. + SetOption equivalents to --hash-chunksize, --implicit-deps-unchanged + and --implicit-deps-changed are enabled. From Dillan Mills: - Add support for the (TARGET,SOURCE,TARGETS,SOURCES,CHANGED_TARGETS,CHANGED_SOURCES}.relpath property. diff --git a/SCons/Script/Main.xml b/SCons/Script/Main.xml index 74bb40a..ce21ee1 100644 --- a/SCons/Script/Main.xml +++ b/SCons/Script/Main.xml @@ -768,15 +768,21 @@ Multiple targets can be passed in to a single call to Sets &scons; option variable name to value. These options are all also settable via -&scons; command-line options but the variable name -may differ from the command-line option name (see table). +command-line options but the variable name +may differ from the command-line option name - +see the table for correspondences. A value set via command-line option will take precedence over one set with &f-SetOption;, which allows setting a project default in the scripts and temporarily overriding it via command line. +Project-wide +&f-SetOption; calls can also be placed in the +site_init.py file. + + Options which affect the reading and processing of SConscript files -are not settable this way, since those files must -be read in order to find the &f-SetOption; call. +are not settable using &f-SetOption; since those files must +be read in order to find the &f-SetOption; call in the first place. @@ -789,145 +795,127 @@ The settable variables with their associated command-line options are: -VariableCommand-line optionsNotes + + Variable + Command-line options + Notes + + - -clean - -, , - - - -diskcheck - - - - - -duplicate - - - - - - - experimental - - - - - - since 4.2 - - - - -hash_chunksize - - - -since 4.2 - - - -hash_format - - - -since 4.2 - - - -help - -, - - - -implicit_cache - - - - since 4.2 - - - - -implicit_deps_changed - - - -Also sets -implicit_cache -(since 4.2) - - - -implicit_deps_unchanged - - - -Also sets -implicit_cache -(since 4.2) - - - -max_drift - - - - - -md5_chunksize - - - - - -no_exec - -, , -, , - - - - -no_progress - - - - - -num_jobs - -, - - - -random - - - - - -silent - - - - - -stack_size - - - - - -warn - - - + + clean + + , + , + + + + + + diskcheck + + + + + duplicate + + + + + experimental + + since 4.2 + + + + hash_chunksize + + since 4.2 + + + + hash_format + + since 4.2 + + + + help + , + + + + implicit_cache + + since 4.2 + + + + implicit_deps_changed + + Also sets implicit_cache + (since 4.2) + + + + implicit_deps_unchanged + + Also sets implicit_cache + (since 4.2) + + + + max_drift + + + + + md5_chunksize + + + + + no_exec + + , + , + , + , + + + + + + no_progress + + + + + num_jobs + , + + + + random + + + + + silent + + + + + stack_size + + + + + warn + + + @@ -935,15 +923,19 @@ Also sets See the documentation in the manpage for the corresponding command line option for information about each specific option. -Option values which are boolean in nature (that is, they are -either on or off) should be set to a true value (True, -1) or a false value (False, +The value parameter is mandatory, +for option values which are boolean in nature +(that is, the command line option does not take an argument) +use a value +which evaluates to true (e.g. True, +1) or false (e.g. False, 0). If no_progress is set via &f-SetOption; +in an SConscript file, there will still be initial progress output as &SCons; has to start reading SConscript files before it can see the &f-SetOption; in an SConscript file: @@ -956,7 +948,7 @@ Example: -SetOption('max_drift', True) +SetOption('max_drift', 0) diff --git a/SCons/Script/SConsOptions.py b/SCons/Script/SConsOptions.py index cb4cf1d..4988a8d 100644 --- a/SCons/Script/SConsOptions.py +++ b/SCons/Script/SConsOptions.py @@ -134,6 +134,8 @@ class SConsValues(optparse.Values): 'hash_format', 'help', 'implicit_cache', + 'implicit_deps_changed', + 'implicit_deps_unchanged', 'max_drift', 'md5_chunksize', 'no_exec', @@ -146,7 +148,11 @@ class SConsValues(optparse.Values): ] def set_option(self, name, value): - """Sets an option from an SConscript file.""" + """Sets an option from an SConscript file. + + Raises: + UserError: invalid or malformed option ("error in your script") + """ if name not in self.settable: raise SCons.Errors.UserError( @@ -160,19 +166,23 @@ class SConsValues(optparse.Values): if value < 1: raise ValueError except ValueError: - raise SCons.Errors.UserError("A positive integer is required: %s"%repr(value)) + raise SCons.Errors.UserError( + "A positive integer is required: %s" % repr(value) + ) elif name == 'max_drift': try: value = int(value) except ValueError: - raise SCons.Errors.UserError("An integer is required: %s"%repr(value)) + raise SCons.Errors.UserError("An integer is required: %s" % repr(value)) elif name == 'duplicate': try: value = str(value) except ValueError: - raise SCons.Errors.UserError("A string is required: %s"%repr(value)) + raise SCons.Errors.UserError("A string is required: %s" % repr(value)) if value not in SCons.Node.FS.Valid_Duplicates: - raise SCons.Errors.UserError("Not a valid duplication style: %s" % value) + raise SCons.Errors.UserError( + "Not a valid duplication style: %s" % value + ) # Set the duplicate style right away so it can affect linking # of SConscript files. SCons.Node.FS.set_duplicate(value) @@ -180,7 +190,7 @@ class SConsValues(optparse.Values): try: value = diskcheck_convert(value) except ValueError as v: - raise SCons.Errors.UserError("Not a valid diskcheck value: %s"%v) + raise SCons.Errors.UserError("Not a valid diskcheck value: %s" % v) if 'diskcheck' not in self.__dict__: # No --diskcheck= option was specified on the command line. # Set this right away so it can affect the rest of the @@ -190,12 +200,13 @@ class SConsValues(optparse.Values): try: value = int(value) except ValueError: - raise SCons.Errors.UserError("An integer is required: %s"%repr(value)) + raise SCons.Errors.UserError("An integer is required: %s" % repr(value)) elif name in ('md5_chunksize', 'hash_chunksize'): try: value = int(value) except ValueError: - raise SCons.Errors.UserError("An integer is required: %s"%repr(value)) + raise SCons.Errors.UserError("An integer is required: %s" % repr(value)) + name = 'md5_chunksize' # for now, the old name is used elif name == 'warn': if SCons.Util.is_String(value): value = [value] @@ -207,6 +218,9 @@ class SConsValues(optparse.Values): if SCons.Util.is_String(value): value = [value] value = self.__SConscript_settings__.get(name, []) + value + elif name in ('implicit_deps_changed', 'implicit_deps_unchanged'): + if value: + self.__SConscript_settings__['implicit_cache'] = True self.__SConscript_settings__[name] = value -- cgit v0.12