Schoolchildren already change SConscripts to a directory of subdirectories when reading them, so it seems that the problem should be fixed in the actual builder.
After the scripts are parsed and SCons runs the build commands, it remains in the top-level directory. Commands are then issued using path names relative to this top-level directory. A way to change this behavior is to use a keyword chdirin your Builder.
An example from the man scons page is as follows:
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')
You need to specify the component .file, since use chdirdoes not change the names passed to the builder, i.e. they still belong to the top-level directory.
richq source
share