[Pythonmac-SIG] Use Setup.py to install to /usr

Pascal Schaedeli pascals_sub at pobox.com
Mon Apr 27 07:38:53 CEST 2009


Thank you all on and off the list for your help and suggestions. I had tried
to understand the meaning of
http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard for OS X, and
your warnings clarified the difference between /usr and usr/local.

Since duplicity is written to run under all Python >= 2.3, I attempted to
make the installation non-version specific to ease Python upgrades. However,
I hadn't realized that .pyc files were not backward compatible. So for now,
duplicity is again installed in the version specific Python.framework
directory.

I sincerely appreciate your time helping me out. Thx again.
Pascal


> ---------- Forwarded message ----------
> From: Christopher Barker <Chris.Barker at noaa.gov>
> To: pythonmac-sig at python.org
> Date: Mon, 20 Apr 2009 12:15:16 -0700
> Subject: Re: [Pythonmac-SIG] Use Setup.py to install to /usr
> Pascal Schaedeli wrote:
>
>> Here is the temporary solution I've found for my case. Still looking for
>> better suggestions.
>>
>
> my main suggestion is to "don't do that". A few notes:
>
> 1) Ned's right -- DO NOT put stuff in /usr/lib -- use /usr/local/lib, if at
> all.
>
>  To recap, my problem is that by default, "python setup.py install" places
>> all files under
>> "/Library/Frameworks/Python.framework/Versions/Current/bin/".
>>
>
> Right, that's the whole point of distutils -- it installs stuff where it
> belongs for the python the setup,oy is run with. If all else fails, you
> could do:
>
> setup.py build
>
> then hand-copy everything where you want it.
>
>  Unfortunately, sys.prefix is
>> "/Library/Frameworks/Python.framework/Versions/2.5", so the necessary
>> imports in "/usr/lib/python2.5/site-packages" are never found (didn't
>> research further, but this is probably a python compile time option).
>>
>
> it's doing the right thing -- you are trying to do something odd, so you'll
> need to add the extra path yourself.
>
>  I did two manual adjustments:
>>
>>    * Moved necessary imports from "/usr/lib/python2.5/site-packages" to
>>      "/usr/lib/site-python" to remove the python version specificity.
>>
>
> Bad idea -- version specificity is there for a reason -- 2.x and 2.x+n are
> not necessarily fully compatibile -- definitely not if they have any
> compiled extensions
>
>       Let me know if there is any way to achieve this with setup.py.
>>
>
> I don't think so.
>
>     * Added "/usr/lib/site-python" to PYTHONPATH environment variable.
>>
>
> I dont like using PYTHONPATH -- it's global to ALL pythons, which can cause
> trouble.
>
> Rather, I'd use a *.pth file, put in /Library/........./site-packages. You
> can look at wxPython for an example, it uses a *.pth file to add paths in
> /usr/local so that the python,org an Apple pythons can share the same
> wxPython install -- note that those are both 2.5, though.
>
>
> I'm still not sure what problem you are trying to solve. If you install in
> the usual way, and upgrade form 2.5.x to 2.5.x+1, it will just work.
>
> If you upgrade to 2.6.*, it probably will need a new install of your
> package anyway.
>
>   in order to be able to upgrade or switch to another
>>    python version without affecting the availability of duplicity.
>>
>
> You can install a new python, and keep the old one around, so that it will
> still be able to run old code, so this may be a non-issue anyway.
>
> -Chris
>
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker at noaa.gov
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20090426/2d0f5059/attachment.htm>


More information about the Pythonmac-SIG mailing list