[Pythonmac-SIG] What should be on sys.path for MacPython 2.3

Tony Lownds tony@lownds.com
Sat, 12 Apr 2003 11:28:39 -0700


At 11:15 PM +0200 4/10/03, Jack Jansen wrote:
>On MacOSX sys.path needs to conform more to the platform standard, 
>with extensions (read: python packages) installed in multiple places 
>(per-user, per-machine, network-wide). We can probably ignore 
>network-wide for the time being, and per-machine is more-or-less 
>handled by Python's lib/site-packages, but per-user is needed.

There is no per-machine place to put platform-independent scripts 
though - you have to install those in two places, one for framework 
builds and one for non-framework builds.

>
>- ~/Library/Python - Perl seems to do it this way.
>- ~/Library/Application Support/Python - Seems like a better location
>- One of the above, with "site-packages" appended - allows for more 
>stuff in there, like IDE plugins, Package Manager packages, etc.
>- One of the above, with $(VERSION)/site-packages appended - allows 
>for installation of multiple Python versions without the binary 
>extension modules getting in each others hair.

~/Library/Python is shorter, and there are no spaces in the path. I 
like the idea of having a spot for more stuff, but I also think it is 
more intuitive for ~/Library/Python/ to be in sys.path directly. 
Directories with other purposes under ~/Library/Python won't be put 
on the path unless there is an __init__.py file so I think it might 
make sense NOT to append site-packages or site-python.

>distutils should probably be aware of this convention, and if 
>site-packages isn't writable to the current user fallback to the 
>directory above (or at least give a warning explaining how to do 
>this).
>
>For completeness we could always add the user directory to sys.path, 
>and add the other two (/Library, /Network/Library) only if they 
>exist.

As a user I think I'd prefer distutils to install in /Library/Python/ 
when possible. This way it is available to CGI programs and other 
users without any hassle.

It would seem to be most conforming to the platform standard if the 
order matches the framework search order:

~/Library/Python, /Library/Python, /Network/Library/Python,
/System/Library/Python

http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/Framewo=
rks/chapter_7_section_4.html

My 2=A2

-Tony