[Scons-users] AddOption() strange behaviour

Hartmut.Brandt at dlr.de Hartmut.Brandt at dlr.de
Thu Dec 11 06:42:05 EST 2014


Hi,

looks like there is something broken with the option parser. I have

AddOption('--build',
  dest = 'build',
  type = 'string',
  nargs = 1,
  action = 'store',
  metavar = 'DIR',
  default = '.',
  help = 'build directory')

AddOption('--prefix',
  dest = 'build',
  type = 'string',
  nargs = 1,
  action = 'store',
  metavar = 'DIR',
  default = '/ndvb',
  help = 'build directory')
in my SConstruct file. If I call

and get the following results: 'scons --prefix=/bar --build=/foo' yields

prefix=/bar
build=/foo
COMMAND_LINE_TARGETS=[]
ARGUMENTS={}

'scons --prefix /bar --build=/foo' yields

prefix=/bar
build=/foo
COMMAND_LINE_TARGETS=['/bar']
ARGUMENTS={}

'scons --prefix=/bar --build /foo'  and 'scons --prefix /bar --build /foo' yield

If a swap the order of the AddOption() calls, then the behaviour with regard to printing an error or getting the argument as optiona value AND target swaps also. The python OptionParser gets this right.

Unfortunately my pythonese is not fluent enough, to fix this. Any idea?

harti



More information about the Scons-users mailing list