[Scons-users] Should chdir in builders change $TARGET and $SOURCE relative to new directory?

Gaurav Juvekar gauravjuvekar at gmail.com
Thu May 11 16:25:17 EDT 2017


Hi,

Suppose I have an SConstruct like 

bld = Builder(action = 'cat < $SOURCE > $TARGET')
env = Environment(BUILDERS = {'CpBuilder': bld})
env.CpBuilder('subdir/target.out', 'subdir/source.in', chdir = 'subdir')

and my source tree like
.
|-- SConstruct
`-- subdir
    `-- source.in

I would expect that the $SOURCE and $TARGET when expanded would take into account the chdir and $SOURCE == 'source.in' and $TARGET == 'target.out'. However, they still expand to 'subdir/source.in' and 'subdir/target.out' giving this error.


scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
os.chdir('subdir')
cat < subdir/source.in > subdir/target.out
sh: 1: cannot open subdir/source.in: No such file
os.chdir('/tmp/ex')
scons: *** [subdir/target.out] Error 2
scons: building terminated because of errors.


Is this behavior intended or should the variable expansion take into account chdir?

-- 
Regards,
Gaurav Juvekar


More information about the Scons-users mailing list