Python site-packages
Joshua Root
jmr at macports.org
Tue Jul 3 02:28:24 PDT 2012
On 2012-7-3 19:05 , Dan Ports wrote:
> While working on a port that installs Python bindings, I was surprised
> to discover that $prefix/lib/python2.7/site-packages wasn't in
> python27's package search path. (The correct path, apparently, is
> $frameworks_dir/Python/Versions/2.7/lib/site-packages.)
>
> I was surprised by this because, in addition to being a natural place
> to look, it's also the path that automake's AM_PATH_PYTHON detects. So
> ports that use automake may install into the wrong place.
>
> Sure enough, I found a few examples of this on my system: libcaca,
> xorg-xcb-proto, and git-core had modules installed into
> $prefix/lib/python2.7/site-packages.
>
> I wonder if there are other ports that have this problem, and if we
> should do something besides fixing them each individually. (I'm not
> sure what that would be -- adding $prefix/lib/python2.7/site-packages
> to the search path? replacing it with a symlink to the proper
> directory?)
Seems to me like AM_PATH_PYTHON is doing it wrong. It determines
pythondir by running:
sysconfig.get_python_lib(0,0,prefix='$am_py_prefix')
where am_py_prefix=$prefix. If it didn't override the prefix, it would
get the right answer.
But of course, assigning blame doesn't fix the problem. Patching
sys.path would probably be the better option if we don't want to tell
individual configure script the correct pythondir value.
- Josh
More information about the macports-dev
mailing list