[Scons-users] possible bug
Dirk Bächle
tshortik at gmx.de
Mon May 12 18:18:02 EDT 2014
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
More information about the Scons-users
mailing list