[Scons-users] using Configure Contexts

Stefan Seefeld stefan at seefeld.name
Tue Dec 29 18:23:24 EST 2015


On 27.12.2015 07:42, Dirk Bächle wrote:
> Hi Stefan,
>
> On 25.12.2015 18:40, Stefan Seefeld wrote:
>> [...]
>>
>> Section 23.8 seems to suggest that a "custom check" would be
>> appropriate here, so I'm trying to write my own
>> "CheckPython(context)" function. However, inside that function I
>> don't have access to the 'conf' object from above, only a 'context',
>> which doesn't provide the same API. So I wonder what the purpose of
>> these two objects is ('conf' and 'context' in my code above),
>> and why the custom check functions don't receive a 'conf' object as
>> argument instead.
>>
>
> what you get is a CheckContext. It wraps the actual SConfBase object
> (your "conf") to support logging and caching functionalities. It still
> keeps the original SConfBase in its ".sconf" attribute, and you should
> also be able to access the environment of the configure context with
>
>   context.env
>
> which gets redirected to context.scons.env, via "__getattr__".
> Does this help a bit?

Ah, that helps indeed.

If you'll forgive my pickiness, I would find it helpful if the types /
objects had more meaningful names ("SConfBase" doesn't tell me anything
about the object's purpose !), and if the APIs were more focused. For
example, both SConfBase and CheckContext appear to have overlapping
purposes, as both provide some checking APIs (e.g., SConfBase has
CheckCHeader, CheckContext has TryCompile, etc.). In particular where I
need to write my own tests (such as for a valid Python installation),
I'll want to run a series of checks where I appear to need calls from
both the above objects, and it isn't clear why that's not available from
a single type / object.

Thanks,
        Stefan

>
> Best regards,
>
> Dirk
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users


-- 

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



More information about the Scons-users mailing list