[pygccxml-commit] SF.net SVN: pygccxml:[1469] pygccxml_dev
Brought to you by:
mbaas,
roman_yakovenko
|
From: <rom...@us...> - 2008-12-16 12:56:40
|
Revision: 1469
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1469&view=rev
Author: roman_yakovenko
Date: 2008-12-16 12:56:36 +0000 (Tue, 16 Dec 2008)
Log Message:
-----------
adding new functionality and improving initial environment handling
Modified Paths:
--------------
pygccxml_dev/pygccxml/msvc/common_utils.py
pygccxml_dev/pygccxml/utils/__init__.py
pygccxml_dev/unittests/autoconfig.py
Modified: pygccxml_dev/pygccxml/msvc/common_utils.py
===================================================================
--- pygccxml_dev/pygccxml/msvc/common_utils.py 2008-12-16 08:51:37 UTC (rev 1468)
+++ pygccxml_dev/pygccxml/msvc/common_utils.py 2008-12-16 12:56:36 UTC (rev 1469)
@@ -37,7 +37,7 @@
#__unDName definition was taken from:
#http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html
-msvcrxx = ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL)
+msvcrxx = ctypes.windll.msvcr71 #ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL)
free_type = ctypes.CFUNCTYPE( None, ctypes.c_void_p ) #free type
malloc_type = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_uint ) #malloc type
Modified: pygccxml_dev/pygccxml/utils/__init__.py
===================================================================
--- pygccxml_dev/pygccxml/utils/__init__.py 2008-12-16 08:51:37 UTC (rev 1468)
+++ pygccxml_dev/pygccxml/utils/__init__.py 2008-12-16 12:56:36 UTC (rev 1469)
@@ -119,38 +119,50 @@
def fdel(s):
del s.__dict__[private]
super(cached, self).__init__(fget, fdel=fdel)
-
+
@staticmethod
def reset(self):
cls = self.__class__
for name in dir(cls):
attr = getattr(cls, name)
if isinstance(attr, cached):
- delattr(self, name)
+ delattr(self, name)
class enum( object ):
"""Usage example:
class fruits(enum):
apple = 0
orange = 1
-
+
fruits.has_value( 1 )
fruits.name_of( 1 )
"""
-
+
@classmethod
def has_value( cls, enum_numeric_value ):
- for name, value in cls.__dict__.iteritems():
+ for name, value in cls.__dict__.iteritems():
if enum_numeric_value == value:
return True
else:
return False
-
+
@classmethod
def name_of( cls, enum_numeric_value ):
- for name, value in cls.__dict__.iteritems():
+ for name, value in cls.__dict__.iteritems():
if enum_numeric_value == value:
return name
else:
raise RuntimeError( 'Unable to find name for value(%d) in enumeration "%s"'
% ( enum_numeric_value, cls.__name__ ) )
+
+class native_compiler:
+ """provides information about "native compiler", which was used to build this Python executable"""
+
+ @staticmethod
+ def get_version():
+ if 'win' not in sys.platform:
+ return None #not implemented yet
+ from distutils import msvccompiler
+ return ( 'msvc', str( msvccompiler.get_build_version() ) )
+
+
Modified: pygccxml_dev/unittests/autoconfig.py
===================================================================
--- pygccxml_dev/unittests/autoconfig.py 2008-12-16 08:51:37 UTC (rev 1468)
+++ pygccxml_dev/unittests/autoconfig.py 2008-12-16 12:56:36 UTC (rev 1469)
@@ -12,24 +12,13 @@
this_module_dir_path = os.path.abspath ( os.path.dirname( sys.modules[__name__].__file__) )
-compiler = None
+
data_directory = os.path.join( this_module_dir_path, 'data' )
build_directory = os.path.join( this_module_dir_path, 'temp' )
-gccxml_07_path = os.path.join( this_module_dir_path, '..', '..', 'gccxml_bin', 'v07', sys.platform, 'bin' )
-gccxml_09_path = os.path.join( this_module_dir_path, '..', '..', 'gccxml_bin', 'v09', sys.platform, 'bin' )
+gccxml_path = os.path.join( this_module_dir_path, '..', '..', 'gccxml_bin', 'v09', sys.platform, 'bin' )
+gccxml_version = '__GCCXML_09__'
-gccxml_path = gccxml_09_path
-
-gccxml_version = '__GCCXML_07__'
-if '09' in gccxml_path:
- gccxml_version = '__GCCXML_09__'
-
-print 'compiler: ', gccxml_version
-
-if sys.platform == 'win32':
- compiler = 'msvc71'
-
try:
import pygccxml
print 'unittests will run on INSTALLED version'
@@ -38,25 +27,31 @@
import pygccxml
print 'unittests will run on DEVELOPMENT version'
+compiler = pygccxml.utils.native_compiler.get_version()
+if compiler:
+ compiler = compiler[0] + compiler[1].replace( '.', '' )
+
+print 'GCCXML configured to simulate compiler ', compiler
+
pygccxml.declarations.class_t.USE_DEMANGLED_AS_NAME = True
class cxx_parsers_cfg:
-
+
keywd = { 'working_directory' : data_directory
, 'define_symbols' : [ gccxml_version ]
, 'compiler' : compiler }
-
+
if os.path.exists( os.path.join( gccxml_path, 'gccxml' ) ) \
or os.path.exists( os.path.join( gccxml_path, 'gccxml.exe' ) ):
keywd[ 'gccxml_path'] = gccxml_path
gccxml = pygccxml.parser.gccxml_configuration_t( **keywd )
-
+
pdb_loader = None
if sys.platform == 'win32':
- from pygccxml.msvc import pdb
+ from pygccxml.msvc import mspdb
pdb_file = os.path.join( data_directory, 'msvc_build', 'Debug', 'msvc_build.pdb' )
if os.path.exists( pdb_file ):
- pdb_loader = pdb.decl_loader_t( pdb_file )
+ pdb_loader = mspdb.decl_loader_t( pdb_file )
pdb_loader.read()
def get_pdb_global_ns():
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|