[Scons-users] passing variables on the command-line

Stefan Seefeld stefan at seefeld.name
Sat Jun 18 06:21:38 EDT 2016


On 17.06.2016 17:59, Bill Deegan wrote:
> Can you create a minimum working example of the config check + string
> CFLAGS for me to take a look at?
> That'll help me recommend whether to file a bug or not.

Sure. Here is a minimal SConstruct file:

  vars = Variables('config.py', ARGUMENTS)
  vars.Add('CCFLAGS')
  env = Environment(variables=vars)
  env.Append(CCFLAGS = '-Wall')
  vars.Save('config.py', env)
  print(env['CCFLAGS'])


Run this with `scons CCFLAGS=-Wall`, and observe the output (and the
value of CCFLAGS in the saved config.py) to be an invalid '-Wall-Wall'.

 workaround is to replace the second line by

    vars.Add('CCFLAGS', converter=lambda v:v.split())


    Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Scons-users mailing list