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

Tarek Ziadé ziade.tarek at gmail.com
Thu Jul 16 02:43:50 CEST 2009


2009/7/15 Sridhar Ratnakumar <SridharR at activestate.com>:
> 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?

I didn't mean that of course. While we can avoid your example for the
code, by removing only
packages that are fully emptied, and are alongside the egg-info directory,
we might not be able to do it properly for the data.

So let's add the directories as well


More information about the Python-Dev mailing list