deinstall (Was: Re: [Distutils] setup.py clean questions )

M.-A. Lemburg mal@lemburg.com
Fri Feb 16 06:00:02 2001


Thomas Heller wrote:
> 
> >
> > > Here is a simple deinstall command, which you can
> > > use in your setup script. This can at least be a base for
> > > a discussion about a more complete one.
> >
> > Yes, this is pretty much what I had in mind. One point:
> >
> > >             elif os.path.isdir(name):
> > >                 self._removefiles(name, os.path.join(srcdir, n))
> > >                 if not self.dry_run:
> > >                     os.rmdir(name)
> >
> > I think this needs a try/except around the rmdir(), with a message in the
> > except that the rmdir failed, and possibly, if it failed because the directory
> > wasn't empty, a note that there may may be user additions there.
> OK.
> 
> I currently only use this during development. Do you think
> we should try to establish this as a standard distutils command?

It sure is a good start and far less contrversial than the RPM-
style package repository which was discussed here a few times
already.

I would name the command 'uninstall' though, since this is the
common term for these kinds of operations.

One other area where try-except might be useful is around
os.remove(): the user should be informed about the failure to
complete the command in a different way than by a traceback...
e.g. if the file is locked. If it cannot be found, I think the
correct procedure should be to continue the command ignoring
the error.

-- 
Marc-Andre Lemburg
______________________________________________________________________
Company:                                        http://www.egenix.com/
Consulting:                                    http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/