[Distutils] SetupTools: What Files Were Installed?
lxander.m at gmail.com
Mon Dec 11 17:34:50 CET 2006
On 12/11/06, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 09:43 AM 12/11/2006 -0500, Alexander Michael wrote:
> >Currently, I am easy_install'ing with --record=FILENAME set to save
> >the list of installed filenames in a known location so that I can
> >later visit it to determine what needs to be removed in order to
> >uninstall the package. It would be nice to reduce the footprint on
> >the filesystem by not leaving this trace, but is it possible or even a
> >good idea?
> >Is there a re-usable bit of the SetupTools internals that would allow
> >me to recreate the contents of this file dynamically on-demand without
> Sort of. There's no official API, but the data is more-or-less there. See
> >If not, then in the simple packages that I have been working with,
> >there are two things that need to be found a deleted:
> >1) The egg file or directory in site-packages.
> >2) Any console or GUI scripts in the Scripts/bin directory.
> >I can find the egg file or directory by looking at
> >pkg_resources.Distribution.location, but how to find the scripts? What
> >about a non-default script location setting?
> The scripts' names can be determined from the entry points and the
> 'scripts' metadata directory. Their link to the specific egg(s) can be
> confirmed by inspecting the comment lines at the beginning of the script,
> as easy_install always writes a comment describing the type of script and
> the egg it came from.
> So, in principle you can check script directories for scripts of the right
> name(s) and verify their contents to ensure they are actually associated
> with the egg you plan to remove, and not just another script with the same
I started out doing this, but I had two concerns:
1) Is it safe to assume a one-to-one mapping between entry points and
script files and to recreate naming conventions (including
entrypoint-script.py on Windows)?
2) How do I determine the --script-dir?
It sounds like it is safe to assume 1, but that 2 is indeterminate (as
easy_install does not leave it's own trace about the user overrides at
the time of installation). The result being that there is no generic
mechanism to find the files that need to be deleted in order to
uninstall a package without resorting to requiring that the package
was installed with --record=FILENAME.
I appreciate all your help!
More information about the Distutils-SIG