[Scons-users] Check if a file was deleted.
William Deegan
bill at baddogconsulting.com
Thu Nov 21 17:30:37 EST 2013
On Nov 21, 2013, at 11:25 AM, Leandro Moreno <leandro.moreno at tallertechnologies.com> wrote:
> Hello everybody.
>
> I have a problem trying to delete a file. Let me explain to you the situation.
>
> I have a plug-in for gcc. This tool (namecheck) checks name's convention. So, to check a file, I should compile It. But, the compiled file is not important for the builder, so, when the builder ends, I want to delete the object files generated by the compiler. I use de Delete() from SCons.Defaults.
> When my builder ends, I take every .cpp file, and I replace that extention for '.o'. But in some cases the compiler does not generate a '.o' file, It generates a '.os' file. So, my function doesn't work.
> I want to develop a better function to do it, but, the problem is that Delete doesn't have a return code to know if the file was deleted or not.
>
> Is there a better way to do this? Or, what can I do to do this?
Safe to assume you have a custom builder for your tool?
You could change:
env['SHOBJSUFFIX'] = '.o'
That's one way.
If you have a custom builder the action for the builder can be an array of strings so ['compile ${SOURCE}…','rm -rf ${TARGET}'] or something like that.
-Bill
More information about the Scons-users
mailing list