[Scons-users] Starting with a clean installation directory

Pico Geyer picogeyer at gmail.com
Tue Oct 22 15:58:23 EDT 2013


On Mon, Oct 21, 2013 at 11:49 PM, Dirk Bächle <tshortik at gmx.de> wrote:


> Pico,

>

> On 21.10.2013 21:22, Pico Geyer wrote:

>

>

>

>

> [...]

>

> I think you're looking for

>>

>> Execute(Delete('../install_dir'))

>>

>> which removes the folder at the time when the SConscript is read in, and

>> not during the Build process like for Command().

>> Please, also have a look in the UserGuide, "12.7. Executing an action

>> immediately: the Execute Function".

>>

>

> 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.

>

>

> okay here's my next guess:

>

> if 'install' in BUILDTARGETS:

> Execute(Delete('../install_dir'))

>

>

> env = Environment()

> t_all_install = []

> t_all_install.append(env.Install('../install_dir', 'foo2.txt'))

> t_all_install.append(env.Install('../install_dir', 'foo.txt'))

> env.Alias('install', t_all_install)

> env.Default('install')

>

> Like this, whenever you try to build the target (alias) 'install' the

> folder gets removed completely.

> Is this closer to what you actually want?

>


Dirk, that's exactly what I want.
Thanks for your help!
Regards,
Pico
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131022/ee739d62/attachment.htm


More information about the Scons-users mailing list