msg139230 - (view) |
Author: Vinay Sajip (vinay.sajip) *  |
Date: 2011-06-26 23:50 |
In general it is possible for an installation to make certain system changes other than the record of files written during an installation (for example, under Windows, there may be distribution-specific Windows registry updates). There seems to be no hook that's called when a distribution is removed, which would allow distribution-specific cleanup code to be called (e.g. to undo Windows registry changes). Such a hook should be provided. |
|
|
msg139274 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2011-06-27 14:06 |
I have no objection, but you may want to ask on the fellowship ML first. Should the hooks be run before the removal or just after? (Debian for example has both, which makes four hooks: preinst, postinst, prerm, postrm). Our setup_hooks (used with pysetup commands) are run right after the setup.cfg file is parsed, before any operation is started. Regarding implementation: The hook should be defined in the global section of setup.cfg; upon installation, packaging would write this info into the dist-info directory (say in an UNINSTALLHOOKS file), which would be read when preparing an uninstallation. |
|
|
msg139295 - (view) |
Author: Tarek Ziadé (tarek) *  |
Date: 2011-06-27 15:14 |
Sounds good. Also, we should make the assumption that this hook might be deactivated or might fail. So it should not break the uninstallation in this case (a warning seem fine) |
|
|
msg139296 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2011-06-27 15:16 |
Definitely, hooks do not stop operation. I’ll double-check that. We may want an option to turn hooks failures into fatal errors. |
|
|
msg139298 - (view) |
Author: Tarek Ziadé (tarek) *  |
Date: 2011-06-27 15:21 |
We need to make it crystal clear in the doc: developers need to understand this behavior. Also, for a fatal error, I am -1 for activating this for an uninstall hook because we want to uninstall wathever happens in the hooks, +1 for others (as long as it's coupled with a --force option) It can be a specific exception the hook can raise to stop the process |
|
|
msg139302 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2011-06-27 15:34 |
The setup.cfg spec says only this: > The callables are executed in the order they’re found in the file; if > one of them cannot be found, tools should not stop, but for example > produce a warning and continue with the next line. packaging/commandhooks does not say anything. I’ll open a bug to add docs and tests about that, and a feature request for the new option to turn warnings into fatal errors. |
|
|
msg145019 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2011-10-06 15:26 |
Editing title to reflect the scope of the needed feature. |
|
|
msg145952 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2011-10-19 20:07 |
I’ve opened #13225 about the error handling. |
|
|