Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Fix Appveyor scripting to install unavailable python versions when needed and use them
for testing.

From Dillan Mills:
- Fix handling of AddOption for option-arguments with spaces
(when omitting the = sign or when an option takes multiple
option-arguments). Arguments unknown at the time the first pass
splits the command line into arguments and targets would put such
arguments into targets, and they remained there even after the
AddOption calls were seen. Closes #2748, #2805, #2977.

From Mats Wichmann:
- Introduce some unit tests for the file locking utility routines
- More clarifications in manpage Builder Methods section.
Expand Down Expand Up @@ -68,6 +76,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
via the SConsignFile(name=None) call.
- Test framework: tweak module docstrings
- Test suite: end to end tests don't use assert in result checks
- Complete the work from PR #3799 on AddOption handling (original work
credited to Dillan Mills)
- The qt3 tool module, deprecated since version 4.3, is removed due to
the general unavailablility of the obsolete build-time Qt3 package.
- A few more typing cleanups in Environment (and in one case which
Expand Down
5 changes: 5 additions & 0 deletions RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ FIXES

- Fix --debug=includes for case of multiple source files.

- Fix handling of AddOption for option-arguments with spaces (when omitting
the = sign or when an option takes multiple option-arguments). Arguments
unknown at the time the first pass splits the command line into arguments
and targets would put such arguments into targets, and they remained
there even after the AddOption calls were seen.
- Adjust race protection for CacheDir - now uses a unique temporary
directory for each writer before doing the move, instead of depending
on a one-time uuid to make a path to the file.
Expand Down
24 changes: 23 additions & 1 deletion SCons/Script/SConsOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,18 @@ def _process_long_opt(self, rargs, values) -> None:
% (opt, nargs))
elif nargs == 1:
value = rargs.pop(0)
if not had_explicit_value:
SCons.Script._Remove_Target(value)
if '=' in value:
SCons.Script._Remove_Argument(value)
else:
value = tuple(rargs[0:nargs])
del rargs[0:nargs]
for i in range(len(value)):
if not had_explicit_value or i > 0:
SCons.Script._Remove_Target(value[i])
if '=' in value[i]:
SCons.Script._Remove_Argument(value[i])

elif had_explicit_value:
self.error(_("%s option does not take a value") % opt)
Expand Down Expand Up @@ -447,11 +456,13 @@ def _process_short_opts(self, rargs, values) -> None:
raise

if option.takes_value():
had_explicit_value = False
# Any characters left in arg? Pretend they're the
# next arg, and stop consuming characters of arg.
if i < len(arg):
rargs.insert(0, arg[i:])
stop = True
had_explicit_value = True

nargs = option.nargs
if len(rargs) < nargs:
Expand All @@ -462,9 +473,19 @@ def _process_short_opts(self, rargs, values) -> None:
% (opt, nargs))
elif nargs == 1:
value = rargs.pop(0)
if not had_explicit_value:
SCons.Script._Remove_Target(value)
if '=' in value:
SCons.Script._Remove_Argument(value)
else:
value = tuple(rargs[0:nargs])
del rargs[0:nargs]
for i in range(len(value)):
if not had_explicit_value or i > 0:
SCons.Script._Remove_Target(value[i])
if '=' in value[i]:
SCons.Script._Remove_Argument(value[i])


else: # option doesn't take a value
value = None
Expand All @@ -475,6 +496,7 @@ def _process_short_opts(self, rargs, values) -> None:
break


# TODO: this is now unused, remove?
def reparse_local_options(self) -> None:
"""Re-parse the leftover command-line options.

Expand Down Expand Up @@ -574,7 +596,7 @@ def add_local_option(self, *args, **kw) -> SConsOption:
# right away.
# TODO: what if dest is None?
setattr(self.values.__defaults__, result.dest, result.default)
self.reparse_local_options()
self.parse_args(self.largs, self.values)
if result.settable:
SConsValues.settable.append(result.dest)

Expand Down
4 changes: 0 additions & 4 deletions test/AddOption/.exclude_tests

This file was deleted.

Loading
Loading