[Distutils] PEP 376 - from PyPM's point of view

Sridhar Ratnakumar SridharR at activestate.com
Wed Jul 15 19:38:21 CEST 2009


On Wed, 15 Jul 2009 02:01:24 -0700, Tarek Ziadé <ziade.tarek at gmail.com>  
wrote:

>>> get_installed_files(local=False) -> iterator of (path, md5, size)
>>
>> Will this also return the directories /created/ during the installation?
>> For example, will it also contain the entry "docutils" .. along with
>> "docutils/__init__.py"?
>
> I don't think it's necessary to add "docutils" if
> "docutils/__init__.py" is present
>
> But for empty directories added during installation we should add the I  
> guess.
>
> So, I'll add a note.

It seems that you overlooked the below paragraph.

>> If not, how is the installer (pip, pypm, etc..) supposed to know which
>> directories to remove (docutils/) and which directories not to remove
>> (site-packages/, bin/, etc..)?

Quoting from the PEP:

[quote]'(...)uninstall uses the APIs described earlier and remove all  
unique files, as long as their hash didn't change. Then it removes empty  
directories left behind.'[endquote]

Let's assume that site-packages/ contained only one package 'Foo'. Will  
uninstall('Foo') remove the site-packages/ directory just because it  
turned out to be empty after removing 'Foo'? To explain, let's assume the  
RECORD of 'Foo' contains:

$ cat RECORD
Foo/__init__.py
Foo/bar/__init__.py
Foo/bar/test.py

and according to what you wrote in the PEP ("it removes empty directories  
left behind"):

$ python -m distutils.util.uninstall Foo
rm /.../site-packages/Foo/__init__.py
rm /.../site-packages/Foo/bar/__init__.py
rm /.../site-packages/Foo/bar/test.py
rm empty dir /.../site-packages/Foo/bar
rm empty dir /.../site-packages/Foo/
rm empty dir /.../site-packages/        # !!!!!

it also remove the site-packages directory!

Then there is ~/python26/bin, ~/python26/include, ~/python26/etc, etc.. Do  
you see my point?

> btw: is PyPM a public project ?

If by 'public', you meant open source, then no.

-srid


More information about the Distutils-SIG mailing list