File only rebased to variant dir if Command action is a build function?

Damjan Jovanovic <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <CAJm2B-n8cH2XS472UX_4L8S6g5wKJ-E8SuJqOvBKi_Y2HuL41A@mail.gmail.com>
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
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.