[Distutils] PEP 376, Uninstallation and interoperability

Daniel Holth dholth at gmail.com
Mon Feb 18 05:23:39 CET 2013


On Sat, Feb 16, 2013 at 8:23 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> On Sat, Feb 16, 2013 at 10:57 PM, Eric V. Smith <eric at trueblade.com>
> wrote:
> > On 2/16/2013 7:40 AM, Vinay Sajip wrote:
> >> With my suggestion about keeping a list of shared locations around, then
> >> namespace package directories could be kept in such a list. When
> uninstalling,
> >> all the subpackages added in the particular distribution being
> uninstalled would
> >> be removed, but the namespace package directory itself wouldn't be, as
> a shared
> >> location.
> >
> > I don't think the installers know which directories are namespace
> > package directories.
>
> If you limit it to PEP 420 namespaces, then package directories
> without an __init__.py file are namespace packages. (I expect in the
> long run they will actually become more common than the self-contained
> package directory case).
>
> However, that particular objection goes away if you silently leave
> directories containing unregistered files (other than __pycache__)
> alone on uninstall. With that limitation, Vinay's original idea should
> work pretty well.
>
> If a package leaves unregistered files around without mentioning them
> in RECORD, that would then typically either be a bug in the package
> rather than the uninstall tools or the fault of a user leaving an
> editor backup file lying around by editing installed files.
>
> A "clean" command could then just scan the *standard* sysconfig
> directories looking for unregistered files, and give people the option
> of deleting them.
>
> The shared directories + unregistered files problem is a tricky one,
> and even OS installers don't handle it very well. However, Vinay's
> idea would be a solid improvement on the status quo, even without
> trying to solve that particular detail.
>

Wanted to chime in that due to wheel's PEP nature, the pip wheel branch (
https://github.com/qwcode/pip) 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".

IIRC pip also has rules about deleting empty directories but I'm not quite
sure how they are handled.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20130217/48a1c992/attachment.html>


More information about the Distutils-SIG mailing list