[Scons-users] Retrieving variables

Stefan Seefeld stefan at seefeld.name
Fri Jun 17 09:35:11 EDT 2016


Hi Bill,

sorry for a belated followup.

On 14.06.2016 15:47, Bill Deegan wrote:

>
>     While this may work, it really looks like a kludge.
>
>
> not sure what you are referring to here..

Explicitly instantiating a tool seems to imply that I want to override
the automatic choice, so the semantic is (at least slightly) changed. So
I at least need some extra logic to check whether msvc is present at all
on my machine. If I run `env.Tool('msvc')` unconditionally on Linux, I get

  scons: warning: No version of Visual Studio compiler found - C/C++
compilers most likely not set correctly

while what I really want is to delay SCons' own (conditional)
initialization of the 'msvc' tool until the TARGET_ARCH variable is
correctly set.

But experimenting with this, I ran into other issues, as well:

>
> env=Environment(tools=[], variables=vars)
>
> env['TARGET_ARCH'] = env['arch']
> env.Tool('msvc')
>
> Should more or less do what you want.

Here is my current logic:

  env = Environment(toolpath=['config'],
                    tools=['default', 'build_variants', 'boost_libs',
'boost_tests'],
                    variables=vars)
  env['TARGET_ARCH'] = env['arch']
  env.Tool('msvc')

which yields:

  EnvironmentError: No module named msvc:

Any idea why ? (Is SCons by any chance looking for tools *only* in
config/ ?) But it gets slightly worse: My `config/` directory actually
contains a 'msvc.py' module. And with that, I get a different error:

  AttributeError: 'module' object has no attribute 'generate':

because that module isn't a 'tool' at all (and as it isn't listed in the
'tools' constructor argument above, I had assumed it would not be read).
So, I don't understand the precise semantics of the 'toolpath' and
'tools' constructor arguments. (I thought the 'default' value was
supposed to tell SCons to load all the built-in tools first, and only
add the other ones mentioned above from the provided toolpath.
Please clarify the documentation.

Thanks,
        Stefan


-- 

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



More information about the Scons-users mailing list