<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Feb 16, 2013 at 8:23 AM, Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Sat, Feb 16, 2013 at 10:57 PM, Eric V. Smith <<a href="mailto:eric@trueblade.com">eric@trueblade.com</a>> wrote:<br>
> On 2/16/2013 7:40 AM, Vinay Sajip wrote:<br>
>> With my suggestion about keeping a list of shared locations around, then<br>
>> namespace package directories could be kept in such a list. When uninstalling,<br>
>> all the subpackages added in the particular distribution being uninstalled would<br>
>> be removed, but the namespace package directory itself wouldn't be, as a shared<br>
>> location.<br>
><br>
> I don't think the installers know which directories are namespace<br>
> package directories.<br>
<br>
</div>If you limit it to PEP 420 namespaces, then package directories<br>
without an __init__.py file are namespace packages. (I expect in the<br>
long run they will actually become more common than the self-contained<br>
package directory case).<br>
<br>
However, that particular objection goes away if you silently leave<br>
directories containing unregistered files (other than __pycache__)<br>
alone on uninstall. With that limitation, Vinay's original idea should<br>
work pretty well.<br>
<br>
If a package leaves unregistered files around without mentioning them<br>
in RECORD, that would then typically either be a bug in the package<br>
rather than the uninstall tools or the fault of a user leaving an<br>
editor backup file lying around by editing installed files.<br>
<br>
A "clean" command could then just scan the *standard* sysconfig<br>
directories looking for unregistered files, and give people the option<br>
of deleting them.<br>
<br>
The shared directories + unregistered files problem is a tricky one,<br>
and even OS installers don't handle it very well. However, Vinay's<br>
idea would be a solid improvement on the status quo, even without<br>
trying to solve that particular detail.<br></blockquote><div><br></div><div>Wanted to chime in that due to wheel's PEP nature, the pip wheel branch (<a href="https://github.com/qwcode/pip">https://github.com/qwcode/pip</a>) also includes an implementation of uninstall-from-RECORD. Pip seeks out and destroys .pyc files on uninstall without needing them in RECORD since they can pop up in un^H^Hexpected places whenever a new version of Python is run. We also follow the simple rule "paths in RECORD are always relative to site-packages, unless a relative path is not possible on the OS".<br>
<br></div><div>IIRC pip also has rules about deleting empty directories but I'm not quite sure how they are handled.<br></div></div></div></div>