Skip to content

AddOption() adds user-defined options using spaces to COMMAND_LINE_TARGETS #2805

Open
@bdbaddog

Description

@bdbaddog

This issue was originally created at: 2011-11-17 14:20:24.
This issue was reported by: dirkbaechle.
dirkbaechle said at 2011-11-17 14:20:24

As reported by Steve Reinhardt in

http://scons.tigris.org/ds/viewMessage.do?dsForumId=1272&dsMessageId=2714584

There seems to be an inconsistency in handling options that take values when they're specified without an '='. This seems to be caused by the loop in _main that assigns anything that doesn't start with '-' or have an '=' in it to COMMAND_LINE_TARGETS, rather than letting the option parser figure it out properly.

Here's an example SConscript:

import sys
 
AddOption('--option')
 
print 'option:', GetOption('option')
print 'targets:', COMMAND_LINE_TARGETS
 
sys.exit(0)

And here's the problem:

% scons --option=FOO BAR
scons: Reading SConscript files ...
option: FOO
targets: ['BAR']
% scons --option FOO BAR
scons: Reading SConscript files ...
option: FOO
targets: ['FOO', 'BAR']

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions