[Scons-users] possible bug

Tom Tanner (BLOOMBERG/ LONDON) ttanner2 at bloomberg.net
Tue May 13 04:19:25 EDT 2014


I think that's a +1 if you mean 'setting env['SUBST_DICT'] to None in the textfile _generate code?

Am feeling a bit dim right now, but I tried this:
env['SUBST_DICT'] = None
env.Textfile(target='foo', source=['some', 'array', ''])

and got an error as SUBST_DICT isn't a dict

I presume you don't mean doing it in the Textfile generator, because otherwise this:

env.Textfile(target='foo', source=['some', 'array', ''])
env['SUBST_DICT'] = { 'array' : 'text' }

wouldn't work as it does currently.

----- Original Message -----
From: dl9obn at darc.de
To: scons-users at scons.org
At: May 12 2014 23:18:12

Hi Tom,

On 12.05.2014 10:48, Tom Tanner (BLOOMBERG/ LONDON) wrote:

> [...]

>> 4) Amend your consistency check, allowing SUBST_DICT to not exist (every rule

>> has its exception! ;) ).

> It's not my consistency check.

>

> It's calling 'AllowSubstExceptions()' that causes the issue. And either I have to set up subst_dict or I have to clone the environment and switch that off, neither of which seems very nice

thanks for the additional info; I see your point now.


> I think when I have time I'll dig a little further into this because the code certainly looks like it should work, and the caller doesn't set up LINESEPARATOR either so I don't really understand why that doesn't cause a problem.


The LINESEPARATOR gets initialized in the generate() method. So it has a
value, unless you'd set it back to "None" on purpose.

The problem with the other exception is created by adding "SUBST_DICT"
to the varlist of the Builder actions:

_common_varlist = ['SUBST_DICT', 'LINESEPARATOR']

_text_varlist = _common_varlist + ['TEXTFILEPREFIX', 'TEXTFILESUFFIX']
_text_builder = SCons.Builder.Builder(
action = SCons.Action.Action(_action, _strfunc, varlist =
_text_varlist),

The varlist is added to the "contents" of the action, while updating
signature infos with the callstack:

subst [Environment.py:517]
get_contents [Action.py:444]
get_contents [Executor.py:437]
get_binfo [__init__.py:749]
make_ready [FS.py:2862]

So the "subst" method tries to expand "${SUBST_DICT}", which throws an
exception obviously.
As a first fix, I tried to move "SUBST_DICT" to the varlist of the
Substfile Builder only:


_common_varlist = ['LINESEPARATOR']
_text_varlist = _common_varlist + ['TEXTFILEPREFIX', 'TEXTFILESUFFIX']
...
_subst_varlist = _common_varlist + ['SUBST_DICT', 'SUBSTFILEPREFIX',
'TEXTFILESUFFIX']

This makes the exception go away, and "runtest.py test/textfile.py"
still passes. But this way the SUBST_DICT wouldn't get watched for
changes anymore when we use Textfile().

All together, fixing textfile.py by setting "SUBST_DICT = None" as
default looks like the better option to me.
Comments anyone?

Regards,

Dirk

_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users



More information about the Scons-users mailing list