Re: Should PseudoBuilder's get access to OverrideEnvironment values if called via one

Gary Oberbrunner <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <CAFChFyhacrTtf5eWu4rHfs+9nWn1S8C9Z2aR6-UsifD=nSYGUw@mail.gmail.com>
Shouldn't that say oenv.install_in_bin_dir(...)?

--Gary

On Thu, Apr 25, 2019, 6:06 PM Bill Deegan <[email protected]> wrote:

> Currently they don't
>
> See sample git repo:
>
> https://github.com/bdbaddog/Scons-psuedobuilder_no_override_access/tree/master
>
> SConstruct:
>
> DefaultEnvironment(tools=[])
> env=Environment(BIN='mybin',LOCALBIN='localbin')
>
> def install_in_bin_dirs(env, source):
>     """Install source in both bin dirs"""
>     i1 = env.Install("$BIN", source)
>     i2 = env.Install("$LOCALBIN", source)
>     print("TEST_VAR=%s"%env['TEST_VAR'])
>     return [i1[0], i2[0]] # Return a list, like a normal builder
>
> env.AddMethod(install_in_bin_dirs, "InstallInBinDirs")
>
> env.InstallInBinDirs(env.Program('main.c')) # installs hello in both bin dirs
>
> oenv=OverrideEnvironment(env,TEST_VAR='abc')
> print("Override id:%s"%id(oenv))
>
>
> Yields:
> $ python ~/devel/scons/git/as_scons/src/script/scons.py
> scons: Reading SConscript files ...
> KeyError: 'TEST_VAR':
>   File "/Users/bdbaddog/devel/scons/bugs/Scons-psuedobuilder_no_override_access/SConstruct", line 13:
>     env.InstallInBinDirs(env.Program('main.c')) # installs hello in both bin dirs
>   File "/Users/bdbaddog/devel/scons/git/as_scons/src/script/../engine/SCons/Environment.py", line 224:
>     return self.method(*nargs, **kwargs)
>   File "/Users/bdbaddog/devel/scons/bugs/Scons-psuedobuilder_no_override_access/SConstruct", line 8:
>     print("TEST_VAR=%s"%env['TEST_VAR'])
>   File "/Users/bdbaddog/devel/scons/git/as_scons/src/script/../engine/SCons/Environment.py", line 410:
>     return self._dict[key]
>
> This is because PsuedoBuilder's are wrapped with the Environment() they are added to.
>
> Via MethodWrapper()
>
> Which caused a couple hours of debugging to find today..
>
> Unless someone can propose a reasonable reason it shouldn't I'll file a github issue.
>
> -Bill
>
> _______________________________________________
> Scons-users mailing list
> [email protected]
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.