[Scons-users] Writing a command that always succeeds
Jason Kenny
dragon512 at live.com
Thu Jun 16 11:30:56 EDT 2016
Hi,
Sorry I did not respond earlier...
I think you have it a general answer. However this is not 100% the same as
what SCons does internally...
In general I just tweak the SPAWN variable to SCons do the call for me. You
provide a function or object with a __call__ that accepts:
def spawn(shell, escape, cmd, args, Env):
in this case the cmd is already filled out for you. The Env is the shell
environment to use.
I was scanning my source I found that I have done calls like to this to get
it to work better.
env.subst_target_source(installstr, 0, target, source)
You might find this works better
Jason
-----Original Message-----
From: Scons-users [mailto:scons-users-bounces at scons.org] On Behalf Of Stefan
Seefeld
Sent: Wednesday, June 15, 2016 10:46 AM
To: scons-users at scons.org
Subject: Re: [Scons-users] Writing a command that always succeeds
Hi again,
let me follow up on my own mail...
On 15.06.2016 06:59, Stefan Seefeld wrote:
> Hi Jason,
>
> thanks for your detailed reply. I'm presently stuck with a much
> simpler
> problem:
>
> I have this code:
>
> def my_command(target, source, env=env):
> print(env['TARGET']) # fails !!
>
> env.Command(target, sources, my_command)
the missing bit is the definition of the 'TARGET', 'SOURCE' etc.
variables that are required for env.subst() to work. I'm still not sure
where this is done inside SCons, and what the supposed way is to hook this
up with the execution of custom python functions.
However, what appears to work fine is to call
env.subst('$TARGET', target=<the-target>)
The documentation at
http://scons.org/doc/production/HTML/scons-user/ch07s02.html#idp1400500516
is missing this important point.
Thanks,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users
More information about the Scons-users
mailing list