[Distutils] PEP 376: uninstall before upgrading an install?

Kevin Teague kevin at bud.ca
Fri Jul 3 23:03:41 CEST 2009


Currently, if you install a distribution via distutils (python
setup.py install), then later get a new version of that distribution
and upgrade your install, if the files to be installed change from one
version to the next the old, unused files get left in-place (generally
this is quite rare, since re-naming packages/modules means developers
need to change imports, etc. which is a hassle, but it is possible).

e.g. If "Spam-1.0" provides "ham.py, eggs.py" and "Spam-2.0" provides
"eggs.py, toast.py", then upgrading would leave an extra ham.py file
kicking around in site-packages, or vice-versa with toast.py if
downgrading.

At least, I'm being lazy and not actually testing this behaviour, but
I think that this is the current status with Distutils installs?

With a record of all installed files for a given version of a
distribution though, it would be possible to detect that a
distribution was already installed and that an upgrade/downgrade/
sidegrade is being performed, and if an uninstall was first done on
the old version before the new version was installed, this would
prevent any stray files from appearing in site-packages.

Has this already been considered? And if not, is there any reason why
an uninstall shouldn't happen before a distribution is upgraded in-
place?


More information about the Distutils-SIG mailing list