[Scons-users] Possible Bug in cleaning Aliases

William Deegan bill at baddogconsulting.com
Sat Nov 10 15:52:03 EST 2012


Mark,

Firstly thanks for tracking down and fixing the issue!

The best thing to do to ensure this doesn't get dropped is to file a bug, and do a bitbucket pull request with the fix.
Do you have a simple test case to reproduce the bug?
(New code changes require new tests to get checked into SCons)

Thanks,
Bill
On Nov 9, 2012, at 7:19 PM, Mark Ribau <mribau at realtaentertainment.com> wrote:


> Joined the mailing list just to get help with this possible bug. Hopefully this list is the correct one to post in for this.

>

> Steps to Reproduce:

> Have Aliases that each have multiple targets attached to it.

> Some of these individual targets are marked Precious and NoClean.

> Build the Aliases

> Clean the Aliases

>

> Result:

> Cleaning the Alias deletes all the targets, including the targets that are marked NoClean.

> Additionally, some Aliases' targets would NEVER be cleaned AT ALL, even though they were NOT marked Precious NOR NoClean.

>

> Expected Result:

> Cleaning the Alias correctly deletes the targets NOT marked as NoClean.

>

> I changed some code in SCons/Script/Main.py that appears to fix it though:

>

> Diff:

> 346,348c346,347

> < target = self.targets[0]

> < if (target.has_builder() or target.side_effect) and not target.noclean:

> < for t in self.targets:

> ---

> > for t in self.targets:

> > if (t.has_builder() or t.side_effect) and not t.noclean:

> 361,364c360,363

> < if target in SCons.Environment.CleanTargets:

> < files = SCons.Environment.CleanTargets[target]

> < for f in files:

> < self.fs_delete(f.abspath, str(f))

> ---

> > if t in SCons.Environment.CleanTargets:

> > files = SCons.Environment.CleanTargets[t]

> > for f in files:

> > self.fs_delete(f.abspath, str(f))

>

>

> Including all the code to make it easier:

>

> Old Version:

> def remove(self):

> target = self.targets[0]

> if (target.has_builder() or target.side_effect) and not target.noclean:

> for t in self.targets:

> try:

> removed = t.remove()

> except OSError, e:

> # An OSError may indicate something like a permissions

> # issue, an IOError would indicate something like

> # the file not existing. In either case, print a

> # message and keep going to try to remove as many

> # targets aa possible.

> print "scons: Could not remove '%s':" % str(t), e.strerror

> else:

> if removed:

> display("Removed " + str(t))

> if target in SCons.Environment.CleanTargets:

> files = SCons.Environment.CleanTargets[target]

> for f in files:

> self.fs_delete(f.abspath, str(f))

>

> New Version:

> def remove(self):

> for t in self.targets:

> if (t.has_builder() or t.side_effect) and not t.noclean:

> try:

> removed = t.remove()

> except OSError, e:

> # An OSError may indicate something like a permissions

> # issue, an IOError would indicate something like

> # the file not existing. In either case, print a

> # message and keep going to try to remove as many

> # targets aa possible.

> print "scons: Could not remove '%s':" % str(t), e.strerror

> else:

> if removed:

> display("Removed " + str(t))

> if t in SCons.Environment.CleanTargets:

> files = SCons.Environment.CleanTargets[t]

> for f in files:

> self.fs_delete(f.abspath, str(f))

>

>

>

> ----

> mark ribau

> software engineer

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20121110/f852d10b/attachment.html>


More information about the Scons-users mailing list