[Python-modules-team] Bug#509125: Missing dependency
Tanguy Ortolo
tanguy+debian at ortolo.eu
Fri Feb 24 09:30:21 UTC 2012
reassign 509125 python
retitle 509125 ctypes.utils.find_library() fails to find some libraries
with non-English locales
tags 509125 + patch
thanks
Well, that was a tricky (and funny) bug. After investigating, it appears
the problem does not come from Impressive! or from PyOpenGL but from
Python's ctypes.utils.find_library() itself.
Here is the symptom; as you will see it is locale-related:
% LANG=fr_FR.UTF-8 python
>>> from util import find_library
>>> find_library("GLU")
'libGLU.so.1'
>>> find_library("GL")
[nothing]
While:
% LANG=C python
>>> from ctypes.util import find_library
>>> find_library("GLEW")
'libGLEW.so.1.6'
>>> find_library("GL")
'libGL.so.1'
Tracking down this issue, I could determine that it came from
the fact that find_library() was using ldconfig -p's output, which was
localized. Specifically:
% LANG=fr_FR.UTF-8 ldconfig -p | grep -F libGL.
libGL.so.1 (libc6,x86-64, Système d'exploitation ABI : Linux 2.4.20) => /usr/lib/x86_64-linux-gnu/libGL.so.1
libGL.so.1 (libc6, Système d'exploitation ABI : Linux 2.4.20) => /usr/lib32/libGL.so.1
While:
% LANG=C ldconfig -p | grep -F libGL.
libGL.so.1 (libc6,x86-64, OS ABI: Linux 2.4.20) => /usr/lib/x86_64-linux-gnu/libGL.so.1
libGL.so.1 (libc6, OS ABI: Linux 2.4.20) => /usr/lib32/libGL.so.1
find_library() applies a regex to this filter, which expects the English
result (ctypes/utils.py:234):
expr = r'(\S+)\s+\((%s(?:, OS ABI:[^\)]*)?)\)[^/]*(/[^\(\)\s]*lib%s\.[^\(\)\s]*)' \
% (abi_type, re.escape(name))
So, here is a very patch to make that work regardless of the locale,
changing the ldconfig call in ctypes/utils.py:236 so that is forces the
C locale:
f = os.popen('LC_ALL=C /sbin/ldconfig -p 2>/dev/null')
Regards,
--
,--.
: /` ) Tanguy Ortolo <xmpp:tanguy at ortolo.eu> <irc://irc.oftc.net/Tanguy>
| `-' Debian Developer
\_
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ctypes.util.py.patch
Type: text/x-diff
Size: 530 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20120224/3a7a6a87/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20120224/3a7a6a87/attachment-0001.pgp>
More information about the Python-modules-team
mailing list