[Scons-users] Starting with a clean installation directory

Marc Branchaud marcnarc at xiplink.com
Tue Oct 22 10:43:03 EDT 2013


On 13-10-21 03:22 PM, Pico Geyer wrote:

>

> Dirk, Thanks for the response.

> However that's not quite what I'm looking for.

> Perhaps it was not well illustrated by my simple example.

> Let say my build also contained a build of a program bar, I don't want my

> installation directory to be deleted just because I tried to build bar.

> If however I delete foo.txt from my build and then I run the install target,

> I don't want to see foo.txt in the install directory.

>

> So I actually do want the delete target to be a dependency of any of the

> install targets. I'm just not sure how to achieve that.


Hi Pico,

I think the error you saw with the AddPreAction approach arises because the
install_dir directory has disappeared. My understanding is that SCons
expects all target directories to exists after it reads all the
SConstruct/SConscript files (it creates the target dirs as needed as it scans
those files). So when it executes any Install() builders, all it does is
copy files into existing directories.

So your AddPreAction() approach should work if you take care to not delete
the directory itself (and any sub-directories), or re-create it (them) after
deleting. Maybe something like:

env.AddPreAction(t_all_install, "find ../install_dir -type f -delete")

M.



More information about the Scons-users mailing list