diff options
author | William Deegan <bill@baddogconsulting.com> | 2021-03-25 22:16:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-25 22:16:18 (GMT) |
commit | 0be25011f71743605192d58737c961ff634a8e4c (patch) | |
tree | 94a408b4afa0b70a5bf1b3e86b71cacb8f8b98e3 | |
parent | 46e4c64d1358e547313049b256621b7e5ee9f792 (diff) | |
parent | 9b28bb2dffad91b73b33637515f4d8defebc6679 (diff) | |
download | SCons-0be25011f71743605192d58737c961ff634a8e4c.zip SCons-0be25011f71743605192d58737c961ff634a8e4c.tar.gz SCons-0be25011f71743605192d58737c961ff634a8e4c.tar.bz2 |
Merge branch 'master' into site-dir
-rwxr-xr-x | CHANGES.txt | 1 | ||||
-rw-r--r-- | SCons/Script/Main.py | 12 | ||||
-rw-r--r-- | test/TARGETS.py | 22 |
3 files changed, 27 insertions, 8 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 9bcf7ad..6c5feea 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -41,6 +41,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER Python 3 doesn't have a dictionary has_key (maintenance) - Do not treat --site-dir=DIR and --no-site-dir as distinct options. Allows a later instance to override an earlier one. + - Ignore empty cmdline arguments when computing targets (issue 2986) RELEASE 4.1.0 - Tues, 19 Jan 2021 15:04:42 -0700 diff --git a/SCons/Script/Main.py b/SCons/Script/Main.py index 6285d4a..59ffbb7 100644 --- a/SCons/Script/Main.py +++ b/SCons/Script/Main.py @@ -986,13 +986,17 @@ def _main(parser): if options.interactive: SCons.Node.interactive = True - # That should cover (most of) the options. Next, set up the variables - # that hold command-line arguments, so the SConscript files that we - # read and execute have access to them. + # That should cover (most of) the options. + # Next, set up the variables that hold command-line arguments, + # so the SConscript files that we read and execute have access to them. + # TODO: for options defined via AddOption which take space-separated + # option-args, the option-args will collect into targets here, + # because we don't yet know to do any different. targets = [] xmit_args = [] for a in parser.largs: - if a[:1] == '-': + # Skip so-far unrecognized options, and empty string args + if a.startswith('-') or a in ('', '""', "''"): continue if '=' in a: xmit_args.append(a) diff --git a/test/TARGETS.py b/test/TARGETS.py index 0ffc3b6..3cc2f0f 100644 --- a/test/TARGETS.py +++ b/test/TARGETS.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # -# __COPYRIGHT__ +# MIT License +# +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,9 +22,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test use of the COMMAND_LINE_TARGETS and DEFAULT_TARGETS variables. @@ -137,6 +136,21 @@ test.run(arguments = 'command_line_target', stdout = expect) +# blanks in cmdline should not be treated as targets (issue 2986) +test.write( + file='SConstruct', + content="""\ +tgt_foo = Textfile(target="foo", source="foostuff") +tgt_bar = Textfile(target="bar", source="bartuff") +Default(tgt_foo) +""", +) +test.run(arguments=["-Q", "-n", "''"], stdout="Creating 'foo.txt'\n") +test.run(arguments=["-Q", "-n", ""], stdout="Creating 'foo.txt'\n") +test.run(arguments=["-Q", "-n", '""'], stdout="Creating 'foo.txt'\n") + + + test.pass_test() # Local Variables: |