[Patches] [ python-Patches-1610795 ] BSD version of ctypes.util.find_library

SourceForge.net noreply at sourceforge.net
Fri Dec 8 21:32:22 CET 2006


Patches item #1610795, was opened at 2006-12-07 14:29
Message generated for change (Comment added) made by theller
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1610795&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Martin Kammerhofer (mkam)
Assigned to: Thomas Heller (theller)
Summary: BSD version of ctypes.util.find_library 

Initial Comment:
The ctypes.util.find_library function for Posix systems is actually
tailored for Linux systems. While the _findlib_gcc function relies
only on the GNU compiler and may therefore work on any system with the
"gcc" command in PATH, the _findLib_ld function relies on the
/sbin/ldconfig command (originating from SunOS 4.0) which is not
standardized. The version from GNU libc differs in option syntax and
output format from other ldconfig programs around.

I therefore provide a patch that enables find_library to properly
communicate with the ldconfig program on FreeBSD systems. It has been
tested on FreeBSD 4.11 and 6.2. It probably works on other *BSD
systems too. (It works without this patch on FreeBSD, because after
getting an error from ldconfig it falls back to _findlib_gcc.)

While at it I also tidied up the Linux specific code: I'm escaping the
function argument before interpolating it into a regular expression (to
protect against nasty regexps) and removed the code for creation of a
temporary file that was not used in any way.


----------------------------------------------------------------------

>Comment By: Thomas Heller (theller)
Date: 2006-12-08 21:32

Message:
Logged In: YES 
user_id=11105
Originator: NO

I have tested the patch on FreeBSD 6.0 and (after extending the check to
test for sys.platform.startswith("openbsd")) on OpenBSD 3.9 and it works
fine.

find_library("c") now returns libc.so.6 on FreeBSD 6.0, and libc.so.39.0
in OpenBSD 3.9, while it returned 'None' before on both machines.

----------------------------------------------------------------------

Comment By: David Remahl (chmod007)
Date: 2006-12-08 08:50

Message:
Logged In: YES 
user_id=2135
Originator: NO

# Does this work (without the gcc fallback) on other *BSD systems too?

I don't know, but it doesn't work on Darwin (which already has a custom
method through macholib).

----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2006-12-07 22:11

Message:
Logged In: YES 
user_id=11105
Originator: NO

Will do (although I would appreciate review from others too; I'm not
exactly a BSD expert).

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2006-12-07 20:15

Message:
Logged In: YES 
user_id=21627
Originator: NO

Thomas, can you take a look?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1610795&group_id=5470


More information about the Patches mailing list