Issue 719297: sys.path on MacOSX (original) (raw)
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.
Problem is that there are a number of reasonable places we could put these user-extensions:
- ~/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.
And only $(VERSION) isn't even good enough if this code also gets used for non-framework Pythons, because extension modules aren't compatible between framework and non-framework builds.
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.