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

Pascal Schaedeli pascals_sub at pobox.com
Mon Apr 20 01:03:07 CEST 2009

Here is the temporary solution I've found for my case. Still looking for
better suggestions.
To recap, my problem is that by default, "python setup.py install" places
all files under
"/Library/Frameworks/Python.framework/Versions/Current/bin/". When I added
"--prefix=/usr" as a setup.py argument, the main executable is correctly
located under /usr/bin, but many python files to be imported are copied to a
newly created directory "/usr/lib/python2.5/site-packages". Then, when
python starts, the site module (http://docs.python.org/library/site.html)
adds the concatenation of sys.prefix and lib/python2.5/site-packages as well
as lib/site-python and adds those combinations to the path.

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).

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. Let me know
   if there is any way to achieve this with setup.py.
   - Added "/usr/lib/site-python" to PYTHONPATH environment variable.


On Sat, Apr 18, 2009 at 5:23 PM, Pascal Schaedeli <pascals_sub at pobox.com>wrote:

> How to you instruct "setup.py install" to install all files under /usr
> instead of /Library/Frameworks/Python.framework/Versions/Current/bin/?
> I tried:
> python ./setup.py install --prefix=/usr --dry-run
> But it still attempts to create directories
> like /usr/lib/python2.5/site-packages
> I am trying to install "Duplicity", a backup tool using rsync and don't
> want it to be installed in the tree of a specific Python distribution in
> order to be able to upgrade or switch to another python version without
> affecting the availability of duplicity.
> Thanks.
> Pascal S.

pascals at pobox.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20090419/fe9b1907/attachment.htm>

More information about the Pythonmac-SIG mailing list