[Distutils] PEP 376 (Database of Installed Python Distributions), uninstallation and interoperability

Vinay Sajip vinay_sajip at yahoo.co.uk
Sat Feb 16 11:46:31 CET 2013


Chris Jerdonek <chris.jerdonek <at> gmail.com> writes:


> Are there scenarios where it is possible to have "expected" files that
> are not created during installation but rather during the course of
> running the application (e.g. preference files or cache files of some
> sort)?  If so, for cleanup purposes, another option is to have a
> provision for specifying such "post-installation" expected files.

One standard example would be .pyc/.pyo files if byte-compilation were not done
during installation. I believe that preference/cache files should not be in an
installation location, but rather somewhere related to the user's home
directory or equivalent - say, below os.path.expanduser('~'). Deleting these on
uninstallation would IMO best be offered to users as an option using a
distribution-defined (un)installation hook.

Apart from that, it might be hard to pigeon-hole files which turn up in
installation locations post-installation - they would be very application-
dependent. I think it would be sufficient during uninstallation to show the
user any unexpected files and then ask for confirmation before deleting them.
If the user wanted to keep the files, they would have to abort the
uninstallation, manually copy the files to somewhere else, then invoke the
uninstallation again and confirm deletion. (Of course a particular packaging
tool could improve on this basic UI.)

There are other problems related to installation and uninstallation, thinking
about it. I think that the value for the "data" location in sysconfig is
sub-optimal: it seems to be the way it is because it's trying to mirror the
FHS, which has no one blessed location for data, so we default to the "prefix"
location. However, we're relying on developers always installing files to some
subdirectory below the data location, and never to the data location itself: if
they started doing that, you would expect all kinds of potential conflicts to
occur, but IIUC there's no specification that disallows writing into the data
location directory itself. This probably ought to be rectified, too, somehow.

Regards,

Vinay Sajip



More information about the Distutils-SIG mailing list