[Scons-dev] SConstruct processing order

Gary Oberbrunner garyo at oberbrunner.com
Mon Dec 3 14:16:28 EST 2012


The problem is there's a difference between

env['CXXFLAGS'] = '-initialflags' # in the tool
env.Append('CXXFLAGS'='-xyz') # user specifies this, giving -initialflags
-xyz

and this:
env.Append('CXXFLAGS'='-xyz') # user specifies this
env['CXXFLAGS'] = '-initialflags' # in the tool, later

Even if the tool appends to existing flags, it'll sometimes be wrong. But
the worst case is people often assume the tool has set things up and check
vars which are supposed to be set by the tool, e.g. MSVC_VERSION. If you
can't check those (because they haven't been set up yet due to lazy tool
initialization) then it makes existing scripts fail -- with no clear way to
help fix them.

BTW, I like your idea about which tool created a variable -- and on a
similar topic I've always wanted a (file,line-number) reference attached to
a node saying where each target is created.



On Mon, Dec 3, 2012 at 2:09 PM, anatoly techtonik <techtonik at gmail.com>wrote:


> On Mon, Nov 26, 2012 at 9:19 PM, Gary Oberbrunner <garyo at oberbrunner.com>wrote:

>

>> There was a discussion of this a year or two ago. Steven and I worked

>> out a scheme, but the part we got stuck on is that tools modify the

>> environment. People expect, for instance, if they say

>> env.Append(CXXFLAGS='-xyz') that that will actually go at the end. Making

>> that work if the tool hasn't set up its default CXXFLAGS yet seems very

>> difficult.

>

>

> Why defaultdict() subclass can't be a solution for this particular use

> case? Tool specifies default, if no CXXFLAGS are set when somebody appends,

> these flags are initialized with defaults.

>

> BTW, if we are talking about tool management, it would help greatly for

> analysis and debugging if env:

> 1. kept reference about "which tool contributed which variable"

> 2. gave a signal (probe) when variable is first accessed (to inspect if

> the variable is used in dependency graph construction phase)

>

> This will allow to dump information about "which commands are contributed

> by which tools" and build visualization "how SCons environment is

> constructed".

> --

> anatoly t.

>

> _______________________________________________

> Scons-dev mailing list

> Scons-dev at scons.org

> http://two.pairlist.net/mailman/listinfo/scons-dev

>

>



--
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/scons-dev/attachments/20121203/a7b75812/attachment.html>


More information about the Scons-dev mailing list