pydev-cvs Mailing List for PyDev for Eclipse (Page 23)
Brought to you by:
fabioz
You can subscribe to this list here.
2004 |
Jan
|
Feb
(4) |
Mar
(48) |
Apr
(56) |
May
(64) |
Jun
(27) |
Jul
(66) |
Aug
(81) |
Sep
(148) |
Oct
(194) |
Nov
(78) |
Dec
(46) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(125) |
Feb
(126) |
Mar
(163) |
Apr
(133) |
May
(115) |
Jun
(307) |
Jul
(387) |
Aug
(417) |
Sep
(283) |
Oct
(148) |
Nov
(45) |
Dec
(53) |
2006 |
Jan
(240) |
Feb
(200) |
Mar
(267) |
Apr
(231) |
May
(245) |
Jun
(361) |
Jul
(142) |
Aug
(12) |
Sep
(210) |
Oct
(99) |
Nov
(7) |
Dec
(30) |
2007 |
Jan
(161) |
Feb
(511) |
Mar
(265) |
Apr
(74) |
May
(147) |
Jun
(151) |
Jul
(94) |
Aug
(68) |
Sep
(98) |
Oct
(144) |
Nov
(26) |
Dec
(36) |
2008 |
Jan
(98) |
Feb
(107) |
Mar
(199) |
Apr
(113) |
May
(119) |
Jun
(112) |
Jul
(92) |
Aug
(71) |
Sep
(101) |
Oct
(16) |
Nov
|
Dec
|
From: Fabio Z. <fa...@us...> - 2008-04-12 13:01:23
|
Update of /cvsroot/pydev/org.python.pydev/PySrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30061/PySrc Modified Files: interpreterInfo.py Log Message: Added tags to ignore errors Index: interpreterInfo.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/interpreterInfo.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** interpreterInfo.py 12 Apr 2008 12:08:00 -0000 1.23 --- interpreterInfo.py 12 Apr 2008 13:01:26 -0000 1.24 *************** *** 81,85 **** path_used = sys.path try: ! path_used = sorted(path_used) except: pass #just ignore it... --- 81,85 ---- path_used = sys.path try: ! path_used = sorted(path_used) #@UndefinedVariable -- not on all versions except: pass #just ignore it... |
From: Fabio Z. <fa...@us...> - 2008-04-12 13:01:12
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes/macholib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30007/PySrc/ThirdParty/wrapped_for_pydev/ctypes/macholib Modified Files: dyld.py Log Message: Added tags to ignore errors Index: dyld.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes/macholib/dyld.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dyld.py 12 Apr 2008 12:08:00 -0000 1.1 --- dyld.py 12 Apr 2008 13:01:15 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + #@PydevCodeAnalysisIgnore """ dyld emulation |
From: Fabio Z. <fa...@us...> - 2008-04-12 13:01:12
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30007/PySrc/ThirdParty/wrapped_for_pydev/ctypes Modified Files: _endian.py util.py __init__.py wintypes.py Log Message: Added tags to ignore errors Index: wintypes.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes/wintypes.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** wintypes.py 12 Apr 2008 12:08:00 -0000 1.1 --- wintypes.py 12 Apr 2008 13:01:15 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + #@PydevCodeAnalysisIgnore # XXX This module needs cleanup. Index: util.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes/util.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** util.py 12 Apr 2008 12:08:00 -0000 1.1 --- util.py 12 Apr 2008 13:01:15 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + #@PydevCodeAnalysisIgnore import sys, os import ctypes Index: __init__.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** __init__.py 12 Apr 2008 12:08:00 -0000 1.1 --- __init__.py 12 Apr 2008 13:01:15 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + #@PydevCodeAnalysisIgnore """create and manipulate C data types in Python""" Index: _endian.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes/_endian.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _endian.py 12 Apr 2008 12:08:00 -0000 1.1 --- _endian.py 12 Apr 2008 13:01:15 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + #@PydevCodeAnalysisIgnore import sys from ctypes import * |
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8550/PySrc/ThirdParty/wrapped_for_pydev/ctypes Added Files: _endian.py util.py __init__.py _ctypes.dll .cvsignore wintypes.py ctypes-README.txt Log Message: help() works (ctype implementation no longer in default pythonpath -- under ThirdParty) --- NEW FILE: .cvsignore --- _endian.pyc *.pyc --- NEW FILE: ctypes-README.txt --- (Note: this is a compiled distribution of ctypes, compiled for cygwin to allow using the cygwin conversions directly from interpreterInfo. The tests have been removed to reduce the added size. It is only used by PyDev on cygwin). Overview ctypes is a ffi (Foreign Function Interface) package for Python. It allows to call functions exposed from dlls/shared libraries and has extensive facilities to create, access and manipulate simpole and complicated C data types transparently from Python - in other words: wrap libraries in pure Python. ctypes runs on Windows, MacOS X, Linux, Solaris, FreeBSD. It may also run on other systems, provided that libffi supports this platform. On Windows, ctypes contains (the beginning of) a COM framework mainly targetted to use and implement custom COM interfaces. News ctypes now uses the same code base and libffi on all platforms. For easier installation, the libffi sources are now included in the source distribution - no need to find, build, and install a compatible libffi version. Requirements ctypes 0.9 requires Python 2.3 or higher, since it makes intensive use of the new type system. ctypes uses libffi, which is copyright Red Hat, Inc. Complete license see below. Installation Windows On Windows, it is the easiest to download the executable installer for your Python version and execute this. Installation from source Separate source distributions are available for windows and non-windows systems. Please use the .zip file for Windows (it contains the ctypes.com framework), and use the .tar.gz file for non-Windows systems (it contains the complete cross-platform libffi sources). To install ctypes from source, unpack the distribution, enter the ctypes-0.9.x source directory, and enter python setup.py build This will build the Python extension modules. A C compiler is required. On OS X, the segment attribute live_support must be defined. If your compiler doesn't know about it, upgrade or set the environment variable CCASFLAGS="-Dno_live_support". To run the supplied tests, enter python setup.py test To install ctypes, enter python setup.py install --help to see the avaibable options, and finally python setup.py install [options] For Windows CE, a project file is provided in wince\_ctypes.vcw. MS embedded Visual C 4.0 is required to build the extension modules. Additional notes Current version: 0.9.9.3 Homepage: http://starship.python.net/crew/theller/ctypes.html ctypes license Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Thomas Heller Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. libffi license libffi - Copyright (c) 1996-2003 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --- NEW FILE: _endian.py --- import sys from ctypes import * _array_type = type(c_int * 3) def _other_endian(typ): """Return the type with the 'other' byte order. Simple types like c_int and so on already have __ctype_be__ and __ctype_le__ attributes which contain the types, for more complicated types only arrays are supported. """ try: return getattr(typ, _OTHER_ENDIAN) except AttributeError: if type(typ) == _array_type: return _other_endian(typ._type_) * typ._length_ raise TypeError("This type does not support other endian: %s" % typ) class _swapped_meta(type(Structure)): def __setattr__(self, attrname, value): if attrname == "_fields_": fields = [] for desc in value: name = desc[0] typ = desc[1] rest = desc[2:] fields.append((name, _other_endian(typ)) + rest) value = fields super(_swapped_meta, self).__setattr__(attrname, value) ################################################################ # Note: The Structure metaclass checks for the *presence* (not the # value!) of a _swapped_bytes_ attribute to determine the bit order in # structures containing bit fields. if sys.byteorder == "little": _OTHER_ENDIAN = "__ctype_be__" LittleEndianStructure = Structure class BigEndianStructure(Structure): """Structure with big endian byte order""" __metaclass__ = _swapped_meta _swappedbytes_ = None elif sys.byteorder == "big": _OTHER_ENDIAN = "__ctype_le__" BigEndianStructure = Structure class LittleEndianStructure(Structure): """Structure with little endian byte order""" __metaclass__ = _swapped_meta _swappedbytes_ = None else: raise RuntimeError("Invalid byteorder") --- NEW FILE: util.py --- import sys, os import ctypes # find_library(name) returns the pathname of a library, or None. if os.name == "nt": def find_library(name): # See MSDN for the REAL search order. for directory in os.environ['PATH'].split(os.pathsep): fname = os.path.join(directory, name) if os.path.exists(fname): return fname if fname.lower().endswith(".dll"): continue fname = fname + ".dll" if os.path.exists(fname): return fname return None if os.name == "ce": # search path according to MSDN: # - absolute path specified by filename # - The .exe launch directory # - the Windows directory # - ROM dll files (where are they?) # - OEM specified search path: HKLM\Loader\SystemPath def find_library(name): return name if os.name == "posix" and sys.platform == "darwin": from ctypes.macholib.dyld import dyld_find as _dyld_find def find_library(name): possible = ['lib%s.dylib' % name, '%s.dylib' % name, '%s.framework/%s' % (name, name)] for name in possible: try: return _dyld_find(name) except ValueError: continue return None elif os.name == "posix": # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump import re, tempfile def _findLib_gcc(name): expr = '[^\(\)\s]*lib%s\.[^\(\)\s]*' % name cmd = 'if type gcc &>/dev/null; then CC=gcc; else CC=cc; fi;' \ '$CC -Wl,-t -o /dev/null 2>&1 -l' + name try: fdout, outfile = tempfile.mkstemp() fd = os.popen(cmd) trace = fd.read() err = fd.close() finally: try: os.unlink(outfile) except OSError, e: import errno if e.errno != errno.ENOENT: raise res = re.search(expr, trace) if not res: return None 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()) if not res: # Hm, this works only for libs needed by the python executable. cmd = 'ldd %s 2>/dev/null' % sys.executable res = re.search(expr, os.popen(cmd).read()) if not res: return None 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()) if not res: return None return res.group(1) def find_library(name): lib = _findLib_ld(name) or _findLib_gcc(name) if not lib: return None return _get_soname(lib) ################################################################ # test code def test(): from ctypes import cdll if os.name == "nt": print cdll.msvcrt print cdll.load("msvcrt") print find_library("msvcrt") if os.name == "posix": # find and load_version print find_library("m") print find_library("c") print find_library("bz2") # getattr ## print cdll.m ## print cdll.bz2 # load if sys.platform == "darwin": print cdll.LoadLibrary("libm.dylib") print cdll.LoadLibrary("libcrypto.dylib") print cdll.LoadLibrary("libSystem.dylib") print cdll.LoadLibrary("System.framework/System") else: print cdll.LoadLibrary("libm.so") print cdll.LoadLibrary("libcrypt.so") print find_library("crypt") if __name__ == "__main__": test() --- NEW FILE: __init__.py --- """create and manipulate C data types in Python""" import os as _os, sys as _sys from itertools import chain as _chain # special developer support to use ctypes from the CVS sandbox, # without installing it # XXX Remove this for the python core version _magicfile = _os.path.join(_os.path.dirname(__file__), ".CTYPES_DEVEL") if _os.path.isfile(_magicfile): execfile(_magicfile) del _magicfile __version__ = "0.9.9.6" from _ctypes import Union, Structure, Array from _ctypes import _Pointer from _ctypes import CFuncPtr as _CFuncPtr from _ctypes import __version__ as _ctypes_version from _ctypes import RTLD_LOCAL, RTLD_GLOBAL from _ctypes import ArgumentError from struct import calcsize as _calcsize if __version__ != _ctypes_version: raise Exception, ("Version number mismatch", __version__, _ctypes_version) if _os.name in ("nt", "ce"): from _ctypes import FormatError from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL, \ FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI """ WINOLEAPI -> HRESULT WINOLEAPI_(type) STDMETHODCALLTYPE STDMETHOD(name) STDMETHOD_(type, name) STDAPICALLTYPE """ def create_string_buffer(init, size=None): """create_string_buffer(aString) -> character array create_string_buffer(anInteger) -> character array create_string_buffer(aString, anInteger) -> character array """ if isinstance(init, (str, unicode)): if size is None: size = len(init)+1 buftype = c_char * size buf = buftype() buf.value = init return buf elif isinstance(init, (int, long)): buftype = c_char * init buf = buftype() return buf raise TypeError, init def c_buffer(init, size=None): ## "deprecated, use create_string_buffer instead" ## import warnings ## warnings.warn("c_buffer is deprecated, use create_string_buffer instead", ## DeprecationWarning, stacklevel=2) return create_string_buffer(init, size) _c_functype_cache = {} def CFUNCTYPE(restype, *argtypes): """CFUNCTYPE(restype, *argtypes) -> function prototype. restype: the result type argtypes: a sequence specifying the argument types The function prototype can be called in three ways to create a callable object: prototype(integer address) -> foreign function prototype(callable) -> create and return a C callable function from callable prototype(integer index, method name[, paramflags]) -> foreign function calling a COM method prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal prototype((function name, dll object)[, paramflags]) -> foreign function exported by name """ try: return _c_functype_cache[(restype, argtypes)] except KeyError: class CFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype _flags_ = _FUNCFLAG_CDECL _c_functype_cache[(restype, argtypes)] = CFunctionType return CFunctionType if _os.name in ("nt", "ce"): from _ctypes import LoadLibrary as _dlopen from _ctypes import FUNCFLAG_STDCALL as _FUNCFLAG_STDCALL if _os.name == "ce": # 'ce' doesn't have the stdcall calling convention _FUNCFLAG_STDCALL = _FUNCFLAG_CDECL _win_functype_cache = {} def WINFUNCTYPE(restype, *argtypes): # docstring set later (very similar to CFUNCTYPE.__doc__) try: return _win_functype_cache[(restype, argtypes)] except KeyError: class WinFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype _flags_ = _FUNCFLAG_STDCALL _win_functype_cache[(restype, argtypes)] = WinFunctionType return WinFunctionType if WINFUNCTYPE.__doc__: WINFUNCTYPE.__doc__ = CFUNCTYPE.__doc__.replace("CFUNCTYPE", "WINFUNCTYPE") elif _os.name == "posix": from _ctypes import dlopen as _dlopen #@UnresolvedImport from _ctypes import sizeof, byref, addressof, alignment from _ctypes import _SimpleCData class py_object(_SimpleCData): _type_ = "O" class c_short(_SimpleCData): _type_ = "h" class c_ushort(_SimpleCData): _type_ = "H" class c_long(_SimpleCData): _type_ = "l" class c_ulong(_SimpleCData): _type_ = "L" if _calcsize("i") == _calcsize("l"): # if int and long have the same size, make c_int an alias for c_long c_int = c_long c_uint = c_ulong else: class c_int(_SimpleCData): _type_ = "i" class c_uint(_SimpleCData): _type_ = "I" class c_float(_SimpleCData): _type_ = "f" class c_double(_SimpleCData): _type_ = "d" if _calcsize("l") == _calcsize("q"): # if long and long long have the same size, make c_longlong an alias for c_long c_longlong = c_long c_ulonglong = c_ulong else: class c_longlong(_SimpleCData): _type_ = "q" class c_ulonglong(_SimpleCData): _type_ = "Q" ## def from_param(cls, val): ## return ('d', float(val), val) ## from_param = classmethod(from_param) class c_ubyte(_SimpleCData): _type_ = "B" c_ubyte.__ctype_le__ = c_ubyte.__ctype_be__ = c_ubyte # backward compatibility: ##c_uchar = c_ubyte class c_byte(_SimpleCData): _type_ = "b" c_byte.__ctype_le__ = c_byte.__ctype_be__ = c_byte class c_char(_SimpleCData): _type_ = "c" c_char.__ctype_le__ = c_char.__ctype_be__ = c_char class c_char_p(_SimpleCData): _type_ = "z" class c_void_p(_SimpleCData): _type_ = "P" c_voidp = c_void_p # backwards compatibility (to a bug) # This cache maps types to pointers to them. _pointer_type_cache = {} def POINTER(cls): try: return _pointer_type_cache[cls] except KeyError: pass if type(cls) is str: klass = type(_Pointer)("LP_%s" % cls, (_Pointer,), {}) _pointer_type_cache[id(klass)] = klass return klass else: name = "LP_%s" % cls.__name__ klass = type(_Pointer)(name, (_Pointer,), {'_type_': cls}) _pointer_type_cache[cls] = klass return klass try: from _ctypes import set_conversion_mode except ImportError: pass else: if _os.name in ("nt", "ce"): set_conversion_mode("mbcs", "ignore") else: set_conversion_mode("ascii", "strict") class c_wchar_p(_SimpleCData): _type_ = "Z" class c_wchar(_SimpleCData): _type_ = "u" POINTER(c_wchar).from_param = c_wchar_p.from_param #_SimpleCData.c_wchar_p_from_param def create_unicode_buffer(init, size=None): """create_unicode_buffer(aString) -> character array create_unicode_buffer(anInteger) -> character array create_unicode_buffer(aString, anInteger) -> character array """ if isinstance(init, (str, unicode)): if size is None: size = len(init)+1 buftype = c_wchar * size buf = buftype() buf.value = init return buf elif isinstance(init, (int, long)): buftype = c_wchar * init buf = buftype() return buf raise TypeError, init POINTER(c_char).from_param = c_char_p.from_param #_SimpleCData.c_char_p_from_param # XXX Deprecated def SetPointerType(pointer, cls): if _pointer_type_cache.get(cls, None) is not None: raise RuntimeError, \ "This type already exists in the cache" if not _pointer_type_cache.has_key(id(pointer)): raise RuntimeError, \ "What's this???" pointer.set_type(cls) _pointer_type_cache[cls] = pointer del _pointer_type_cache[id(pointer)] def pointer(inst): return POINTER(type(inst))(inst) # XXX Deprecated def ARRAY(typ, len): return typ * len ################################################################ class CDLL(object): """An instance of this class represents a loaded dll/shared library, exporting functions using the standard C calling convention (named 'cdecl' on Windows). The exported functions can be accessed as attributes, or by indexing with the function name. Examples: <obj>.qsort -> callable object <obj>['qsort'] -> callable object Calling the functions releases the Python GIL during the call and reaquires it afterwards. """ class _FuncPtr(_CFuncPtr): _flags_ = _FUNCFLAG_CDECL _restype_ = c_int # default, can be overridden in instances def __init__(self, name, mode=RTLD_LOCAL, handle=None): self._name = name if handle is None: self._handle = _dlopen(self._name, mode) else: self._handle = handle def __repr__(self): return "<%s '%s', handle %x at %x>" % \ (self.__class__.__name__, self._name, (self._handle & (_sys.maxint*2 + 1)), id(self)) def __getattr__(self, name): if name.startswith('__') and name.endswith('__'): raise AttributeError, name return self.__getitem__(name) def __getitem__(self, name_or_ordinal): func = self._FuncPtr((name_or_ordinal, self)) if not isinstance(name_or_ordinal, (int, long)): func.__name__ = name_or_ordinal setattr(self, name_or_ordinal, func) return func class PyDLL(CDLL): """This class represents the Python library itself. It allows to access Python API functions. The GIL is not released, and Python exceptions are handled correctly. """ class _FuncPtr(_CFuncPtr): _flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI _restype_ = c_int # default, can be overridden in instances if _os.name in ("nt", "ce"): class WinDLL(CDLL): """This class represents a dll exporting functions using the Windows stdcall calling convention. """ class _FuncPtr(_CFuncPtr): _flags_ = _FUNCFLAG_STDCALL _restype_ = c_int # default, can be overridden in instances # XXX Hm, what about HRESULT as normal parameter? # Mustn't it derive from c_long then? from _ctypes import _check_HRESULT, _SimpleCData class HRESULT(_SimpleCData): _type_ = "l" # _check_retval_ is called with the function's result when it # is used as restype. It checks for the FAILED bit, and # raises a WindowsError if it is set. # # The _check_retval_ method is implemented in C, so that the # method definition itself is not included in the traceback # when it raises an error - that is what we want (and Python # doesn't have a way to raise an exception in the caller's # frame). _check_retval_ = _check_HRESULT class OleDLL(CDLL): """This class represents a dll exporting functions using the Windows stdcall calling convention, and returning HRESULT. HRESULT error values are automatically raised as WindowsError exceptions. """ class _FuncPtr(_CFuncPtr): _flags_ = _FUNCFLAG_STDCALL _restype_ = HRESULT class LibraryLoader(object): def __init__(self, dlltype): self._dlltype = dlltype def __getattr__(self, name): if name[0] == '_': raise AttributeError(name) dll = self._dlltype(name) setattr(self, name, dll) return dll def __getitem__(self, name): return getattr(self, name) def LoadLibrary(self, name): return self._dlltype(name) cdll = LibraryLoader(CDLL) pydll = LibraryLoader(PyDLL) if _os.name in ("nt", "ce"): pythonapi = PyDLL("python dll", None, _sys.dllhandle) elif _sys.platform == "cygwin": pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2]) else: pythonapi = PyDLL(None) if _os.name in ("nt", "ce"): windll = LibraryLoader(WinDLL) oledll = LibraryLoader(OleDLL) if _os.name == "nt": GetLastError = windll.kernel32.GetLastError else: GetLastError = windll.coredll.GetLastError def WinError(code=None, descr=None): if code is None: code = GetLastError() if descr is None: descr = FormatError(code).strip() return WindowsError(code, descr) _pointer_type_cache[None] = c_void_p if sizeof(c_uint) == sizeof(c_void_p): c_size_t = c_uint elif sizeof(c_ulong) == sizeof(c_void_p): c_size_t = c_ulong # functions from _ctypes import _memmove_addr, _memset_addr, _string_at_addr, _cast_addr ## void *memmove(void *, const void *, size_t); memmove = CFUNCTYPE(c_void_p, c_void_p, c_void_p, c_size_t)(_memmove_addr) ## void *memset(void *, int, size_t) memset = CFUNCTYPE(c_void_p, c_void_p, c_int, c_size_t)(_memset_addr) def PYFUNCTYPE(restype, *argtypes): class CFunctionType(_CFuncPtr): _argtypes_ = argtypes _restype_ = restype _flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI return CFunctionType _cast = PYFUNCTYPE(py_object, c_void_p, py_object)(_cast_addr) def cast(obj, typ): result = _cast(obj, typ) result.__keepref = obj return result _string_at = CFUNCTYPE(py_object, c_void_p, c_int)(_string_at_addr) def string_at(ptr, size=0): """string_at(addr[, size]) -> string Return the string at addr.""" return _string_at(ptr, size) try: from _ctypes import _wstring_at_addr except ImportError: pass else: _wstring_at = CFUNCTYPE(py_object, c_void_p, c_int)(_wstring_at_addr) def wstring_at(ptr, size=0): """wstring_at(addr[, size]) -> string Return the string at addr.""" return _wstring_at(ptr, size) if _os.name == "nt": # COM stuff def DllGetClassObject(rclsid, riid, ppv): # First ask ctypes.com.server than comtypes.server for the # class object. # trick py2exe by doing dynamic imports result = -2147221231 # CLASS_E_CLASSNOTAVAILABLE try: ctcom = __import__("ctypes.com.server", globals(), locals(), ['*']) except ImportError: pass else: result = ctcom.DllGetClassObject(rclsid, riid, ppv) if result == -2147221231: # CLASS_E_CLASSNOTAVAILABLE try: ccom = __import__("comtypes.server", globals(), locals(), ['*']) except ImportError: pass else: result = ccom.DllGetClassObject(rclsid, riid, ppv) return result def DllCanUnloadNow(): # First ask ctypes.com.server than comtypes.server if we can unload or not. # trick py2exe by doing dynamic imports result = 0 # S_OK try: ctcom = __import__("ctypes.com.server", globals(), locals(), ['*']) except ImportError: pass else: result = ctcom.DllCanUnloadNow() if result != 0: # != S_OK return result try: ccom = __import__("comtypes.server", globals(), locals(), ['*']) except ImportError: return result try: return ccom.DllCanUnloadNow() except AttributeError: pass return result from ctypes._endian import BigEndianStructure, LittleEndianStructure # Fill in specifically-sized types c_int8 = c_byte c_uint8 = c_ubyte for kind in [c_short, c_int, c_long, c_longlong]: if sizeof(kind) == 2: c_int16 = kind elif sizeof(kind) == 4: c_int32 = kind elif sizeof(kind) == 8: c_int64 = kind for kind in [c_ushort, c_uint, c_ulong, c_ulonglong]: if sizeof(kind) == 2: c_uint16 = kind elif sizeof(kind) == 4: c_uint32 = kind elif sizeof(kind) == 8: c_uint64 = kind del(kind) --- NEW FILE: _ctypes.dll --- (This appears to be a binary file; contents omitted.) --- NEW FILE: wintypes.py --- # XXX This module needs cleanup. from ctypes import * DWORD = c_ulong WORD = c_ushort BYTE = c_byte ULONG = c_ulong LONG = c_long LARGE_INTEGER = c_longlong ULARGE_INTEGER = c_ulonglong HANDLE = c_ulong # in the header files: void * HWND = HANDLE HDC = HANDLE HMODULE = HANDLE HINSTANCE = HANDLE HRGN = HANDLE HTASK = HANDLE HKEY = HANDLE HPEN = HANDLE HGDIOBJ = HANDLE HMENU = HANDLE LCID = DWORD WPARAM = c_uint LPARAM = c_long BOOL = c_long VARIANT_BOOL = c_short LPCOLESTR = LPOLESTR = OLESTR = c_wchar_p LPCWSTR = LPWSTR = c_wchar_p LPCSTR = LPSTR = c_char_p class RECT(Structure): _fields_ = [("left", c_long), ("top", c_long), ("right", c_long), ("bottom", c_long)] RECTL = RECT class POINT(Structure): _fields_ = [("x", c_long), ("y", c_long)] POINTL = POINT class SIZE(Structure): _fields_ = [("cx", c_long), ("cy", c_long)] SIZEL = SIZE def RGB(red, green, blue): return red + (green << 8) + (blue << 16) class FILETIME(Structure): _fields_ = [("dwLowDateTime", DWORD), ("dwHighDateTime", DWORD)] class MSG(Structure): _fields_ = [("hWnd", HWND), ("message", c_uint), ("wParam", WPARAM), ("lParam", LPARAM), ("time", DWORD), ("pt", POINT)] MAX_PATH = 260 class WIN32_FIND_DATAA(Structure): _fields_ = [("dwFileAttributes", DWORD), ("ftCreationTime", FILETIME), ("ftLastAccessTime", FILETIME), ("ftLastWriteTime", FILETIME), ("nFileSizeHigh", DWORD), ("nFileSizeLow", DWORD), ("dwReserved0", DWORD), ("dwReserved1", DWORD), ("cFileName", c_char * MAX_PATH), ("cAlternameFileName", c_char * 14)] class WIN32_FIND_DATAW(Structure): _fields_ = [("dwFileAttributes", DWORD), ("ftCreationTime", FILETIME), ("ftLastAccessTime", FILETIME), ("ftLastWriteTime", FILETIME), ("nFileSizeHigh", DWORD), ("nFileSizeLow", DWORD), ("dwReserved0", DWORD), ("dwReserved1", DWORD), ("cFileName", c_wchar * MAX_PATH), ("cAlternameFileName", c_wchar * 14)] |
From: Fabio Z. <fa...@us...> - 2008-04-12 12:07:56
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes/macholib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8550/PySrc/ThirdParty/wrapped_for_pydev/ctypes/macholib Added Files: dyld.py framework.py dylib.py .cvsignore __init__.py Log Message: help() works (ctype implementation no longer in default pythonpath -- under ThirdParty) --- NEW FILE: .cvsignore --- *.pyc --- NEW FILE: dylib.py --- """ Generic dylib path manipulation """ import re __all__ = ['dylib_info'] DYLIB_RE = re.compile(r"""(?x) (?P<location>^.*)(?:^|/) (?P<name> (?P<shortname>\w+?) (?:\.(?P<version>[^._]+))? (?:_(?P<suffix>[^._]+))? \.dylib$ ) """) def dylib_info(filename): """ A dylib name can take one of the following four forms: Location/Name.SomeVersion_Suffix.dylib Location/Name.SomeVersion.dylib Location/Name_Suffix.dylib Location/Name.dylib returns None if not found or a mapping equivalent to: dict( location='Location', name='Name.SomeVersion_Suffix.dylib', shortname='Name', version='SomeVersion', suffix='Suffix', ) Note that SomeVersion and Suffix are optional and may be None if not present. """ is_dylib = DYLIB_RE.match(filename) if not is_dylib: return None return is_dylib.groupdict() def test_dylib_info(): def d(location=None, name=None, shortname=None, version=None, suffix=None): return dict( location=location, name=name, shortname=shortname, version=version, suffix=suffix ) assert dylib_info('completely/invalid') is None assert dylib_info('completely/invalide_debug') is None assert dylib_info('P/Foo.dylib') == d('P', 'Foo.dylib', 'Foo') assert dylib_info('P/Foo_debug.dylib') == d('P', 'Foo_debug.dylib', 'Foo', suffix='debug') assert dylib_info('P/Foo.A.dylib') == d('P', 'Foo.A.dylib', 'Foo', 'A') assert dylib_info('P/Foo_debug.A.dylib') == d('P', 'Foo_debug.A.dylib', 'Foo_debug', 'A') assert dylib_info('P/Foo.A_debug.dylib') == d('P', 'Foo.A_debug.dylib', 'Foo', 'A', 'debug') if __name__ == '__main__': test_dylib_info() --- NEW FILE: framework.py --- """ Generic framework path manipulation """ import re __all__ = ['framework_info'] STRICT_FRAMEWORK_RE = re.compile(r"""(?x) (?P<location>^.*)(?:^|/) (?P<name> (?P<shortname>\w+).framework/ (?:Versions/(?P<version>[^/]+)/)? (?P=shortname) (?:_(?P<suffix>[^_]+))? )$ """) def framework_info(filename): """ A framework name can take one of the following four forms: Location/Name.framework/Versions/SomeVersion/Name_Suffix Location/Name.framework/Versions/SomeVersion/Name Location/Name.framework/Name_Suffix Location/Name.framework/Name returns None if not found, or a mapping equivalent to: dict( location='Location', name='Name.framework/Versions/SomeVersion/Name_Suffix', shortname='Name', version='SomeVersion', suffix='Suffix', ) Note that SomeVersion and Suffix are optional and may be None if not present """ is_framework = STRICT_FRAMEWORK_RE.match(filename) if not is_framework: return None return is_framework.groupdict() def test_framework_info(): def d(location=None, name=None, shortname=None, version=None, suffix=None): return dict( location=location, name=name, shortname=shortname, version=version, suffix=suffix ) assert framework_info('completely/invalid') is None assert framework_info('completely/invalid/_debug') is None assert framework_info('P/F.framework') is None assert framework_info('P/F.framework/_debug') is None assert framework_info('P/F.framework/F') == d('P', 'F.framework/F', 'F') assert framework_info('P/F.framework/F_debug') == d('P', 'F.framework/F_debug', 'F', suffix='debug') assert framework_info('P/F.framework/Versions') is None assert framework_info('P/F.framework/Versions/A') is None assert framework_info('P/F.framework/Versions/A/F') == d('P', 'F.framework/Versions/A/F', 'F', 'A') assert framework_info('P/F.framework/Versions/A/F_debug') == d('P', 'F.framework/Versions/A/F_debug', 'F', 'A', 'debug') if __name__ == '__main__': test_framework_info() --- NEW FILE: __init__.py --- """ Enough Mach-O to make your head spin. See the relevant header files in /usr/include/mach-o And also Apple's documentation. """ __version__ = '1.0' --- NEW FILE: dyld.py --- """ dyld emulation """ import os from framework import framework_info from dylib import dylib_info from itertools import * __all__ = [ 'dyld_find', 'framework_find', 'framework_info', 'dylib_info', ] # These are the defaults as per man dyld(1) # DEFAULT_FRAMEWORK_FALLBACK = [ os.path.expanduser("~/Library/Frameworks"), "/Library/Frameworks", "/Network/Library/Frameworks", "/System/Library/Frameworks", ] DEFAULT_LIBRARY_FALLBACK = [ os.path.expanduser("~/lib"), "/usr/local/lib", "/lib", "/usr/lib", ] def ensure_utf8(s): """Not all of PyObjC and Python understand unicode paths very well yet""" if isinstance(s, unicode): return s.encode('utf8') return s def dyld_env(env, var): if env is None: env = os.environ rval = env.get(var) if rval is None: return [] return rval.split(':') def dyld_image_suffix(env=None): if env is None: env = os.environ return env.get('DYLD_IMAGE_SUFFIX') def dyld_framework_path(env=None): return dyld_env(env, 'DYLD_FRAMEWORK_PATH') def dyld_library_path(env=None): return dyld_env(env, 'DYLD_LIBRARY_PATH') def dyld_fallback_framework_path(env=None): return dyld_env(env, 'DYLD_FALLBACK_FRAMEWORK_PATH') def dyld_fallback_library_path(env=None): return dyld_env(env, 'DYLD_FALLBACK_LIBRARY_PATH') def dyld_image_suffix_search(iterator, env=None): """For a potential path iterator, add DYLD_IMAGE_SUFFIX semantics""" suffix = dyld_image_suffix(env) if suffix is None: return iterator def _inject(iterator=iterator, suffix=suffix): for path in iterator: if path.endswith('.dylib'): yield path[:-len('.dylib')] + suffix + '.dylib' else: yield path + suffix yield path return _inject() def dyld_override_search(name, env=None): # If DYLD_FRAMEWORK_PATH is set and this dylib_name is a # framework name, use the first file that exists in the framework # path if any. If there is none go on to search the DYLD_LIBRARY_PATH # if any. framework = framework_info(name) if framework is not None: for path in dyld_framework_path(env): yield os.path.join(path, framework['name']) # If DYLD_LIBRARY_PATH is set then use the first file that exists # in the path. If none use the original name. for path in dyld_library_path(env): yield os.path.join(path, os.path.basename(name)) def dyld_executable_path_search(name, executable_path=None): # If we haven't done any searching and found a library and the # dylib_name starts with "@executable_path/" then construct the # library name. if name.startswith('@executable_path/') and executable_path is not None: yield os.path.join(executable_path, name[len('@executable_path/'):]) def dyld_default_search(name, env=None): yield name framework = framework_info(name) if framework is not None: fallback_framework_path = dyld_fallback_framework_path(env) for path in fallback_framework_path: yield os.path.join(path, framework['name']) fallback_library_path = dyld_fallback_library_path(env) for path in fallback_library_path: yield os.path.join(path, os.path.basename(name)) if framework is not None and not fallback_framework_path: for path in DEFAULT_FRAMEWORK_FALLBACK: yield os.path.join(path, framework['name']) if not fallback_library_path: for path in DEFAULT_LIBRARY_FALLBACK: yield os.path.join(path, os.path.basename(name)) def dyld_find(name, executable_path=None, env=None): """ Find a library or framework using dyld semantics """ name = ensure_utf8(name) executable_path = ensure_utf8(executable_path) for path in dyld_image_suffix_search(chain( dyld_override_search(name, env), dyld_executable_path_search(name, executable_path), dyld_default_search(name, env), ), env): if os.path.isfile(path): return path raise ValueError, "dylib %s could not be found" % (name,) def framework_find(fn, executable_path=None, env=None): """ Find a framework using dyld semantics in a very loose manner. Will take input such as: Python Python.framework Python.framework/Versions/Current """ try: return dyld_find(fn, executable_path=executable_path, env=env) except ValueError, e: pass fmwk_index = fn.rfind('.framework') if fmwk_index == -1: fmwk_index = len(fn) fn += '.framework' fn = os.path.join(fn, os.path.basename(fn[:fmwk_index])) try: return dyld_find(fn, executable_path=executable_path, env=env) except ValueError: raise e def test_dyld_find(): env = {} assert dyld_find('libSystem.dylib') == '/usr/lib/libSystem.dylib' assert dyld_find('System.framework/System') == '/System/Library/Frameworks/System.framework/System' if __name__ == '__main__': test_dyld_find() |
From: Fabio Z. <fa...@us...> - 2008-04-12 12:07:56
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8550 Modified Files: Changes.txt Log Message: help() works (ctype implementation no longer in default pythonpath -- under ThirdParty) Index: Changes.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/Changes.txt,v retrieving revision 1.366 retrieving revision 1.367 diff -C2 -d -r1.366 -r1.367 *** Changes.txt 12 Apr 2008 11:44:23 -0000 1.366 --- Changes.txt 12 Apr 2008 12:08:00 -0000 1.367 *************** *** 3,6 **** --- 3,7 ---- Pydev <li>Bug fix for pydev package explorer when refreshed element parent was null</li> + <li>Interactive console: help() works</li> after 1.3.14 |
From: Fabio Z. <fa...@us...> - 2008-04-12 12:07:56
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8550/PySrc/ThirdParty Removed Files: _ctypes.dll ctypes-README.txt Log Message: help() works (ctype implementation no longer in default pythonpath -- under ThirdParty) --- _ctypes.dll DELETED --- --- ctypes-README.txt DELETED --- |
From: Fabio Z. <fa...@us...> - 2008-04-12 12:07:56
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8550/PySrc/ThirdParty/wrapped_for_pydev Added Files: not_in_default_pythonpath.txt Log Message: help() works (ctype implementation no longer in default pythonpath -- under ThirdParty) --- NEW FILE: not_in_default_pythonpath.txt --- The wrapped_for_pydev folder is not in the default pythonpath... (no __init__.py file) |
From: Fabio Z. <fa...@us...> - 2008-04-12 12:07:56
|
Update of /cvsroot/pydev/org.python.pydev/PySrc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8550/PySrc Modified Files: interpreterInfo.py pydevconsole.py Log Message: help() works (ctype implementation no longer in default pythonpath -- under ThirdParty) Index: interpreterInfo.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/interpreterInfo.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** interpreterInfo.py 10 Oct 2007 12:16:00 -0000 1.22 --- interpreterInfo.py 12 Apr 2008 12:08:00 -0000 1.23 *************** *** 18,23 **** if sys.platform == "cygwin": ! sys.path.append(os.path.join(sys.path[0],'ThirdParty')) ! import ctypes def nativePath(path): MAX_PATH=512 # On cygwin NT, its 260 lately, but just need BIG ENOUGH buffer --- 18,28 ---- if sys.platform == "cygwin": ! ! try: ! import ctypes #use from the system if available ! except ImportError: ! sys.path.append(os.path.join(sys.path[0],'ThirdParty/wrapped_for_pydev')) ! import ctypes ! def nativePath(path): MAX_PATH=512 # On cygwin NT, its 260 lately, but just need BIG ENOUGH buffer Index: pydevconsole.py =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/PySrc/pydevconsole.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pydevconsole.py 30 Mar 2008 21:45:12 -0000 1.3 --- pydevconsole.py 12 Apr 2008 12:08:00 -0000 1.4 *************** *** 32,37 **** --- 32,45 ---- server = xmlrpclib.Server('http://%s:%s' % (self.host, self.client_port)) return server.RequestInput() + + def isatty(self): + return False #not really a file + def write(self, *args, **kwargs): + pass #not available StdIn (but it can be expected to be in the stream interface) + def flush(self, *args, **kwargs): + pass #not available StdIn (but it can be expected to be in the stream interface) + #in the interactive interpreter, a read and a readline are the same. read = readline |
From: Fabio Z. <fa...@us...> - 2008-04-12 12:07:55
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/ctypes/macholib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8550/PySrc/ThirdParty/ctypes/macholib Removed Files: framework.py __init__.py dyld.py dylib.py .cvsignore Log Message: help() works (ctype implementation no longer in default pythonpath -- under ThirdParty) --- .cvsignore DELETED --- --- dylib.py DELETED --- --- framework.py DELETED --- --- __init__.py DELETED --- --- dyld.py DELETED --- |
From: Fabio Z. <fa...@us...> - 2008-04-12 12:07:54
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8550/PySrc/ThirdParty/ctypes Removed Files: _endian.py util.py wintypes.py .cvsignore __init__.py Log Message: help() works (ctype implementation no longer in default pythonpath -- under ThirdParty) --- .cvsignore DELETED --- --- wintypes.py DELETED --- --- util.py DELETED --- --- __init__.py DELETED --- --- _endian.py DELETED --- |
From: Fabio Z. <fa...@us...> - 2008-04-12 12:07:39
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes/macholib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8516/PySrc/ThirdParty/wrapped_for_pydev/ctypes/macholib Log Message: Directory /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes/macholib added to the repository |
From: Fabio Z. <fa...@us...> - 2008-04-12 12:07:39
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8516/PySrc/ThirdParty/wrapped_for_pydev Log Message: Directory /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev added to the repository |
From: Fabio Z. <fa...@us...> - 2008-04-12 12:07:39
|
Update of /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8516/PySrc/ThirdParty/wrapped_for_pydev/ctypes Log Message: Directory /cvsroot/pydev/org.python.pydev/PySrc/ThirdParty/wrapped_for_pydev/ctypes added to the repository |
From: Fabio Z. <fa...@us...> - 2008-04-12 11:55:31
|
Update of /cvsroot/pydev/org.python.pydev/src_navigator/org/python/pydev/navigator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32315/src_navigator/org/python/pydev/navigator Modified Files: PythonModelProvider.java Log Message: Bug fix for pydev package explorer when refreshed element parent was null Index: PythonModelProvider.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src_navigator/org/python/pydev/navigator/PythonModelProvider.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PythonModelProvider.java 5 Feb 2008 01:53:19 -0000 1.8 --- PythonModelProvider.java 12 Apr 2008 11:44:23 -0000 1.9 *************** *** 488,492 **** }else{ //now, if it's not but its parent is, go on and create it ! Object pythonParent = getResourceInPythonModel(res.getParent(), true); if(pythonParent instanceof IWrappedResource){ IWrappedResource parent = (IWrappedResource) pythonParent; --- 488,497 ---- }else{ //now, if it's not but its parent is, go on and create it ! IContainer p = res.getParent(); ! if(p == null){ ! continue; ! } ! ! Object pythonParent = getResourceInPythonModel(p, true); if(pythonParent instanceof IWrappedResource){ IWrappedResource parent = (IWrappedResource) pythonParent; |
From: Fabio Z. <fa...@us...> - 2008-04-12 11:55:30
|
Update of /cvsroot/pydev/org.python.pydev/tests_navigator/org/python/pydev/navigator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32315/tests_navigator/org/python/pydev/navigator Modified Files: PythonModelProviderTest.java Log Message: Bug fix for pydev package explorer when refreshed element parent was null Index: PythonModelProviderTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests_navigator/org/python/pydev/navigator/PythonModelProviderTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PythonModelProviderTest.java 8 Sep 2007 16:36:12 -0000 1.5 --- PythonModelProviderTest.java 12 Apr 2008 11:44:23 -0000 1.6 *************** *** 4,7 **** --- 4,8 ---- import java.util.ArrayList; import java.util.HashSet; + import java.util.Set; import junit.framework.TestCase; *************** *** 11,14 **** --- 12,16 ---- import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.ui.navigator.PipelinedShapeModification; + import org.eclipse.ui.navigator.PipelinedViewerUpdate; import org.python.pydev.core.IPythonPathNature; import org.python.pydev.core.TestDependent; *************** *** 59,62 **** --- 61,82 ---- /** + * Test if intercepting an object that does not have a parent works. + */ + public void testInterceptRefresh() throws Exception { + PythonNature nature = createNature(TestDependent.TEST_PYSRC_NAVIGATOR_LOC+"projroot/source/python"); + + project = new ProjectStub(new File(TestDependent.TEST_PYSRC_NAVIGATOR_LOC+"projroot"), nature); + provider = new PythonModelProvider(); + + + PipelinedViewerUpdate update = new PipelinedViewerUpdate(); + Set<IResource> refreshTargets = update.getRefreshTargets(); + refreshTargets.add(project); + provider.interceptRefresh(update); + IResource wrappedResource = refreshTargets.iterator().next(); + assertTrue(wrappedResource == project); + } + + /** * Test if setting the project root as a source folder will return an object from the python model. */ |
From: Fabio Z. <fa...@us...> - 2008-04-12 11:44:18
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32315 Modified Files: Changes.txt Log Message: Bug fix for pydev package explorer when refreshed element parent was null Index: Changes.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/Changes.txt,v retrieving revision 1.365 retrieving revision 1.366 diff -C2 -d -r1.365 -r1.366 *** Changes.txt 9 Apr 2008 01:39:05 -0000 1.365 --- Changes.txt 12 Apr 2008 11:44:23 -0000 1.366 *************** *** 1,2 **** --- 1,7 ---- + after 1.3.15 + + Pydev + <li>Bug fix for pydev package explorer when refreshed element parent was null</li> + after 1.3.14 |
From: Fabio Z. <fa...@us...> - 2008-04-11 19:49:32
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27971 Modified Files: TODO.txt Log Message: Index: TODO.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/TODO.txt,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** TODO.txt 10 Apr 2008 17:25:53 -0000 1.63 --- TODO.txt 11 Apr 2008 19:49:29 -0000 1.64 *************** *** 79,81 **** at com.python.pydev.refactoring.wizards.rename.PyRenameEntryPoint.checkInitialConditions(PyRenameEntryPoint.java:193) at com.python.pydev.refactoring.markoccurrences.MarkOccurrencesJob.checkAnnotations(MarkOccurrencesJob.java:216) ! ... 2 more \ No newline at end of file --- 79,166 ---- at com.python.pydev.refactoring.wizards.rename.PyRenameEntryPoint.checkInitialConditions(PyRenameEntryPoint.java:193) at com.python.pydev.refactoring.markoccurrences.MarkOccurrencesJob.checkAnnotations(MarkOccurrencesJob.java:216) ! ... 2 more ! ! ! ! ! ! ! ! problem after removing project; ! ! Unable to find the path /kraken20 2.0.13/kraken20/source/python in the project were it's ! added as a source folder for pydev (project: kraken20 2.0.13) ! Unable to find the path /kraken20 2.0.13/kraken20/source/python in the project were it's ! added as a source folder for pydev (project: kraken20 2.0.13) ! org.eclipse.core.runtime.CoreException: Unable to find the path /kraken20 2.0.13/kraken20/source/python in the project were it's ! added as a source folder for pydev (project: kraken20 2.0.13) ! at org.python.pydev.plugin.PydevPlugin.log(PydevPlugin.java:372) ! at org.python.pydev.plugin.nature.PythonPathNature.getOnlyProjectPythonPathStr(PythonPathNature.java:149) ! at org.python.pydev.plugin.nature.PythonNature.rebuildPath(PythonNature.java:464) ! at org.python.pydev.plugin.nature.PythonNature.rebuildPath(PythonNature.java:457) ! at org.python.pydev.plugin.nature.PythonPathNature.getProjectSourcePath(PythonPathNature.java:237) ! at org.python.pydev.plugin.nature.PythonPathNature.getProjectSourcePathSet(PythonPathNature.java:189) ! at org.python.pydev.navigator.PythonModelProvider.doWrapPossibleSourceFolder(PythonModelProvider.java:432) ! at org.python.pydev.navigator.PythonModelProvider.doWrap(PythonModelProvider.java:380) ! at org.python.pydev.navigator.PythonModelProvider.wrapChildren(PythonModelProvider.java:337) ! at org.python.pydev.navigator.PythonModelProvider.convertToPythonElementsAddOrRemove(PythonModelProvider.java:250) ! at org.python.pydev.navigator.PythonModelProvider.interceptAdd(PythonModelProvider.java:106) ! at org.eclipse.ui.internal.navigator.extensions.SafeDelegateTreeContentProvider.interceptAdd(SafeDelegateTreeContentProvider.java:224) ! at org.eclipse.ui.internal.navigator.NavigatorPipelineService.pipelineInterceptAdd(NavigatorPipelineService.java:124) ! at org.eclipse.ui.internal.navigator.NavigatorPipelineService.interceptAdd(NavigatorPipelineService.java:81) ! at org.eclipse.ui.navigator.CommonViewer.add(CommonViewer.java:242) ! at org.python.pydev.navigator.PythonBaseModelProvider$2.run(PythonBaseModelProvider.java:844) ! at org.python.pydev.navigator.PythonBaseModelProvider.runUpdates(PythonBaseModelProvider.java:698) ! at org.python.pydev.navigator.PythonBaseModelProvider.access$0(PythonBaseModelProvider.java:694) ! at org.python.pydev.navigator.PythonBaseModelProvider$1.run(PythonBaseModelProvider.java:683) ! at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) ! at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) ! at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3659) ! at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3296) ! at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:158) ! at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:326) ! at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934) ! at org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage.createProjects(WizardProjectsImportPage.java:1091) ! at org.eclipse.ui.wizards.datatransfer.ExternalProjectImportWizard.performFinish(ExternalProjectImportWizard.java:97) ! at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742) ! at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373) ! at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:616) ! at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227) ! at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) ! at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) ! at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) ! at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) ! at org.eclipse.jface.window.Window.runEventLoop(Window.java:820) ! at org.eclipse.jface.window.Window.open(Window.java:796) ! at org.eclipse.ui.actions.ImportResourcesAction.run(ImportResourcesAction.java:159) ! at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:168) ! at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546) ! at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) ! at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402) ! at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) ! at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) ! at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) ! at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) ! at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) ! at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) ! at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) ! at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) ! at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) ! at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) ! at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) ! at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) ! at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169) ! at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) ! at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) ! at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) ! at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) ! at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ! at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ! at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ! at java.lang.reflect.Method.invoke(Method.java:585) ! at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508) ! at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447) ! at org.eclipse.equinox.launcher.Main.run(Main.java:1173) ! at org.eclipse.equinox.launcher.Main.main(Main.java:1148) ! org.eclipse.core.runtime.CoreException[4]: java.lang.RuntimeException: Unable to find the path /kraken20 2.0.13/kraken20/source/python in the project were it ! 's \ No newline at end of file |
From: Fabio Z. <fa...@us...> - 2008-04-10 17:26:04
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23284 Modified Files: TODO.txt Log Message: Index: TODO.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/TODO.txt,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** TODO.txt 9 Apr 2008 01:39:05 -0000 1.62 --- TODO.txt 10 Apr 2008 17:25:53 -0000 1.63 *************** *** 2,5 **** --- 2,10 ---- PythonCorrectionProcessor: ImageCache should be gotten from the plugin + ctrl+shift+up/down stops at the end of curr_widget_class + def GetClassesAndData(): + curr_widget_class = 10 + + - hierarchy view: show with f4 / close / open view / f4 (will not work) - DEBUGGER BUG: if a class is defined within a method, things later in that method are not able to get the correct name for the breakpoint scope (cannot reproduce?) |
From: Fabio Z. <fa...@us...> - 2008-04-10 16:16:06
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26717/src/org/python/pydev/debug/model Modified Files: PyVariableCollection.java PyDebugModelPresentation.java PyThread.java DeferredWorkbenchAdapter.java PyVariable.java PyWatchExpressionDelegate.java PyStackFrame.java AbstractDebugTarget.java Added Files: AdapterDebug.java Log Message: Raised the timeout for variable request from 2.5 to 10 seconds: DeferredWorkbenchAdapter. Others are only minors. Index: PyThread.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyThread.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PyThread.java 24 Jun 2006 01:45:53 -0000 1.13 --- PyThread.java 10 Apr 2008 16:15:59 -0000 1.14 *************** *** 210,219 **** public Object getAdapter(Class adapter) { if (adapter.equals(ILaunch.class) || ! adapter.equals(IResource.class)) return target.getAdapter(adapter); ! else if (adapter.equals(ITaskListResourceAdapter.class)) return null; ! else if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class) || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class) --- 210,221 ---- public Object getAdapter(Class adapter) { + AdapterDebug.print(this, adapter); + if (adapter.equals(ILaunch.class) || ! adapter.equals(IResource.class)){ return target.getAdapter(adapter); ! }else if (adapter.equals(ITaskListResourceAdapter.class)){ return null; ! }else if (adapter.equals(IPropertySource.class) || adapter.equals(ITaskListResourceAdapter.class) || adapter.equals(org.eclipse.debug.ui.actions.IToggleBreakpointsTarget.class) *************** *** 222,231 **** || adapter.equals(org.eclipse.ui.model.IWorkbenchAdapter.class) || adapter.equals(org.eclipse.ui.IActionFilter.class) ! ) return super.getAdapter(adapter); - else { - // System.err.println("PythonThread Need adapter " + adapter.toString()); - Platform.getAdapterManager().getAdapter(this, adapter); } // ongoing, I do not fully understand all the interfaces they'd like me to support return super.getAdapter(adapter); --- 224,232 ---- || adapter.equals(org.eclipse.ui.model.IWorkbenchAdapter.class) || adapter.equals(org.eclipse.ui.IActionFilter.class) ! ) { return super.getAdapter(adapter); } + //Platform.getAdapterManager().getAdapter(this, adapter); + AdapterDebug.printDontKnow(this, adapter); // ongoing, I do not fully understand all the interfaces they'd like me to support return super.getAdapter(adapter); Index: PyStackFrame.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyStackFrame.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** PyStackFrame.java 24 Jun 2006 01:45:53 -0000 1.14 --- PyStackFrame.java 10 Apr 2008 16:15:59 -0000 1.15 *************** *** 252,255 **** --- 252,257 ---- public Object getAdapter(Class adapter) { + AdapterDebug.print(this, adapter); + if (adapter.equals(ILaunch.class) || adapter.equals(IResource.class)){ *************** *** 273,278 **** } // ongoing, I do not fully understand all the interfaces they'd like me to support - // System.err.println("PyStackFrame Need adapter " + adapter.toString()); return super.getAdapter(adapter); } --- 275,280 ---- } + AdapterDebug.printDontKnow(this, adapter); // ongoing, I do not fully understand all the interfaces they'd like me to support return super.getAdapter(adapter); } Index: DeferredWorkbenchAdapter.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/DeferredWorkbenchAdapter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DeferredWorkbenchAdapter.java 13 Apr 2006 20:02:54 -0000 1.5 --- DeferredWorkbenchAdapter.java 10 Apr 2008 16:15:59 -0000 1.6 *************** *** 99,105 **** // it causes unneeded scrolling, because view preserves selection instead // of visibility. ! // I try to minimize the occurence here, by giving pydevd time to complete the // task before we are forced to do asynchronous notification. ! int i = 50; while (--i > 0 && commandVariables == null){ if(this.monitor != null && this.monitor.isCanceled() == true){ --- 99,105 ---- // it causes unneeded scrolling, because view preserves selection instead // of visibility. ! // I try to minimize the occurrence here, by giving pydevd time to complete the // task before we are forced to do asynchronous notification. ! int i = 1000; while (--i > 0 && commandVariables == null){ if(this.monitor != null && this.monitor.isCanceled() == true){ *************** *** 107,111 **** return new PyVariable[0]; } ! Thread.sleep(50); } } catch (InterruptedException e) { --- 107,111 ---- return new PyVariable[0]; } ! Thread.sleep(10); //10 seconds } } catch (InterruptedException e) { Index: PyDebugModelPresentation.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyDebugModelPresentation.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PyDebugModelPresentation.java 11 May 2007 19:47:27 -0000 1.8 --- PyDebugModelPresentation.java 10 Apr 2008 16:15:59 -0000 1.9 *************** *** 24,27 **** --- 24,28 ---- import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; + import org.python.pydev.core.bundle.ImageCache; import org.python.pydev.debug.core.PydevDebugPlugin; import org.python.pydev.plugin.PydevPlugin; *************** *** 34,37 **** --- 35,41 ---- static public String PY_DEBUG_MODEL_ID = "org.python.pydev.debug"; + /** + * Listeners compared by identity + */ protected ListenerList fListeners = new ListenerList(ListenerList.IDENTITY); *************** *** 42,45 **** --- 46,51 ---- */ public Image getImage(Object element) { + ImageCache imageCache = PydevDebugPlugin.getImageCache(); + if (element instanceof PyBreakpoint) { try { *************** *** 48,60 **** if ((pyBreakpoint).isEnabled()) if (pyBreakpoint.isConditionEnabled()){ ! return PydevDebugPlugin.getImageCache().get("icons/breakmarker_conditional.gif"); }else{ ! return PydevDebugPlugin.getImageCache().get("icons/breakmarker.gif"); } else if (pyBreakpoint.isConditionEnabled()){ ! return PydevDebugPlugin.getImageCache().get("icons/breakmarker_gray_conditional.gif"); }else{ ! return PydevDebugPlugin.getImageCache().get("icons/breakmarker_gray.gif"); } --- 54,66 ---- if ((pyBreakpoint).isEnabled()) if (pyBreakpoint.isConditionEnabled()){ ! return imageCache.get("icons/breakmarker_conditional.gif"); }else{ ! return imageCache.get("icons/breakmarker.gif"); } else if (pyBreakpoint.isConditionEnabled()){ ! return imageCache.get("icons/breakmarker_gray_conditional.gif"); }else{ ! return imageCache.get("icons/breakmarker_gray.gif"); } *************** *** 64,71 **** } else if (element instanceof PyVariableCollection) { ! return PydevDebugPlugin.getImageCache().get("icons/greendot_big.gif"); } else if (element instanceof PyVariable) { ! return PydevDebugPlugin.getImageCache().get("icons/greendot.gif"); } else if (element instanceof PyDebugTarget || element instanceof PyThread || element instanceof PyStackFrame){ --- 70,77 ---- } else if (element instanceof PyVariableCollection) { ! return imageCache.get("icons/greendot_big.gif"); } else if (element instanceof PyVariable) { ! return imageCache.get("icons/greendot.gif"); } else if (element instanceof PyDebugTarget || element instanceof PyThread || element instanceof PyStackFrame){ *************** *** 182,189 **** public void setAttribute(String attribute, Object value) { ! if (attribute.equals(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES)) displayVariableTypeNames = ((Boolean) value).booleanValue(); ! else System.err.println("setattribute"); } --- 188,196 ---- public void setAttribute(String attribute, Object value) { ! if (attribute.equals(IDebugModelPresentation.DISPLAY_VARIABLE_TYPE_NAMES)){ displayVariableTypeNames = ((Boolean) value).booleanValue(); ! }else{ System.err.println("setattribute"); + } } Index: PyWatchExpressionDelegate.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyWatchExpressionDelegate.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PyWatchExpressionDelegate.java 7 Feb 2007 00:46:13 -0000 1.6 --- PyWatchExpressionDelegate.java 10 Apr 2008 16:15:59 -0000 1.7 *************** *** 130,134 **** synchronized(variables) { if (variables[0] instanceof PyVariableCollection) { ! ((PyVariableCollection)variables[0]).requestedVariables = 2; } } --- 130,134 ---- synchronized(variables) { if (variables[0] instanceof PyVariableCollection) { ! ((PyVariableCollection)variables[0]).networkState = PyVariableCollection.NETWORK_REQUEST_ARRIVED; } } Index: PyVariableCollection.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyVariableCollection.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PyVariableCollection.java 7 Feb 2007 00:46:13 -0000 1.8 --- PyVariableCollection.java 10 Apr 2008 16:15:59 -0000 1.9 *************** *** 16,19 **** --- 16,20 ---- import org.python.pydev.debug.model.remote.GetVariableCommand; import org.python.pydev.debug.model.remote.ICommandResponseListener; + import org.python.pydev.plugin.PydevPlugin; /** *************** *** 27,32 **** PyVariable[] variables = new PyVariable[0]; IVariable[] waitVariables = null; ! int requestedVariables = 0; // Network request state: 0 did not request, 1 requested, 2 requested & arrived ! boolean fireChangeEvent = true; public PyVariableCollection(AbstractDebugTarget target, String name, String type, String value, IVariableLocator locator) { --- 28,42 ---- PyVariable[] variables = new PyVariable[0]; IVariable[] waitVariables = null; ! ! static final int NETWORK_REQUEST_NOT_REQUESTED = 0; ! static final int NETWORK_REQUEST_NOT_ARRIVED = 1; ! static final int NETWORK_REQUEST_ARRIVED = 2; ! ! /** ! * Defines the network state ! */ ! int networkState = NETWORK_REQUEST_NOT_REQUESTED; // Network request state: 0 did not request, 1 requested, 2 requested & arrived ! ! private boolean fireChangeEvent = true; public PyVariableCollection(AbstractDebugTarget target, String name, String type, String value, IVariableLocator locator) { *************** *** 58,62 **** variables = getCommandVariables(cmd); ! requestedVariables = 2; if (fireChangeEvent){ target.fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.STATE)); --- 68,72 ---- variables = getCommandVariables(cmd); ! networkState = NETWORK_REQUEST_ARRIVED; if (fireChangeEvent){ target.fireEvent(new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.STATE)); *************** *** 89,95 **** public IVariable[] getVariables() throws DebugException { ! if (requestedVariables == 2){ return variables; ! } else if (requestedVariables == 1){ return getWaitVariables(); } --- 99,105 ---- public IVariable[] getVariables() throws DebugException { ! if (networkState == NETWORK_REQUEST_ARRIVED){ return variables; ! } else if (networkState == NETWORK_REQUEST_NOT_ARRIVED){ return getWaitVariables(); } *************** *** 99,103 **** GetVariableCommand cmd = getVariableCommand(dbg); cmd.setCompletionListener(this); ! requestedVariables = 1; fireChangeEvent = false; // do not fire change event while we are waiting on response dbg.postCommand(cmd); --- 109,113 ---- GetVariableCommand cmd = getVariableCommand(dbg); cmd.setCompletionListener(this); ! networkState = NETWORK_REQUEST_NOT_ARRIVED; fireChangeEvent = false; // do not fire change event while we are waiting on response dbg.postCommand(cmd); *************** *** 109,122 **** // task before we are forced to do asynchronous notification. int i = 10; ! while (--i > 0 && requestedVariables != 2) Thread.sleep(50); } catch (InterruptedException e) { ! e.printStackTrace(); } fireChangeEvent = true; ! if (requestedVariables == 2) return variables; ! else return getWaitVariables(); } --- 119,135 ---- // task before we are forced to do asynchronous notification. int i = 10; ! while (--i > 0 && networkState != NETWORK_REQUEST_ARRIVED){ Thread.sleep(50); + } + } catch (InterruptedException e) { ! PydevPlugin.log(e); } fireChangeEvent = true; ! if (networkState == NETWORK_REQUEST_ARRIVED){ return variables; ! }else{ return getWaitVariables(); + } } --- NEW FILE: AdapterDebug.java --- package org.python.pydev.debug.model; public class AdapterDebug { public static void print(Object askedfor, Class adapter) { if(false){ System.out.println(askedfor.getClass().getName() + " requests "+adapter.toString()); } } public static void printDontKnow(Object askedfor, Class adapter) { if(false){ System.out.println("DONT KNOW: "+askedfor.getClass().getName() + " requests "+adapter.toString()); } } } Index: AbstractDebugTarget.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/AbstractDebugTarget.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AbstractDebugTarget.java 11 May 2007 01:57:53 -0000 1.13 --- AbstractDebugTarget.java 10 Apr 2008 16:16:00 -0000 1.14 *************** *** 553,556 **** --- 553,558 ---- public Object getAdapter(Class adapter) { + AdapterDebug.print(this, adapter); + // Not really sure what to do here, but I am trying if (adapter.equals(ILaunch.class)){ *************** *** 580,584 **** return super.getAdapter(adapter); } ! // System.err.println("Need adapter " + adapter.toString()); return super.getAdapter(adapter); } --- 582,587 ---- return super.getAdapter(adapter); } ! ! AdapterDebug.printDontKnow(this, adapter); return super.getAdapter(adapter); } Index: PyVariable.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/model/PyVariable.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** PyVariable.java 7 Feb 2007 10:34:08 -0000 1.13 --- PyVariable.java 10 Apr 2008 16:15:59 -0000 1.14 *************** *** 129,132 **** --- 129,134 ---- public Object getAdapter(Class adapter) { + AdapterDebug.print(this, adapter); + if (adapter.equals(ILaunch.class)) return target.getAdapter(adapter); *************** *** 147,151 **** return new DeferredWorkbenchAdapter(this); } ! //System.err.println("PyVariable Need adapter " + adapter.toString()); return super.getAdapter(adapter); } --- 149,153 ---- return new DeferredWorkbenchAdapter(this); } ! AdapterDebug.printDontKnow(this, adapter); return super.getAdapter(adapter); } |
From: Fabio Z. <fa...@us...> - 2008-04-09 17:35:24
|
Update of /cvsroot/pydev/org.python.pydev.site In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18271 Modified Files: site.xml Log Message: Index: site.xml =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.site/site.xml,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** site.xml 6 Mar 2008 15:19:07 -0000 1.70 --- site.xml 9 Apr 2008 17:35:23 -0000 1.71 *************** *** 20,23 **** --- 20,28 ---- + <feature url="features/org.python.pydev.feature_1.3.15.jar" id="org.python.pydev.feature" version="1.3.15"> + <category name="Pydev"/> + </feature> + + <feature url="features/org.python.pydev.feature_1.3.14.jar" id="org.python.pydev.feature" version="1.3.14"> <category name="Pydev"/> |
From: Fabio Z. <fa...@us...> - 2008-04-09 11:26:01
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/correctionassist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7640/src/org/python/pydev/editor/correctionassist Modified Files: PythonCorrectionProcessor.java Log Message: Restored interface removed (that was used from the scripting engine). Index: PythonCorrectionProcessor.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/correctionassist/PythonCorrectionProcessor.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** PythonCorrectionProcessor.java 6 Apr 2008 19:51:34 -0000 1.35 --- PythonCorrectionProcessor.java 9 Apr 2008 11:26:06 -0000 1.36 *************** *** 8,13 **** --- 8,15 ---- import java.util.ArrayList; import java.util.Collections; + import java.util.HashMap; import java.util.Iterator; import java.util.List; + import java.util.Map; import org.eclipse.jface.text.BadLocationException; *************** *** 78,81 **** --- 80,122 ---- private ImageCache imageCache; + /** + * Contains additional assists (used from the jython scripting: pyedit_assign_params_to_attributes.py to add new assists) + */ + private static Map<String, IAssistProps> additionalAssists = new HashMap<String, IAssistProps>(); + + /** + * Checks if some assist with the given id is already added. + * + * @param id the id of the assist + * @return true if it's already added and false otherwise + */ + public static boolean hasAdditionalAssist(String id) { + synchronized (additionalAssists) { + return additionalAssists.containsKey(id); + } + } + + /** + * Adds some additional assist to Ctrl+1 (used from the scripting engine) + * + * @param id the id of the assist + * @param assist the assist to be added + */ + public static void addAdditionalAssist(String id, IAssistProps assist) { + synchronized (additionalAssists) { + additionalAssists.put(id, assist); + } + } + + /** + * Removes some additional assist from Ctrl+1 + * + * @param id id of the assist to be removed + */ + public static void removeAdditionalAssist(String id) { + synchronized (additionalAssists) { + additionalAssists.remove(id); + } + } /** *************** *** 104,108 **** List<IAssistProps> assists = new ArrayList<IAssistProps>(); ! assists.add(new AssistTry()); assists.add(new AssistImport()); --- 145,154 ---- List<IAssistProps> assists = new ArrayList<IAssistProps>(); ! synchronized (PythonCorrectionProcessor.additionalAssists) { ! for (IAssistProps prop : additionalAssists.values()) { ! assists.add(prop); ! } ! } ! assists.add(new AssistTry()); assists.add(new AssistImport()); |
From: Fabio Z. <fa...@us...> - 2008-04-09 01:39:00
|
Update of /cvsroot/pydev/org.python.pydev In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12862 Modified Files: TODO.txt Changes.txt Log Message: docs Index: TODO.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/TODO.txt,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** TODO.txt 7 Apr 2008 19:54:57 -0000 1.61 --- TODO.txt 9 Apr 2008 01:39:05 -0000 1.62 *************** *** 1,5 **** check: ! PythonCorrectionProcessor: ImageCache ! PythonRunner: Catch all exceptions on creating file! - hierarchy view: show with f4 / close / open view / f4 (will not work) --- 1,4 ---- check: ! PythonCorrectionProcessor: ImageCache should be gotten from the plugin - hierarchy view: show with f4 / close / open view / f4 (will not work) Index: Changes.txt =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/Changes.txt,v retrieving revision 1.364 retrieving revision 1.365 diff -C2 -d -r1.364 -r1.365 *** Changes.txt 7 Apr 2008 01:57:21 -0000 1.364 --- Changes.txt 9 Apr 2008 01:39:05 -0000 1.365 *************** *** 4,49 **** <ul> <li><strong>Globals Browser</strong>: Was not correctly showing definition on a case with multiple projects when one did not have the python nature configured.</li> </ul> Pydev <ul> <li><strong>Files without extension</strong>: If a file that does not have an extension is found in the root of the pythonpath, code-completion and breakpoints work with it.</li> ! <li><strong>from __future__ import (xxx, with_statement)</strong>: works.</li> ! <li><strong>Extract method</strong>: comma was removed when present after a tuple and before a keyword argument.</li> ! <li><strong>Console Encoding</strong>: print u"\xF6" works (see http://sourceforge.net/tracker/index.php?func=detail&aid=1580766&group_id=85796&atid=577329 for details).</li> ! <li><strong>New console view!</strong>: </li> ! - OK: esc: clear current line ! - OK: pg up: console history in dialog ! - OK: paste in correct limits ! - OK: cut: only cut valid stuff ! - OK: qualifier match context insensitive ! - OK: copy should not get prompt ! - OK: start writing: move cursor automatically to command line ! - OK: auto-indent ! - OK: code-completion ! - OK: context info ! - OK: context insensitive completions ! - OK: home must go to: 1st char / prompt end / line start ! - OK: correct messages (translation) ! - OK: creating 2nd console view has problems with the interactive console ! - OK: class Foo(): adding 'object' through simple completions does not work well ! - OK: colors config ! - OK: the 'xml' module seems to be appearing multiple times (when it shouldn't) ! - OK: no async exec for caret update (almost finished: only the constructor still has it with async) ! - OK: up/down should select content in history based on what's already in the console ! - OK: stdout/stderr gotten from the server without using sockets ! - OK: sys.exit may halt shell ! - OK: shell still seems open after 'killing' eclipse. ! - OK: add hyperlinks to tracebacks in console ! - OK: Ctrl+Alt+Enter: create console / send contents to console / make execfile for current file ! - OK: templates in code-completion ! - OK: vmargs for jython ! - OK: cycle completions ! - OK initial commands for starting the console ! - OK: ctrl+1 works for assign quick-assist ! Limitations: ! - if raw_input() does not come from the main thread, it'll be ignored (and halted forever) ! - Output is not asynchonous (so, the stdout and stderr will only be shown when a new line is sent to the console) ! </ul> --- 4,65 ---- <ul> <li><strong>Globals Browser</strong>: Was not correctly showing definition on a case with multiple projects when one did not have the python nature configured.</li> + <li><strong>Code Analysis</strong>: False positive fixed: Classes defined within a class context are correctly found when later accessed in the parent context.</li> + <li><strong>Interactive console integration</strong></li> + <ul> + <li>Context insensitive completions with auto-import</li> + <li>Ctrl+Alt+Enter: can be used to:</li> + <ul> + <li>Create console if no console exists</li> + <li>Send selected text to console</li> + <li>Make execfile for current file if there's no selected text</li> + </ul> + </ul> </ul> Pydev + <ul> <li><strong>Files without extension</strong>: If a file that does not have an extension is found in the root of the pythonpath, code-completion and breakpoints work with it.</li> ! <li><strong>Extract method</strong>: comma not removed when found after a tuple and before a keyword argument.</li> ! <li><strong>Console Encoding</strong>: print u"\xF6" works (console encoding correctly customized in python -- see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1580766&group_id=85796&atid=577329">http://sourceforge.net/tracker/index.php?func=detail&aid=1580766&group_id=85796&atid=577329</a> for details).</li> ! <li><strong>Debugger</strong>: Context of breakpoint correctly defined when comments are present in the end of the module.</li> ! <li>from __future__ import (xxx, with_statement): works.</li> ! <li><strong>Interactive Console View</strong>, featuring:</li> ! <ul> ! <li><strong>Code Completion</strong></li> ! <ul> ! <li>Context sensitive with shell completions</li> ! <li>Qualifier matches as case insensitive</li> ! <li>Templates</li> ! <li>Repeating the activation changes from templates to default completions</li> ! </ul> ! ! <li><strong>Console Configurations</strong></li> ! <ul> ! <li>Initial commands for starting the console</li> ! <li>Colors for the console</li> ! <li>Vmargs can be specified for jython</li> ! </ul> ! ! <li><strong>Auto-indent</strong></li> ! <li><strong>Auto-edits</strong></li> ! <li><strong>Context info on hover</strong></li> ! <li><strong>Up / Down Arrows</strong> cycles through the history (and uses the current text to match for the start of the history command)</li> ! <li><strong>Page Up</strong>: shows dialog with console history (where lines to be re-executed can be selected)</li> ! <li><strong>Esc</strong>: clears current line</li> ! <li><strong>ctrl+1</strong> works for assign quick-assist</li> ! <li><strong>Hyperlinks</strong> addedd to tracebacks in the console</li> ! <li>Paste added directly to the command line</li> ! <li>Cut will only cut from the command line</li> ! <li>Copy does not get the prompt chars</li> ! <li>Home goes to: first text char / prompt end / line start (and cycles again)</li> ! <li>Cursor automatically moved to command line on key events</li> ! <li>Multiple views of the same console can be created</li> ! ! <li>Limitations</li> ! <ul> ! <li>Output is not asynchonous (stdout and stderr are only shown after a new command is sent to the console)</li> ! </ul> ! </ul> </ul> |
From: Fabio Z. <fa...@us...> - 2008-04-09 01:38:53
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12765/src/org/python/pydev/debug/ui/launching Modified Files: PythonRunner.java Log Message: docs Index: PythonRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunner.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** PythonRunner.java 7 Apr 2008 00:51:57 -0000 1.33 --- PythonRunner.java 9 Apr 2008 01:38:59 -0000 1.34 *************** *** 264,269 **** File file = PydevPlugin.getScriptWithinPySrc("pydev_sitecustomize"); file = new File(file, "encoding_config"); ! REF.writeStrToFile(encoding, file); ! } catch (CoreException e) { PydevPlugin.log(e); } --- 264,269 ---- File file = PydevPlugin.getScriptWithinPySrc("pydev_sitecustomize"); file = new File(file, "encoding_config"); ! REF.writeStrToFile(encoding.trim(), file); ! } catch (Throwable e) { PydevPlugin.log(e); } |
From: Fabio Z. <fa...@us...> - 2008-04-09 00:43:42
|
Update of /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/correctionassist/heuristics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24709/src/org/python/pydev/editor/correctionassist/heuristics Modified Files: AssistAssign.java Log Message: Scoping problems on class definitions. Index: AssistAssign.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/src/org/python/pydev/editor/correctionassist/heuristics/AssistAssign.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** AssistAssign.java 8 Apr 2008 23:05:39 -0000 1.16 --- AssistAssign.java 9 Apr 2008 00:43:47 -0000 1.17 *************** *** 59,64 **** PyEdit edit, int offset) throws BadLocationException { PySourceViewer viewer = null; ! if(edit != null){ ! edit.getPySourceViewer(); } --- 59,64 ---- PyEdit edit, int offset) throws BadLocationException { PySourceViewer viewer = null; ! if(edit != null){ //only in tests it's actually null ! viewer = edit.getPySourceViewer(); } |