Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(25271)

Side by Side Diff: Doc/library/ctypes.rst

Issue 21042: ctypes.util.find_library() should return full pathname instead of filename in linux
Patch Set: Created 3 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Lib/ctypes/test/test_find.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`ctypes` --- A foreign function library for Python 1 :mod:`ctypes` --- A foreign function library for Python
2 ======================================================= 2 =======================================================
3 3
4 .. module:: ctypes 4 .. module:: ctypes
5 :synopsis: A foreign function library for Python. 5 :synopsis: A foreign function library for Python.
6 .. moduleauthor:: Thomas Heller <theller@python.net> 6 .. moduleauthor:: Thomas Heller <theller@python.net>
7 7
8 8
9 :mod:`ctypes` is a foreign function library for Python. It provides C compatibl e 9 :mod:`ctypes` is a foreign function library for Python. It provides C compatibl e
10 data types, and allows calling functions in DLLs or shared libraries. It can be 10 data types, and allows calling functions in DLLs or shared libraries. It can be
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 1245
1246 Try to find a library and return a pathname. *name* is the library name with out 1246 Try to find a library and return a pathname. *name* is the library name with out
1247 any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version number (thi s 1247 any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version number (thi s
1248 is the form used for the posix linker option :option:`-l`). If no library ca n 1248 is the form used for the posix linker option :option:`-l`). If no library ca n
1249 be found, returns ``None``. 1249 be found, returns ``None``.
1250 1250
1251 The exact functionality is system dependent. 1251 The exact functionality is system dependent.
1252 1252
1253 On Linux, :func:`find_library` tries to run external programs 1253 On Linux, :func:`find_library` tries to run external programs
1254 (``/sbin/ldconfig``, ``gcc``, and ``objdump``) to find the library file. It 1254 (``/sbin/ldconfig``, ``gcc``, and ``objdump``) to find the library file. It
1255 returns the filename of the library file. Here are some examples:: 1255 returns the absolute path of the library file. Here are some examples::
1256 1256
1257 >>> from ctypes.util import find_library 1257 >>> from ctypes.util import find_library
1258 >>> find_library("m") 1258 >>> find_library("m")
1259 'libm.so.6' 1259 '/lib/x86_64-linux-gnu/libm.so.6'
1260 >>> find_library("c") 1260 >>> find_library("c")
1261 'libc.so.6' 1261 '/lib/x86_64-linux-gnu/libc.so.6'
1262 >>> find_library("bz2") 1262 >>> find_library("bz2")
1263 'libbz2.so.1.0' 1263 '/lib/x86_64-linux-gnu/libbz2.so.1.0'
1264 >>> 1264 >>>
1265 1265
1266 On OS X, :func:`find_library` tries several predefined naming schemes and paths 1266 On OS X, :func:`find_library` tries several predefined naming schemes and paths
1267 to locate the library, and returns a full pathname if successful:: 1267 to locate the library, and returns a full pathname if successful::
1268 1268
1269 >>> from ctypes.util import find_library 1269 >>> from ctypes.util import find_library
1270 >>> find_library("c") 1270 >>> find_library("c")
1271 '/usr/lib/libc.dylib' 1271 '/usr/lib/libc.dylib'
1272 >>> find_library("m") 1272 >>> find_library("m")
1273 '/usr/lib/libm.dylib' 1273 '/usr/lib/libm.dylib'
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 1821
1822 .. function:: find_library(name) 1822 .. function:: find_library(name)
1823 :module: ctypes.util 1823 :module: ctypes.util
1824 1824
1825 Try to find a library and return a pathname. *name* is the library name 1825 Try to find a library and return a pathname. *name* is the library name
1826 without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version 1826 without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version
1827 number (this is the form used for the posix linker option :option:`-l`). If 1827 number (this is the form used for the posix linker option :option:`-l`). If
1828 no library can be found, returns ``None``. 1828 no library can be found, returns ``None``.
1829 1829
1830 The exact functionality is system dependent. 1830 The exact functionality is system dependent.
1831
1832 .. versionchanged:: 3.6
1833 On Linux it returns an absolute path.
1831 1834
1832 1835
1833 .. function:: find_msvcrt() 1836 .. function:: find_msvcrt()
1834 :module: ctypes.util 1837 :module: ctypes.util
1835 1838
1836 Windows only: return the filename of the VC runtime library used by Python, 1839 Windows only: return the filename of the VC runtime library used by Python,
1837 and by the extension modules. If the name of the library cannot be 1840 and by the extension modules. If the name of the library cannot be
1838 determined, ``None`` is returned. 1841 determined, ``None`` is returned.
1839 1842
1840 If you need to free memory, for example, allocated by an extension module 1843 If you need to free memory, for example, allocated by an extension module
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
2447 2450
2448 .. attribute:: _type_ 2451 .. attribute:: _type_
2449 2452
2450 Specifies the type pointed to. 2453 Specifies the type pointed to.
2451 2454
2452 .. attribute:: contents 2455 .. attribute:: contents
2453 2456
2454 Returns the object to which to pointer points. Assigning to this 2457 Returns the object to which to pointer points. Assigning to this
2455 attribute changes the pointer to point to the assigned object. 2458 attribute changes the pointer to point to the assigned object.
2456 2459
OLDNEW
« no previous file with comments | « no previous file | Lib/ctypes/test/test_find.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+