[Scons-users] Copying and merging directories

Francis Bolduc fbolduc at gmail.com
Mon Sep 10 08:13:30 EDT 2012



> env.Alias('copy', env.Command('copy', [], env.Install(TO_DIR,

> env.Glob(FROM_DIR))))


I think there are two problems with this.

1- env.Command is redundant, simply remove it.

env.Alias('copy', env.Install(TO_DIR, env.Glob(FROM_DIR)))

2- Glob(pattern) returns files matching the pattern in the SConscript
directory. So if you print the result from Glob(), you'll see which
files will be copied. Also, beware, Glob(pattern) is not recursive.

for node in env.Glob('*.h'):
print node.abspath

Finally, be sure to keep the Alias because if TO_DIR is not in the
SConscript's directory or one of it's sub-directories, SCons will not
copy the install the files unless you specify the install directory as
part of the target. The phony 'copy' target you created prevents this.


More information about the Scons-users mailing list