Missing patch in Python 3.4
Davide Liessi
davide.liessi at gmail.com
Fri Mar 6 01:59:11 PST 2015
Hi.
While trying to import a library in Python with the ctypes module, I
noticed that Python 2.7 finds libraries in /opt/local/lib, while Python
3.4 does not.
E.g.
$ /opt/local/bin/python2.7
Python 2.7.9 (default, Dec 15 2014, 12:01:32)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes.util import find_library
>>> find_library('portmidi')
'/opt/local/lib/libportmidi.dylib'
>>>
$ /opt/local/bin/python3.4
Python 3.4.3 (default, Feb 26 2015, 23:50:29)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes.util import find_library
>>> find_library('portmidi')
>>> ^D
$ port installed python27 python34 portmidi
The following ports are currently installed:
portmidi @217_1 (active)
python27 @2.7.9_0+universal (active)
python34 @3.4.3_0 (active)
This happens because in Python 2.7 the file Lib/ctypes/macholib/dyld.py
is patched, while in Python 3.4 it is not.
I think that patch-Lib-ctypes-macholib-dyld.py.diff as in Python 2.7
should be applied also to Python 3.4 (and 3.5?).
Best wishes.
Davide
P.S. The ctypes module is included in Python >= 2.5, but I think that
patching other Python versions is not worth the effort, since they are
going to be deprecated (if I remember correctly).
More information about the macports-dev
mailing list