[Scons-users] chdir and parallel builds

Bill Deegan bill at baddogconsulting.com
Tue Jul 7 19:22:17 EDT 2015


All,

This issue is documented in the manpage...

chdir

A directory from which scons will execute the action(s) specified for this
Builder. If the *chdir* argument is a string or a directory Node, scons
will change to the specified directory. If the *chdir* is not a string or
Node and is non-zero, then scons will change to the target file's directory.

Note that scons will *not* automatically modify its expansion of
construction variables like *$TARGET* and *$SOURCE* when using the chdir
keyword argument--that is, the expanded file names will still be relative
to the top-level SConstruct directory, and consequently incorrect relative
to the chdir directory. Builders created using chdir keyword argument, will
need to use construction variable expansions like *${TARGET.file}* and
*${SOURCE.file}* to use just the filename portion of the targets and source.

b = Builder(action="build < ${SOURCE.file} > ${TARGET.file}",
            chdir=1)
env = Environment(BUILDERS = {'MyBuild' : b})
env.MyBuild('sub/dir/foo.out', 'sub/dir/foo.in')

*WARNING:* Python only keeps one current directory location for all of the
threads. This means that use of the *chdir* argument will *not* work with
the SCons -j option, because individual worker threads spawned by SCons
interfere with each other when they start changing directory.


On Tue, Jul 7, 2015 at 3:15 PM, Jonathon Reinhart <
jonathon.reinhart at gmail.com> wrote:

>
> On Jul 7, 2015 9:28 AM, "Brian Cody" <brian.j.cody at gmail.com> wrote:
> >
> > Yeah, it's broken as far as we're concerned.
>
> I think this is the general concensus. I really feel that chdir and -j
> together should be regarded as broken in the documentation.
>
> _______________________________________________
> 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/20150707/3314d283/attachment.html>


More information about the Scons-users mailing list