[Scons-users] Starting with a clean installation directory

Pico Geyer picogeyer at gmail.com
Mon Oct 21 13:42:04 EDT 2013


Hi all.

I seem to be struggling with something that should be quite trivial.
I would like to delete my installation directory to get rid of any stale
files before installing my various targets.

So my first thought was that I should make my installation targets depend
on a command that deletes the installation directory. Something like this:
env = Environment()
t_all_install = []
del_cmd = env.Command('../install_dir', [], Delete('$TARGET'))
t_all_install.append(env.Install('../install_dir', 'foo2.txt'))
t_all_install.append(env.Install('../install_dir', 'foo.txt'))
env.Depends(t_all_install, del_cmd)
env.Default(t_all_install)

But this creates a horrible dependency cycle:
sconstest/install_dir -> sconstest/install_dir/foo.txt ->
sconstest/install_dir
sconstest/install_dir/foo2.txt -> sconstest/install_dir ->
sconstest/install_dir/foo2.txt

I then tried to use a AddPreAction to Delete the install directory instead
env.AddPreAction(t_all_install, Delete('../install_dir'))

But this seems to manage to delete the directory but then fails at the very
next command:
Delete("../install_dir")
Install file: "foo2.txt" as "[snip]/install_dir/foo2.txt"
scons: *** [[snip]/sconstest/install_dir/foo2.txt]
[snip]/sconstest/install_dir/foo2.txt: No such file or directory


What's the simplest way to achieve this?
Thanks in advance!
Pico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131021/ece084fb/attachment.html


More information about the Scons-users mailing list