Automatic Cleaning¶
StepUp follows the same cleanup strategy as tup:
If a step is removed or modified so that an output file is no longer created,
StepUp will remove this output.
This is also similar to Ninja’s cleandead command,
but it is enabled by default in StepUp.
Sometimes, it can be helpful to postpone the cleanup until you are sure that the output files are no longer needed. This can be done in one of three ways:
- Add the
--no-cleanoption to thesbcommand. This will prevent StepUp from removing any output files. - Set the environment variable
STEPUP_CLEAN=0. This can be overridden again by the--cleancommand-line option, in case you want to perform such cleaning only occasionally. - Block some steps by adding the
block=Trueargument to thestep()function in yourplan.pyscript.
Automatic cleaning’s primary advantage is preventing potential bugs and reducing confusion caused by outdated or irrelevant output files.
Try the Following¶
To illustrate the automatic cleaning, take the files from the example File copy
and start StepUp in interactive mode.
Make the following changes and rerun the affected steps after each point by pressing r in the terminal:
-
Change the directory
sub/tofoo/inplan.py. Rerunning StepUp will not only createfoo/andfoo/hello.txt. After completing all pending steps,sub/andsub/hello.txtwill be removed. -
Change all occurrences of
hello.txtinplan.pytohi.txt. Rerunning StepUp will not only createhi.txtandfoo/hi.txt. After completing all pending steps,hello.txtandfoo/hello.txtwill be removed. -
Undo all changes and run StepUp again. You should end up with the original output without any remnants from the previous two steps.