I've been thinking about uninstallation of distributions, and it seems possible
that PEP 376 is underspecified if we want uninstallation to work interoperably
between different tools that implement the PEP.
It seems desirable that uninstallation should undo the process of installation
as far as possible. This of course means removing files that were installed,
but it also means removing directories which were created during installation.
While not saying so explicitly, PEP 376 strongly implies that only files are
named in RECORD, and not directories. When removing directories during
uninstallation, an initial candidate set of directories to cull would be the
ancestor directories of all files named in RECORD, up to a certain point. That
"certain point" would exclude any of the directories shared by distributions,
and their ancestors. Those shared directories are the ones defined in the
sysconfig installation schemes under the keys 'purelib', 'platlib', 'include',
'scripts' and 'data'. There's also a notional 'base' (equivalent to prefix as
in sys.prefix), but for all schemes as currently defined, this is the same as
'data'. So the lib/pythonX.Y/site-packages, bin, include etc. directories and
their ancestor directories would be immune from deletion, as we would want.
Although sysconfig gives *default* values for these locations, it seems likely
that tools will offer users options to override the defaults using e.g. command
line parameters or configuration files. If such options are made use of and the
overriding values used are not recorded, then there is no obvious way of
determining where to stop with directory deletion during uninstallation.
Another question arises - what is to be done when directories, which are
meant to be deleted during uninstallation, contain files which were not put
there during installation of the distribution being removed? It would be useful
for packaging tools to inform users about the extraneous, unexpected files and
perhaps get confirmation before proceeding with directory deletion. However,
since shared directories are likely to contain files put there by other
installation operations, you wouldn't want to include these when checking for
Unless I've missed something obvious, I think the lack of information about
shared directories needs to be rectified. One simple way of achieving this is
to add to the files in .dist-info another text file, perhaps called SHARED,
which lists the values actually used for 'purelib', 'platlib' etc. at
installation time, in a key=value format (one per line in the file). The file
should contain entries for at least all of the keys used in sysconfig, but
it can also contain other user-defined keys (e.g. some tools might have the
concept of a specific directories for man pages or HTML documentation, or
sysconfig might grow more keys in the future).
What do you think about this? I'd like your comments.