Skip to content

Commit fc7bb8c

Browse files
committed
Merged revisions 53304-53433,53435-53450 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r53304 | vinay.sajip | 2007-01-09 15:50:28 +0100 (Tue, 09 Jan 2007) | 1 line Bug #1627575: Added _open() method to FileHandler which can be used to reopen files. The FileHandler instance now saves the encoding (which can be None) in an attribute called "encoding". ........ r53305 | vinay.sajip | 2007-01-09 15:51:36 +0100 (Tue, 09 Jan 2007) | 1 line Added entry about addition of _open() method to logging.FileHandler. ........ r53306 | vinay.sajip | 2007-01-09 15:54:56 +0100 (Tue, 09 Jan 2007) | 1 line Added a docstring ........ r53316 | thomas.heller | 2007-01-09 20:19:33 +0100 (Tue, 09 Jan 2007) | 4 lines Verify the sizes of the basic ctypes data types against the struct module. Will backport to release25-maint. ........ r53340 | gustavo.niemeyer | 2007-01-10 17:13:40 +0100 (Wed, 10 Jan 2007) | 3 lines Mention in the int() docstring that a base zero has meaning, as stated in http://docs.python.org/lib/built-in-funcs.html as well. ........ r53341 | gustavo.niemeyer | 2007-01-10 17:15:48 +0100 (Wed, 10 Jan 2007) | 2 lines Minor change in int() docstring for proper spacing. ........ r53358 | thomas.heller | 2007-01-10 21:12:13 +0100 (Wed, 10 Jan 2007) | 1 line Change the ctypes version number to "1.1.0". ........ r53361 | thomas.heller | 2007-01-10 21:51:19 +0100 (Wed, 10 Jan 2007) | 1 line Must change the version number in the _ctypes extension as well. ........ r53362 | guido.van.rossum | 2007-01-11 00:12:56 +0100 (Thu, 11 Jan 2007) | 3 lines Fix the signature of log_error(). (A subclass that did the right thing was getting complaints from pychecker.) ........ r53370 | matthias.klose | 2007-01-11 11:26:31 +0100 (Thu, 11 Jan 2007) | 2 lines - Make the documentation match the code and the docstring ........ r53375 | matthias.klose | 2007-01-11 12:44:04 +0100 (Thu, 11 Jan 2007) | 2 lines - idle: Honor the "Cancel" action in the save dialog (Debian bug #299092). ........ r53381 | raymond.hettinger | 2007-01-11 19:22:55 +0100 (Thu, 11 Jan 2007) | 1 line SF #1486663 -- Allow keyword args in subclasses of set() and frozenset(). ........ r53388 | thomas.heller | 2007-01-11 22:18:56 +0100 (Thu, 11 Jan 2007) | 4 lines Fixes for 64-bit Windows: In ctypes.wintypes, correct the definitions of HANDLE, WPARAM, LPARAM data types. Make parameterless foreign function calls work. ........ r53390 | thomas.heller | 2007-01-11 22:23:12 +0100 (Thu, 11 Jan 2007) | 2 lines Correct the comments: the code is right. ........ r53393 | brett.cannon | 2007-01-12 08:27:52 +0100 (Fri, 12 Jan 2007) | 3 lines Fix error where the end of a funcdesc environment was accidentally moved too far down. ........ r53397 | anthony.baxter | 2007-01-12 10:35:56 +0100 (Fri, 12 Jan 2007) | 3 lines add parsetok.h as a dependency - previously, changing this file doesn't cause the right files to be rebuilt. ........ r53401 | thomas.heller | 2007-01-12 21:08:19 +0100 (Fri, 12 Jan 2007) | 3 lines Avoid warnings in the test suite because ctypes.wintypes cannot be imported on non-windows systems. ........ r53402 | thomas.heller | 2007-01-12 21:17:34 +0100 (Fri, 12 Jan 2007) | 6 lines patch #1610795: BSD version of ctypes.util.find_library, by Martin Kammerhofer. release25-maint backport candidate, but the release manager has to decide. ........ r53403 | thomas.heller | 2007-01-12 21:21:53 +0100 (Fri, 12 Jan 2007) | 3 lines patch #1610795: BSD version of ctypes.util.find_library, by Martin Kammerhofer. ........ r53406 | brett.cannon | 2007-01-13 01:29:49 +0100 (Sat, 13 Jan 2007) | 2 lines Deprecate the sets module. ........ r53407 | georg.brandl | 2007-01-13 13:31:51 +0100 (Sat, 13 Jan 2007) | 3 lines Fix typo. ........ r53409 | marc-andre.lemburg | 2007-01-13 22:00:08 +0100 (Sat, 13 Jan 2007) | 16 lines Bump version number and change copyright year. Add new API linux_distribution() which supports reading the full distribution name and also knows how to parse LSB-style release files. Redirect the old dist() API to the new API (using the short distribution name taken from the release file filename). Add branch and revision to _sys_version(). Add work-around for Cygwin to libc_ver(). Add support for IronPython (thanks for Anthony Baxter) and make Jython support more robust. ........ r53410 | neal.norwitz | 2007-01-13 22:22:37 +0100 (Sat, 13 Jan 2007) | 1 line Fix grammar in docstrings ........ r53411 | marc-andre.lemburg | 2007-01-13 23:32:21 +0100 (Sat, 13 Jan 2007) | 9 lines Add parameter sys_version to _sys_version(). Change the cache for _sys_version() to take the parameter into account. Add support for parsing the IronPython 1.0.1 sys.version value - even though it still returns '1.0.0'; the version string no longer includes the patch level. ........ r53412 | peter.astrand | 2007-01-13 23:35:35 +0100 (Sat, 13 Jan 2007) | 1 line Fix for bug #1634343: allow specifying empty arguments on Windows ........ r53414 | marc-andre.lemburg | 2007-01-13 23:59:36 +0100 (Sat, 13 Jan 2007) | 14 lines Add Python implementation to the machine details. Pretty-print the Python version used for running PyBench. Let the user know when calibration has finished. [ 1563844 ] pybench support for IronPython: Simplify Unicode version detection. Make garbage collection and check interval settings optional if the Python implementation doesn't support thess (e.g. IronPython). ........ r53415 | marc-andre.lemburg | 2007-01-14 00:13:54 +0100 (Sun, 14 Jan 2007) | 5 lines Use defaults if sys.executable isn't set (e.g. on Jython). This change allows running PyBench under Jython. ........ r53416 | marc-andre.lemburg | 2007-01-14 00:15:33 +0100 (Sun, 14 Jan 2007) | 3 lines Jython doesn't have sys.setcheckinterval() - ignore it in that case. ........ r53420 | gerhard.haering | 2007-01-14 02:43:50 +0100 (Sun, 14 Jan 2007) | 29 lines Merged changes from standalone version 2.3.3. This should probably all be merged into the 2.5 maintenance branch: - self->statement was not checked while fetching data, which could lead to crashes if you used the pysqlite API in unusual ways. Closing the cursor and continuing to fetch data was enough. - Converters are stored in a converters dictionary. The converter name is uppercased first. The old upper-casing algorithm was wrong and was replaced by a simple call to the Python string's upper() method instead. -Applied patch by Glyph Lefkowitz that fixes the problem with subsequent SQLITE_SCHEMA errors. - Improvement to the row type: rows can now be iterated over and have a keys() method. This improves compatibility with both tuple and dict a lot. - A bugfix for the subsecond resolution in timestamps. - Corrected the way the flags PARSE_DECLTYPES and PARSE_COLNAMES are checked for. Now they work as documented. - gcc on Linux sucks. It exports all symbols by default in shared libraries, so if symbols are not unique it can lead to problems with symbol lookup. pysqlite used to crash under Apache when mod_cache was enabled because both modules had the symbol cache_init. I fixed this by applying the prefix pysqlite_ almost everywhere. Sigh. ........ r53423 | guido.van.rossum | 2007-01-14 04:46:33 +0100 (Sun, 14 Jan 2007) | 2 lines Remove a dependency of this test on $COLUMNS. ........ r53425 | ka-ping.yee | 2007-01-14 05:25:15 +0100 (Sun, 14 Jan 2007) | 3 lines Handle old-style instances more gracefully (display documentation on the relevant class instead of documentation on <type 'instance'>). ........ r53440 | vinay.sajip | 2007-01-14 22:49:59 +0100 (Sun, 14 Jan 2007) | 1 line Added WatchedFileHandler (based on SF patch #1598415) ........ r53441 | vinay.sajip | 2007-01-14 22:50:50 +0100 (Sun, 14 Jan 2007) | 1 line Added documentation for WatchedFileHandler (based on SF patch #1598415) ........ r53442 | guido.van.rossum | 2007-01-15 01:02:35 +0100 (Mon, 15 Jan 2007) | 2 lines Doc patch matching r53434 (htonl etc. now always take/return positive ints). ........
1 parent c5c6f24 commit fc7bb8c

48 files changed

Lines changed: 1190 additions & 658 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Doc/lib/liblogging.tex

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,10 +989,11 @@ \subsubsection{FileHandler}
989989
package, sends logging output to a disk file. It inherits the output
990990
functionality from \class{StreamHandler}.
991991

992-
\begin{classdesc}{FileHandler}{filename\optional{, mode}}
992+
\begin{classdesc}{FileHandler}{filename\optional{, mode\optional{, encoding}}}
993993
Returns a new instance of the \class{FileHandler} class. The specified
994994
file is opened and used as the stream for logging. If \var{mode} is
995-
not specified, \constant{'a'} is used. By default, the file grows
995+
not specified, \constant{'a'} is used. If \var{encoding} is not \var{None},
996+
it is used to open the file with that encoding. By default, the file grows
996997
indefinitely.
997998
\end{classdesc}
998999

@@ -1004,6 +1005,41 @@ \subsubsection{FileHandler}
10041005
Outputs the record to the file.
10051006
\end{methoddesc}
10061007

1008+
\subsubsection{WatchedFileHandler}
1009+
1010+
\versionadded{2.6}
1011+
The \class{WatchedFileHandler} class, located in the \module{logging.handlers}
1012+
module, is a \class{FileHandler} which watches the file it is logging to.
1013+
If the file changes, it is closed and reopened using the file name.
1014+
1015+
A file change can happen because of usage of programs such as \var{newsyslog}
1016+
and \var{logrotate} which perform log file rotation. This handler, intended
1017+
for use under Unix/Linux, watches the file to see if it has changed since the
1018+
last emit. (A file is deemed to have changed if its device or inode have
1019+
changed.) If the file has changed, the old file stream is closed, and the file
1020+
opened to get a new stream.
1021+
1022+
This handler is not appropriate for use under Windows, because under Windows
1023+
open log files cannot be moved or renamed - logging opens the files with
1024+
exclusive locks - and so there is no need for such a handler. Furthermore,
1025+
\var{ST_INO} is not supported under Windows; \function{stat()} always returns
1026+
zero for this value.
1027+
1028+
\begin{classdesc}{WatchedFileHandler}{filename\optional{,mode\optional{,
1029+
encoding}}}
1030+
Returns a new instance of the \class{WatchedFileHandler} class. The specified
1031+
file is opened and used as the stream for logging. If \var{mode} is
1032+
not specified, \constant{'a'} is used. If \var{encoding} is not \var{None},
1033+
it is used to open the file with that encoding. By default, the file grows
1034+
indefinitely.
1035+
\end{classdesc}
1036+
1037+
\begin{methoddesc}{emit}{record}
1038+
Outputs the record to the file, but first checks to see if the file has
1039+
changed. If it has, the existing stream is flushed and closed and the file
1040+
opened again, before outputting the record to the file.
1041+
\end{methoddesc}
1042+
10071043
\subsubsection{RotatingFileHandler}
10081044

10091045
The \class{RotatingFileHandler} class, located in the \module{logging.handlers}

Doc/lib/libsmtplib.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ \subsection{SMTP Objects \label{SMTP-objects}}
185185
The server didn't reply properly to the \samp{HELO} greeting.
186186
\item[\exception{SMTPAuthenticationError}]
187187
The server didn't accept the username/password combination.
188-
\item[\exception{SMTPError}]
188+
\item[\exception{SMTPException}]
189189
No suitable authentication method was found.
190190
\end{description}
191191
\end{methoddesc}

Doc/lib/libsocket.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,25 +331,25 @@ \section{\module{socket} ---
331331
\end{funcdesc}
332332

333333
\begin{funcdesc}{ntohl}{x}
334-
Convert 32-bit integers from network to host byte order. On machines
334+
Convert 32-bit positive integers from network to host byte order. On machines
335335
where the host byte order is the same as network byte order, this is a
336336
no-op; otherwise, it performs a 4-byte swap operation.
337337
\end{funcdesc}
338338

339339
\begin{funcdesc}{ntohs}{x}
340-
Convert 16-bit integers from network to host byte order. On machines
340+
Convert 16-bit positive integers from network to host byte order. On machines
341341
where the host byte order is the same as network byte order, this is a
342342
no-op; otherwise, it performs a 2-byte swap operation.
343343
\end{funcdesc}
344344

345345
\begin{funcdesc}{htonl}{x}
346-
Convert 32-bit integers from host to network byte order. On machines
346+
Convert 32-bit positive integers from host to network byte order. On machines
347347
where the host byte order is the same as network byte order, this is a
348348
no-op; otherwise, it performs a 4-byte swap operation.
349349
\end{funcdesc}
350350

351351
\begin{funcdesc}{htons}{x}
352-
Convert 16-bit integers from host to network byte order. On machines
352+
Convert 16-bit positive integers from host to network byte order. On machines
353353
where the host byte order is the same as network byte order, this is a
354354
no-op; otherwise, it performs a 2-byte swap operation.
355355
\end{funcdesc}

Doc/lib/libtest.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ \section{\module{test.test_support} ---
281281
The optional argument \var{testclass} accepts one of the test classes in the
282282
suite so as to print out more detailed information on where the testing suite
283283
originated from.
284+
\end{funcdesc}
284285

285286
The \module{test.test_support} module defines the following classes:
286287

@@ -299,4 +300,3 @@ \section{\module{test.test_support} ---
299300
Temporarily unset the environment variable \code{envvar}.
300301
\end{methoddesc}
301302

302-
\end{funcdesc}

Lib/BaseHTTPServer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def log_request(self, code='-', size='-'):
396396
self.log_message('"%s" %s %s',
397397
self.requestline, str(code), str(size))
398398

399-
def log_error(self, *args):
399+
def log_error(self, format, *args):
400400
"""Log an error.
401401
402402
This is called when a request cannot be fulfilled. By
@@ -408,7 +408,7 @@ def log_error(self, *args):
408408
409409
"""
410410

411-
self.log_message(*args)
411+
self.log_message(format, *args)
412412

413413
def log_message(self, format, *args):
414414
"""Log an arbitrary message.

Lib/ctypes/__init__.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import os as _os, sys as _sys
77

8-
__version__ = "1.0.1"
8+
__version__ = "1.1.0"
99

1010
from _ctypes import Union, Structure, Array
1111
from _ctypes import _Pointer
@@ -133,25 +133,42 @@ class WinFunctionType(_CFuncPtr):
133133
from _ctypes import sizeof, byref, addressof, alignment, resize
134134
from _ctypes import _SimpleCData
135135

136+
def _check_size(typ, typecode=None):
137+
# Check if sizeof(ctypes_type) against struct.calcsize. This
138+
# should protect somewhat against a misconfigured libffi.
139+
from struct import calcsize
140+
if typecode is None:
141+
# Most _type_ codes are the same as used in struct
142+
typecode = typ._type_
143+
actual, required = sizeof(typ), calcsize(typecode)
144+
if actual != required:
145+
raise SystemError("sizeof(%s) wrong: %d instead of %d" % \
146+
(typ, actual, required))
147+
136148
class py_object(_SimpleCData):
137149
_type_ = "O"
138150
def __repr__(self):
139151
try:
140152
return super(py_object, self).__repr__()
141153
except ValueError:
142154
return "%s(<NULL>)" % type(self).__name__
155+
_check_size(py_object, "P")
143156

144157
class c_short(_SimpleCData):
145158
_type_ = "h"
159+
_check_size(c_short)
146160

147161
class c_ushort(_SimpleCData):
148162
_type_ = "H"
163+
_check_size(c_ushort)
149164

150165
class c_long(_SimpleCData):
151166
_type_ = "l"
167+
_check_size(c_long)
152168

153169
class c_ulong(_SimpleCData):
154170
_type_ = "L"
171+
_check_size(c_ulong)
155172

156173
if _calcsize("i") == _calcsize("l"):
157174
# if int and long have the same size, make c_int an alias for c_long
@@ -160,15 +177,19 @@ class c_ulong(_SimpleCData):
160177
else:
161178
class c_int(_SimpleCData):
162179
_type_ = "i"
180+
_check_size(c_int)
163181

164182
class c_uint(_SimpleCData):
165183
_type_ = "I"
184+
_check_size(c_uint)
166185

167186
class c_float(_SimpleCData):
168187
_type_ = "f"
188+
_check_size(c_float)
169189

170190
class c_double(_SimpleCData):
171191
_type_ = "d"
192+
_check_size(c_double)
172193

173194
if _calcsize("l") == _calcsize("q"):
174195
# if long and long long have the same size, make c_longlong an alias for c_long
@@ -177,33 +198,40 @@ class c_double(_SimpleCData):
177198
else:
178199
class c_longlong(_SimpleCData):
179200
_type_ = "q"
201+
_check_size(c_longlong)
180202

181203
class c_ulonglong(_SimpleCData):
182204
_type_ = "Q"
183205
## def from_param(cls, val):
184206
## return ('d', float(val), val)
185207
## from_param = classmethod(from_param)
208+
_check_size(c_ulonglong)
186209

187210
class c_ubyte(_SimpleCData):
188211
_type_ = "B"
189212
c_ubyte.__ctype_le__ = c_ubyte.__ctype_be__ = c_ubyte
190213
# backward compatibility:
191214
##c_uchar = c_ubyte
215+
_check_size(c_ubyte)
192216

193217
class c_byte(_SimpleCData):
194218
_type_ = "b"
195219
c_byte.__ctype_le__ = c_byte.__ctype_be__ = c_byte
220+
_check_size(c_byte)
196221

197222
class c_char(_SimpleCData):
198223
_type_ = "c"
199224
c_char.__ctype_le__ = c_char.__ctype_be__ = c_char
225+
_check_size(c_char)
200226

201227
class c_char_p(_SimpleCData):
202228
_type_ = "z"
229+
_check_size(c_char_p, "P")
203230

204231
class c_void_p(_SimpleCData):
205232
_type_ = "P"
206233
c_voidp = c_void_p # backwards compatibility (to a bug)
234+
_check_size(c_void_p)
207235

208236
# This cache maps types to pointers to them.
209237
_pointer_type_cache = {}

Lib/ctypes/test/test_win32.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,32 @@ def test_callconv_2(self):
3232
# or wrong calling convention
3333
self.assertRaises(ValueError, IsWindow, None)
3434

35+
if sys.platform == "win32":
36+
class FunctionCallTestCase(unittest.TestCase):
37+
3538
if is_resource_enabled("SEH"):
3639
def test_SEH(self):
37-
# Call functions with invalid arguments, and make sure that access violations
38-
# are trapped and raise an exception.
40+
# Call functions with invalid arguments, and make sure
41+
# that access violations are trapped and raise an
42+
# exception.
3943
self.assertRaises(WindowsError, windll.kernel32.GetModuleHandleA, 32)
4044

45+
def test_noargs(self):
46+
# This is a special case on win32 x64
47+
windll.user32.GetDesktopWindow()
48+
49+
class TestWintypes(unittest.TestCase):
50+
def test_HWND(self):
51+
from ctypes import wintypes
52+
self.failUnlessEqual(sizeof(wintypes.HWND), sizeof(c_void_p))
53+
54+
def test_PARAM(self):
55+
from ctypes import wintypes
56+
self.failUnlessEqual(sizeof(wintypes.WPARAM),
57+
sizeof(c_void_p))
58+
self.failUnlessEqual(sizeof(wintypes.LPARAM),
59+
sizeof(c_void_p))
60+
4161
class Structures(unittest.TestCase):
4262

4363
def test_struct_by_value(self):

Lib/ctypes/util.py

Lines changed: 50 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,16 @@ def find_library(name):
4646
import re, tempfile, errno
4747

4848
def _findLib_gcc(name):
49-
expr = '[^\(\)\s]*lib%s\.[^\(\)\s]*' % name
49+
expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
5050
fdout, ccout = tempfile.mkstemp()
5151
os.close(fdout)
52-
cmd = 'if type gcc &>/dev/null; then CC=gcc; else CC=cc; fi;' \
52+
cmd = 'if type gcc >/dev/null 2>&1; then CC=gcc; else CC=cc; fi;' \
5353
'$CC -Wl,-t -o ' + ccout + ' 2>&1 -l' + name
5454
try:
55-
fdout, outfile = tempfile.mkstemp()
56-
os.close(fdout)
57-
fd = os.popen(cmd)
58-
trace = fd.read()
59-
err = fd.close()
55+
f = os.popen(cmd)
56+
trace = f.read()
57+
f.close()
6058
finally:
61-
try:
62-
os.unlink(outfile)
63-
except OSError as e:
64-
if e.errno != errno.ENOENT:
65-
raise
6659
try:
6760
os.unlink(ccout)
6861
except OSError as e:
@@ -73,29 +66,58 @@ def _findLib_gcc(name):
7366
return None
7467
return res.group(0)
7568

76-
def _findLib_ld(name):
77-
expr = '/[^\(\)\s]*lib%s\.[^\(\)\s]*' % name
78-
res = re.search(expr, os.popen('/sbin/ldconfig -p 2>/dev/null').read())
79-
if not res:
80-
# Hm, this works only for libs needed by the python executable.
81-
cmd = 'ldd %s 2>/dev/null' % sys.executable
82-
res = re.search(expr, os.popen(cmd).read())
83-
if not res:
84-
return None
85-
return res.group(0)
86-
8769
def _get_soname(f):
70+
# assuming GNU binutils / ELF
71+
if not f:
72+
return None
8873
cmd = "objdump -p -j .dynamic 2>/dev/null " + f
8974
res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read())
9075
if not res:
9176
return None
9277
return res.group(1)
9378

94-
def find_library(name):
95-
lib = _findLib_ld(name) or _findLib_gcc(name)
96-
if not lib:
97-
return None
98-
return _get_soname(lib)
79+
if (sys.platform.startswith("freebsd")
80+
or sys.platform.startswith("openbsd")
81+
or sys.platform.startswith("dragonfly")):
82+
83+
def _num_version(libname):
84+
# "libxyz.so.MAJOR.MINOR" => [ MAJOR, MINOR ]
85+
parts = libname.split(".")
86+
nums = []
87+
try:
88+
while parts:
89+
nums.insert(0, int(parts.pop()))
90+
except ValueError:
91+
pass
92+
return nums or [ sys.maxint ]
93+
94+
def find_library(name):
95+
ename = re.escape(name)
96+
expr = r':-l%s\.\S+ => \S*/(lib%s\.\S+)' % (ename, ename)
97+
res = re.findall(expr,
98+
os.popen('/sbin/ldconfig -r 2>/dev/null').read())
99+
if not res:
100+
return _get_soname(_findLib_gcc(name))
101+
res.sort(cmp= lambda x,y: cmp(_num_version(x), _num_version(y)))
102+
return res[-1]
103+
104+
else:
105+
106+
def _findLib_ldconfig(name):
107+
# XXX assuming GLIBC's ldconfig (with option -p)
108+
expr = r'/[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)
109+
res = re.search(expr,
110+
os.popen('/sbin/ldconfig -p 2>/dev/null').read())
111+
if not res:
112+
# Hm, this works only for libs needed by the python executable.
113+
cmd = 'ldd %s 2>/dev/null' % sys.executable
114+
res = re.search(expr, os.popen(cmd).read())
115+
if not res:
116+
return None
117+
return res.group(0)
118+
119+
def find_library(name):
120+
return _get_soname(_findLib_ldconfig(name) or _findLib_gcc(name))
99121

100122
################################################################
101123
# test code

0 commit comments

Comments
 (0)