diff options
author | William Roberts <bill.c.roberts@gmail.com> | 2015-03-17 21:26:53 (GMT) |
---|---|---|
committer | William Roberts <bill.c.roberts@gmail.com> | 2015-03-17 21:26:53 (GMT) |
commit | 7e15cea215477c4eb495be1e8459e7eacd02b235 (patch) | |
tree | 027da5593a1558eccd324a75597c272990632297 | |
parent | b6c7bd73535753a45dec87e8bb3b8584443d40dd (diff) | |
download | SCons-7e15cea215477c4eb495be1e8459e7eacd02b235.zip SCons-7e15cea215477c4eb495be1e8459e7eacd02b235.tar.gz SCons-7e15cea215477c4eb495be1e8459e7eacd02b235.tar.bz2 |
bug 2831: Allow appending Help text to Options Output
http://scons.tigris.org/issues/show_bug.cgi?id=2831
In order to append, rather than clobber Help() generated
text, use Help("my message", append=True)
The append argument is only respected on the first call to this
method as it operates on global data.
-rw-r--r-- | src/CHANGES.txt | 3 | ||||
-rw-r--r-- | src/engine/SCons/Script/Main.py | 3 | ||||
-rw-r--r-- | src/engine/SCons/Script/SConscript.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Script/__init__.py | 15 |
4 files changed, 20 insertions, 5 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 55b48a5..cd98f12 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER + From William Roberts: + - Fix bug 2831 and allow Help() text to be appended to AddOption() help. + From Russel Winder: - Add support for f08 file extensions for Fortran 2008 code. diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index c7a9d27..4ccd2b3 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -484,6 +484,9 @@ def GetOption(name): def SetOption(name, value): return OptionsParser.values.set_option(name, value) +def PrintHelp(file=None): + OptionsParser.print_help(file=file) + # class Stats(object): def __init__(self): diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index f4a7f07..3502534 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -499,9 +499,9 @@ class SConsEnvironment(SCons.Environment.Base): name = self.subst(name) return SCons.Script.Main.GetOption(name) - def Help(self, text): + def Help(self, text, append=False): text = self.subst(text, raw=1) - SCons.Script.HelpFunction(text) + SCons.Script.HelpFunction(text, append=append) def Import(self, *vars): try: diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index bb7b632..a9d7708 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -41,6 +41,7 @@ start_time = time.time() import collections import os +import StringIO import sys # Special chicken-and-egg handling of the "--debug=memoizer" flag: @@ -107,6 +108,7 @@ QuestionTask = Main.QuestionTask #SConscriptSettableOptions = Main.SConscriptSettableOptions AddOption = Main.AddOption +PrintHelp = Main.PrintHelp GetOption = Main.GetOption SetOption = Main.SetOption Progress = Main.Progress @@ -258,10 +260,17 @@ def _Set_Default_Targets(env, tlist): # help_text = None -def HelpFunction(text): +def HelpFunction(text, append=False): global help_text - if SCons.Script.help_text is None: - SCons.Script.help_text = text + if help_text is None: + if append: + s = StringIO.StringIO() + PrintHelp(s) + help_text = s.getvalue() + s.close() + else: + help_text = "" + help_text = help_text + "\nLocal Build Variables:\n" + text else: help_text = help_text + text |