[Scons-users] File only rebased to variant dir if Command action is a build function?
Hans-Christian Wild
hchr.wild at gmail.com
Sun Jul 12 15:48:21 EDT 2020
Hi Damjan,
to me it looks like the problem is that the expression
`str(env['EXTRACT_DIR'])` in the print(...) statement will be processed by
python already when the SConscript file itself is processed and not later,
when scons actually executes the command.
if I change the print statement e.g. to this
"echo Extracting to (string action): $EXTRACT_DIR",
the output is correct
echo Extracting to (string action): build\External
Extracting to (string action): "build\External"
On Sun, Jul 12, 2020 at 4:42 PM Damjan Jovanovic <damjan.jov at gmail.com>
wrote:
> Hi
>
> In a hierarchical build with a separate output directory, a Command()'s
> action will only see a File() in its env rebased to the variant dir if it's
> a function action, not a string action.
>
> The example below prints:
> Extracting to (string action) External [WRONG]
> Extracting to (function action) build/External [RIGHT]
>
> Why do string actions not see their env's File() entries rebased to
> variant dir? Is there some way to do the rebasing manually?
>
> If not, how can the function action run commands like the string action
> would? env.Execute()?
>
> Thank you
> Damjan
>
> SConstruct:
> SConscript('src/SConscript', variant_dir='build', duplicate=0)
>
> src/SConscript:
> import shutil
> env = DefaultEnvironment()
> tarball = env.File('52654eb3b2e60c35731ea8fc87f1bd29-jpeg-8d.tar.gz')
> env['EXTRACT_DIR'] = env.Dir('External')
> def unpack_tarball(target, source, env):
> print("Extracting to (function action) " + str(env['EXTRACT_DIR'])),
> shutil.unpack_archive(str(source[0]), str(env['EXTRACT_DIR']))
> env.Command('${EXTRACT_DIR}/extracted.flg', tarball, [
> print("Extracting to (string action) " + str(env['EXTRACT_DIR'])),
> unpack_tarball,
> Touch('${TARGET}')
> ])
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20200712/0a6547b6/attachment.html>
More information about the Scons-users
mailing list