[Distutils] SetupTools: What Files Were Installed?
Phillip J. Eby
pje at telecommunity.com
Mon Dec 11 17:12:47 CET 2006
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
>reinstalling?
Sort of. There's no official API, but the data is more-or-less there. See
below.
>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
name.
More information about the Distutils-SIG
mailing list