[Distutils] [zc.buildout] running in safe mode
Jim Fulton
jim at zope.com
Fri Oct 3 00:09:15 CEST 2008
On Oct 1, 2008, at 6:34 AM, Tarek Ziadé wrote:
> Hello
>
> I know it is a bad practice for a recipe to return some paths that
> contains important data in the install() method,
> because zc.buildout might remove them.
>
> Nevertheless, it happens from time to time that a developer lose some
> content because of a misconfiguration,
> or a zealous recipe. That is his responsability, and backups are
> done for that.
I don't think backups are the right approach. It's a mistake to have
recipes manage precious data. If you really really really think
that's a good idea, then the recipe should at least manage uninstall
and move precious data aside, rather than remove it.
I don't think it is really the user's problem is a recipe misbehaves
by allowing precious data to be removed.
> But I think we can improve zc.buildout a bit for that:
>
> what about introducing a safe-mode where the developer get prompted
> everytime zc.buildout.rmtree is about to call
> shutil.rmtree ?
>
> The option could be set in [buildout] like this:
>
> [buildout]
> ...
> safe-mode = true
> ...
>
> and challenge the user when a tree is about to be delete. (it might be
> overkill for single files,
> and they are most of the time unimportant configuration files)
>
> This is a small change, and it would avoid running a backup everytime
> the .cfg are changed. because
> it happens all day long when you are developing.
I suspect this would be so annoying to use that no one would use it.
I think it's probably easier to fix the broken recipes. I also think
calling this "safe" mode is misleading. I could live with an option
named something like "prompt-before-removing-files-or-directories".
A better option might be something like "move-aside-on-uninstall",
which would move files or directories aside rather than deleting them.
I still think it would be better to just fix the broken recipes.
Jim
--
Jim Fulton
Zope Corporation
More information about the Distutils-SIG
mailing list