[Distutils] Req: easy_install.py --site-dirs

Bob Ippolito bob at redivi.com
Sun Jul 17 07:32:16 CEST 2005


On Jul 16, 2005, at 6:45 PM, Robert Kern wrote:

> Phillip J. Eby wrote:
>
>> At 09:22 PM 7/16/2005 -0700, Robert Kern wrote:
>>
>>
>>> Phillip J. Eby wrote:
>>>
>>>
>>>> At 09:01 PM 7/16/2005 -0700, Robert Kern wrote:
>>>>
>>>
>>>
>>>>> Ah, now that's service! It works fine for me. I would suggest  
>>>>> changing
>>>>> the altinstall.pth example, though. Python doesn't seem to like
>>>>>
>>>>>  addsitedir('/Users/kern/lib/python2.4')
>>>>>
>>>>> Although it will be just happy with
>>>>>
>>>>>  import site; site.addsitedir('/Users/kern/lib/python2.4')
>>>>>
>>>>
>>>> Um, the example I put in the EasyInstall doc for --site-dirs was:
>>>>
>>>>         import os; addsitedir(os.path.expanduser('~/lib/ 
>>>> python2.3'))
>>>>
>>>> So I'm not sure what you mean here.
>>>>
>>>
>>> Eventually someone is going to want to do
>>>
>>>   addsitedir('/usr/local/stow/easy_install/lib/python2.4/site- 
>>> packages')
>>>
>>
>> But I didn't give that (or anything like it) as an example in the
>> documentation, so I still don't understand what it is you're  
>> asking me to do.
>>
>
> When I went to modify the example to suit my needs, I thought,  
> "Okay, I
> don't really need to use os.path.expanduser(), so I'll just remove the
> 'import os'." That didn't work. If instead the example had an explicit
> "import site; site.addsitedir(...)", I would never have tried the  
> plain
> "addsitedir(...)" which doesn't work.
>
> An explicit statement that the bare "addsitedir(...)" doesn't work  
> would
> be fine, too.

pth files eval lines that start with the word "import".  If there's  
no import there, it will add it to sys.path.

The fact that addsitedir works bare is uh.. coincidence, because it  
happens to be eval'ed in the scope of the site module.  I wouldn't  
write it like that.

-bob



More information about the Distutils-SIG mailing list