[Scons-users] File only rebased to variant dir if Command action is a build function?

Damjan Jovanovic damjan.jov at gmail.com
Sun Jul 12 10:39:53 EDT 2020


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}')
])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20200712/495f989c/attachment.html>


More information about the Scons-users mailing list