Problem with PYTHONPATH while running tests

Blair Zajac blair at orcaware.com
Sat Nov 5 11:50:03 PDT 2011


On Nov 5, 2011, at 11:39 AM, Simon Newton wrote:

> Hi,
> 
> I have a port, with a python27 variant that depends on
> protobuf-python27. I've noticed however that when running the test
> phase, PYTHONPATH doesn't include the install location of
> protobuf-python27
> (/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
> on my system) so the tests fail.
> 
> I believe I need to use
> 
> test.env-append PYTHONPATH=${PATH_TO_DEP_INSTALL_LOCATION}
> 
> but I don't know how to get the install location of a dependency from
> within a port file.
> 
> Any hints?

If protobuf-python27 is successfully installed then it shouldn't need PYTHONPATH set up.

Could the test be picking up Apple's python 2.7 from /usr/bin instead of from $prefix/bin?

Can you from the command line do this:

$ python
Python 2.7.2 (default, Aug 23 2011, 21:00:36) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Setting tab completion.
>>> import google.protobuf
>>> google.protobuf
<module 'google.protobuf' from '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/google/protobuf/__init__.pyc'>

Blair



More information about the macports-dev mailing list