Robin Becker wrote:
> Bruno Desthuilliers wrote:
>> Robin Becker a écrit :
>>> John J. Lee wrote:
>>>
>>>> Robin Becker <[EMAIL PROTECTED]> writes:
>>>>
>>>>> I see a folder .python-eggs in my home directory on one of our servers
>>>>> with various .so files
>>>>>
>>>>> ~/.python-eggs/MySQL_python-1.2.2-py2.3-freebsd-6.1-SECURITY-i386.egg-tmp/_mysql.so
>>>>>  
>>>>>
>>>>>
>>>>> are these just left behind from some install process?
>>>> Ah, it's about the resource extraction feature of setuptools.  It's
>>>> possible for zipped eggs to contain resources that have to be
>>>> extracted to the filesystem.  It puts them in the directory you saw
>>>> (or somewhere else -- see the docstring in my other reply).
>>>>
>>>> http://peak.telecommunity.com/DevCenter/PkgResources#resource-extraction
>>>> http://peak.telecommunity.com/DevCenter/setuptools#automatic-resource-extraction
>>>>  
>>>>
>>> .....
>>> Thanks John, but why not clean up?
>>>
>> Does it needs to be "cleaned up" ? .so files (shared libs) *need* to be 
>> extracted from the egg to be usable. Where they are extracted is IIRC 
>> configurable...
> You're right! These files aren't temporary?

They're a cache.

> It seems strange that the python 
> files live with their associated lib/site-packages and the .so files are 
> somewhere entirely different.
> 
> Python 2.3.6 (#1, Jun  7 2007, 10:44:52)
> [GCC 3.4.4 [FreeBSD] 20050518] on freebsd6
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> import MySQLdb
>  >>> print MySQLdb.__file__
> /myhome/PYTHON/lib/python2.3/site-packages/MySQL_python-1.2.2-py2.3-freebsd-6.1-SECURITY-i386.egg/MySQLdb/__init__.pyc
>  >>> import _mysql
>  >>> print _mysql.__file__
> /myhome/.python-eggs/MySQL_python-1.2.2-py2.3-freebsd-6.1-SECURITY-i386.egg-tmp/_mysql.so
>  >>>
> 
> it would seem simpler to have the .so files inside the site-packages and 
> there's 
> the question of why this folder has to be obfuscated (name starts with .). 
> Even 
> if these files are "resources" why should they be assumed to belong to the 
> user?

Because they are unpacked at runtime by the user that imported the module.
Usually, they won't have write access to site-packages.

> I could make the PYTHON folder world usable, but that won't help if I make 
> all 
> other things in myhome private. Surely code resources belong in the same area 
> as 
> the code that uses them.

Well, you can't import a .so from a zip file. Thus they need to be placed
somewhere else. Don't worry about making ~/.python-eggs world readable. When
other users import the package, they will have the .so's unpacked, too.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to