ctypes-commit Mailing List for ctypes (Page 53)
Brought to you by:
theller
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(90) |
Jun
(143) |
Jul
(106) |
Aug
(94) |
Sep
(84) |
Oct
(163) |
Nov
(60) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(128) |
Feb
(79) |
Mar
(227) |
Apr
(192) |
May
(179) |
Jun
(41) |
Jul
(53) |
Aug
(103) |
Sep
(28) |
Oct
(38) |
Nov
(81) |
Dec
(17) |
2006 |
Jan
(184) |
Feb
(111) |
Mar
(188) |
Apr
(67) |
May
(58) |
Jun
(123) |
Jul
(73) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Andreas D. <ad...@us...> - 2005-05-14 10:53:24
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/lib/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1596/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/lib/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:51:58
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/config/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1466/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/config/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:51:28
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.special In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1389/libffi.special Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.special added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:51:28
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.call In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1389/libffi.call Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.call added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:51:27
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1389/lib Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/lib added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:51:27
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1389/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:51:27
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1389/config Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/config added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:49:49
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/m32r/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1237/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/m32r/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:49:22
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/m32r In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1197/m32r Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/m32r added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:48:39
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/frv/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1148/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/frv/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:48:18
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/frv In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1050/frv Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/frv added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:46:32
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/cris/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv786/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/cris/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:46:06
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/cris In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv731/cris Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/cris added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:45:13
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv596/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/src/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:43:52
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/include/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv464/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/include/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:41:42
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32582/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:37:18
|
Update of /cvsroot/ctypes/ctypes/source/gcc/gcc/testsuite/lib/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32148/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/gcc/testsuite/lib/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:36:03
|
Update of /cvsroot/ctypes/ctypes/source/gcc/gcc/testsuite/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31986/lib Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/gcc/testsuite/lib added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:35:19
|
Update of /cvsroot/ctypes/ctypes/source/gcc/gcc/testsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31898/testsuite Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/gcc/testsuite added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-13 13:46:16
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12760 Modified Files: ChangeLog Log Message: Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** ChangeLog 11 May 2005 19:22:33 -0000 1.97 --- ChangeLog 13 May 2005 13:46:04 -0000 1.98 *************** *** 1,2 **** --- 1,18 ---- + 2005-05-13 Andreas Degert <ad...@pa...> + + * ctypes/wrap/codegenerator.py, ctypes/wrap/xml2py.py: moved the + generation of the load command into the class which loads the + libraries; fall back on simple LoadLibrary if name and version + can't be found. + + * ctypes/__init__.py: prependet '_' to private loadLib-Functions; + removed adding of library name as attribute in LoadLibraryVersion + functions. + + * docs/reference.stx: documented loading of shared libraries + + * unittests/test_loading.py: added, tests loading of shared + libraries + 2005-05-11 Thomas Heller <th...@py...> |
From: Andreas D. <ad...@us...> - 2005-05-13 13:45:45
|
Update of /cvsroot/ctypes/ctypes/docs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12629/docs Modified Files: reference.stx Log Message: documented loading of shared libraries Index: reference.stx =================================================================== RCS file: /cvsroot/ctypes/ctypes/docs/reference.stx,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** reference.stx 31 Jul 2003 18:10:47 -0000 1.6 --- reference.stx 13 May 2005 13:45:03 -0000 1.7 *************** *** 10,13 **** --- 10,70 ---- This reference is probably not worth it's name, so incomplete it is. + Loading shared libraries + + ctypes defines some library loader objects which can load shared + libraries. Functions accessed as attributes of shared library + objects will be called with different calling conventions, + depending on the Loader which returned the library object. (FIXME: + add a section about C function objects and how to set the calling + convention) + + 'cdll' -- Loader for shared libraries using the standard C calling + convention of the OS platform (known as cdecl in Windows). + + 'windll' (Windows only) -- For libraries using the stdcall calling + conventions (all Windows system libraries). + + 'oledll' (Windows only) -- Like 'windll', additionaly assumes the + functions return a Windows 'HRESULT' error code. The error code is + used to automatically raise 'WindowsError' Python exceptions when + the function call fails. + + Methods of loader objects: + + 'LoadLibrary(libname)' -- Loads the library given by + libname. On most systems libname ist the filename of the + shared library; when it's not a path name it will be searched + in a system dependent list of locations (on many systems + additional search paths can be specified by an environment + variable). Sometimes extensions like .dll on Windows can be + omitted. + + 'LoadLibraryVersion(name, version)' -- Builds a (system + depend) filename from the library name and version and loads + it. 'name' is the library name without prefix like lib, + suffixes like .so, .dylib or version number (this form is used + for the posix linker option -l). 'version' is the major + version number (for platforms which code this into the + filename). This should be used if a library is available on + different platforms (using the particular naming convention of + each platform). + + 'find(name)' -- Tries to find a library and loads it. 'name' + is the library name (as in LoadLibraryVersion above). After + loading, the filename of the loaded library is printed on + stdout. This function might call other programs like the + compiler to find the library. When you use ctypes to write a + shared library wrapping, consider using LoadLibraryVersion + instead (or LoadLibrary, if the library is platform specific). + + Library loading is also implemented as attribute access of the + loader objects. LoadLibrary is called with the attribute name, + and the returned dll object is cached as attribute value. + Additionaly, key lookup can be used, so cdll.libname is the + same as cdll['libname']. Library names beginning with an + underscore (_) can't be accessed as attributes of a loader + object (use LoadLibrary). + + Common operations on ctypes instances |
From: Andreas D. <ad...@us...> - 2005-05-13 13:45:39
|
Update of /cvsroot/ctypes/ctypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12699/unittests Added Files: test_loading.py Log Message: added, tests loading of shared libraries --- NEW FILE: test_loading.py --- from ctypes import * import unittest import os, StringIO class LoaderTest(unittest.TestCase): unknowndll = "xxrandomnamexx" def test_LoadLibrary(self): if os.name == "nt": name = "msvcrt" elif sys.platform == "darwin": name = "libc.so" else: name = "libc.so.6" cdll.LoadLibrary(name) self.assertRaises(OSError, cdll.LoadLibrary, self.unknowndll) def test_LoadLibraryVersion(self): version = "6" if os.name == "nt": name = "msvcrt" else: name = "c" cdll.LoadLibraryVersion(name, version) if sys.platform == "linux2": # linux uses version, libc 9 should not exist self.assertRaises(OSError, cdll.LoadLibraryVersion, name, "9") self.assertRaises(OSError, cdll.LoadLibraryVersion, self.unknowndll, "") def test_find(self): if os.name == "nt": name = "msvcrt" else: name = "c" #suppress output of cdll.find stdout = sys.stdout sys.stdout = StringIO.StringIO() try: cdll.find(name) finally: sys.stdout = stdout self.assertRaises(OSError, cdll.find, self.unknowndll) if __name__ == "__main__": unittest.main() |
From: Andreas D. <ad...@us...> - 2005-05-13 13:44:44
|
Update of /cvsroot/ctypes/ctypes/ctypes/wrap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12536/ctypes/wrap Modified Files: xml2py.py codegenerator.py Log Message: moved the generation of the load command into the class which loads the libraries; fall back on simple LoadLibrary if name and version can't be found. Index: xml2py.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/wrap/xml2py.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** xml2py.py 29 Apr 2005 09:46:14 -0000 1.5 --- xml2py.py 13 May 2005 13:44:35 -0000 1.6 *************** *** 1,3 **** ! import sys, re, os, tempfile, errno from optparse import OptionParser import typedesc --- 1,3 ---- ! import sys, re, os, tempfile, errno, warnings from optparse import OptionParser import typedesc *************** *** 30,34 **** The shared library is loaded from the supplied path. ! Public instance variables: name: name of the shared library (e.g. for the linker option -l) --- 30,34 ---- The shared library is loaded from the supplied path. ! Public instance variables (to be set by derived classes): name: name of the shared library (e.g. for the linker option -l) *************** *** 46,49 **** --- 46,51 ---- def __init__(self, path): self.lib = CDLL(path) + self.path = path + self.name = self.version = None def lookup(self, symbol): *************** *** 54,57 **** --- 56,66 ---- return None + def make_load_command(self): + if self.name is not None: + return 'cdll.LoadLibraryVersion("%s","%s")' \ + % (self.name, self.version) + else: + return 'cdll.LoadLibrary("%s")' % self.path + def make_legal_identifier(self, name): name = re.sub('[^a-zA-Z0-9_]','_', name) *************** *** 111,115 **** def get_soname(self, path): cmd = "objdump -p -j .dynamic 2>/dev/null " + path ! res = re.search(r'\sSONAME\s+([^\s]+)', os.popen(cmd).read()) if not res: raise ValueError("no soname found for shared lib '%s'" % path) --- 120,128 ---- def get_soname(self, path): cmd = "objdump -p -j .dynamic 2>/dev/null " + path ! fd = os.popen(cmd) ! res = re.search(r'\sSONAME\s+([^\s]+)', fd.read()) ! if fd.close() != 0: ! warnings.warn("error running objdump") ! return None if not res: raise ValueError("no soname found for shared lib '%s'" % path) *************** *** 118,125 **** def get_name_version(self, path): soname = self.get_soname(path) m = re.match(r'lib(?P<name>.+)\.so(\.(?P<version>.*))?', soname) if not m: ! raise ValueError( ! "soname of form lib<name>.so.<version> expected, got '%s'" % soname) return m.group('name'), m.group('version') --- 131,142 ---- def get_name_version(self, path): soname = self.get_soname(path) + if soname is None: + return None, None m = re.match(r'lib(?P<name>.+)\.so(\.(?P<version>.*))?', soname) if not m: ! warnings.warn( ! "soname of form lib<name>.so.<version> expected, got '%s'" ! % soname) ! return None, None return m.group('name'), m.group('version') *************** *** 207,211 **** def get_soname(self, path): cmd = "otool -D 2>/dev/null " + path ! res = re.match(r'.*:\n(.*)', os.popen(cmd).read()) if not res: raise ValueError("no soname found for shared lib '%s'" % path) --- 224,231 ---- def get_soname(self, path): cmd = "otool -D 2>/dev/null " + path ! fd = os.popen(cmd) ! res = re.match(r'.*:\n(.*)', fd.read()) ! if fd.close() != 0: ! raise EnvironmentError("error running otool") if not res: raise ValueError("no soname found for shared lib '%s'" % path) *************** *** 216,221 **** m = re.match(r'.*/lib(?P<name>.+)\.dylib', soname) if not m: ! raise ValueError( ! "soname of form .../lib<name>.dylib expected, got '%s'" % soname) return m.group('name'), '' --- 236,243 ---- m = re.match(r'.*/lib(?P<name>.+)\.dylib', soname) if not m: ! warnings.warn( ! "soname of form .../lib<name>.dylib expected, got '%s'" \ ! % soname) ! return None, None return m.group('name'), '' *************** *** 280,286 **** def get_soname(self, path): ! # Should it strip the extension, if '.dll'? ! # Should it strip the directory part? Probably... ! return os.path.basename(path) class LibraryListNT(LibraryListBase): --- 302,311 ---- def get_soname(self, path): ! path = os.path.basename(path) ! name, ext = os.path.splitext(path) ! if ext.lower() == '.dll': ! return name ! else: ! return path class LibraryListNT(LibraryListBase): Index: codegenerator.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/wrap/codegenerator.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** codegenerator.py 29 Apr 2005 09:45:48 -0000 1.12 --- codegenerator.py 13 May 2005 13:44:35 -0000 1.13 *************** *** 3,6 **** --- 3,11 ---- # $Log$ + # Revision 1.13 2005/05/13 13:44:35 adegert + # moved the generation of the load command into the class which loads + # the libraries; fall back on simple LoadLibrary if name and version + # can't be found. + # # Revision 1.12 2005/04/29 09:45:48 adegert # removed unused import types *************** *** 594,599 **** if dll not in self.loaded_dlls: print >> self.stream, \ ! '\n%s = cdll.LoadLibraryVersion("%s","%s")\n' \ ! % (dll.key, dll.name, dll.version) self.loaded_dlls.add(dll) self.generate(func.returns) --- 599,603 ---- if dll not in self.loaded_dlls: print >> self.stream, \ ! '\n%s = %s\n' % (dll.key, dll.make_load_command()) self.loaded_dlls.add(dll) self.generate(func.returns) |
From: Andreas D. <ad...@us...> - 2005-05-13 13:44:13
|
Update of /cvsroot/ctypes/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12456/ctypes Modified Files: __init__.py Log Message: prependet '_' to private loadLib-Functions; removed adding of library name as attribute in LoadLibraryVersion functions. Index: __init__.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/ctypes/__init__.py,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** __init__.py 29 Apr 2005 09:44:25 -0000 1.74 --- __init__.py 13 May 2005 13:44:05 -0000 1.75 *************** *** 401,405 **** if _os.name == "posix": ! def findLib_gcc(name): expr = '[^\(\)\s]*lib%s\.[^\(\)\s]*' % name cmd = 'if type gcc &>/dev/null; then CC=gcc; else CC=cc; fi;' \ --- 401,405 ---- if _os.name == "posix": ! def _findLib_gcc(name): expr = '[^\(\)\s]*lib%s\.[^\(\)\s]*' % name cmd = 'if type gcc &>/dev/null; then CC=gcc; else CC=cc; fi;' \ *************** *** 421,425 **** return res.group(0) ! def findLib_ld(name): expr = '/[^\(\)\s]*lib%s\.[^\(\)\s]*' % name res = re.search(expr, _os.popen('/sbin/ldconfig -p 2>/dev/null').read()) --- 421,425 ---- return res.group(0) ! def _findLib_ld(name): expr = '/[^\(\)\s]*lib%s\.[^\(\)\s]*' % name res = re.search(expr, _os.popen('/sbin/ldconfig -p 2>/dev/null').read()) *************** *** 428,432 **** return res.group(0) ! def get_soname(f): cmd = "objdump -p -j .dynamic 2>/dev/null " + f res = re.search(r'\sSONAME\s+([^\s]+)', _os.popen(cmd).read()) --- 428,432 ---- return res.group(0) ! def _get_soname(f): cmd = "objdump -p -j .dynamic 2>/dev/null " + f res = re.search(r'\sSONAME\s+([^\s]+)', _os.popen(cmd).read()) *************** *** 435,445 **** return res.group(1) ! def findLib(name): ! lib = findLib_ld(name) if not lib: ! lib = findLib_gcc(name) if not lib: return name ! return get_soname(lib) --- 435,445 ---- return res.group(1) ! def _findLib(name): ! lib = _findLib_ld(name) if not lib: ! lib = _findLib_gcc(name) if not lib: return name ! return _get_soname(lib) *************** *** 470,474 **** if _os.name == "posix" and sys.platform == "darwin": def _findLibrary(self, name): ! return findLib(name) def LoadLibraryVersion(self, name, version=''): --- 470,474 ---- if _os.name == "posix" and sys.platform == "darwin": def _findLibrary(self, name): ! return _findLib(name) def LoadLibraryVersion(self, name, version=''): *************** *** 478,487 **** except OSError: dll = self._dlltype("/usr/lib/"+path) - setattr(self, name, dll) return dll elif _os.name == "posix": def _findLibrary(self, name): ! return findLib(name) def LoadLibraryVersion(self, name, version=''): --- 478,486 ---- except OSError: dll = self._dlltype("/usr/lib/"+path) return dll elif _os.name == "posix": def _findLibrary(self, name): ! return _findLib(name) def LoadLibraryVersion(self, name, version=''): *************** *** 489,493 **** version = '.' + version dll = self._dlltype("lib%s.so%s" % (name, version)) - setattr(self, name, dll) return dll --- 488,491 ---- *************** *** 498,502 **** def LoadLibraryVersion(self, name, version=''): dll = self._dlltype(self._findLibrary(name)) - setattr(self, name, dll) return dll --- 496,499 ---- |
From: Thomas H. <th...@us...> - 2005-05-11 19:22:52
|
Update of /cvsroot/ctypes/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32542 Modified Files: ChangeLog Log Message: *** empty log message *** Index: ChangeLog =================================================================== RCS file: /cvsroot/ctypes/ctypes/ChangeLog,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** ChangeLog 29 Apr 2005 09:46:35 -0000 1.96 --- ChangeLog 11 May 2005 19:22:33 -0000 1.97 *************** *** 1,2 **** --- 1,9 ---- + 2005-05-11 Thomas Heller <th...@py...> + + * source\_ctypes.c (CData_FromBaseObj): Don't call __init__, only + __new__, when a ctypes instance is retrieved from a base object. + This avoids confusion when structure fields containing structures + (for example) are accessed. + 2005-04-29 Andreas Degert <ad...@pa...> |