[pygccxml-commit] SF.net SVN: pygccxml: [1263] pygccxml_dev/pygccxml
Brought to you by:
mbaas,
roman_yakovenko
From: <rom...@us...> - 2008-02-26 20:38:14
|
Revision: 1263 http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1263&view=rev Author: roman_yakovenko Date: 2008-02-26 12:38:16 -0800 (Tue, 26 Feb 2008) Log Message: ----------- adding bsc support Modified Paths: -------------- pygccxml_dev/pygccxml/pdb_reader/details.py pygccxml_dev/pygccxml/pdb_reader/scanner.py pygccxml_dev/pygccxml/utils/__init__.py Added Paths: ----------- pygccxml_dev/pygccxml/pdb_reader/bsc.py pygccxml_dev/pygccxml/pdb_reader/msvc_details.py Removed Paths: ------------- pygccxml_dev/pygccxml/pdb_reader/msdia_details.py Added: pygccxml_dev/pygccxml/pdb_reader/bsc.py =================================================================== --- pygccxml_dev/pygccxml/pdb_reader/bsc.py (rev 0) +++ pygccxml_dev/pygccxml/pdb_reader/bsc.py 2008-02-26 20:38:16 UTC (rev 1263) @@ -0,0 +1,10 @@ +import os +import sys +import ctypes +import msvc_details + +bsc = ctypes.cdll.LoadLibrary( msvc_details.msbsc_path ) + +class bsc_t( object ): + def __init__( self, bsc_file_path ): + self.__bsc_file = bsc_file_path \ No newline at end of file Modified: pygccxml_dev/pygccxml/pdb_reader/details.py =================================================================== --- pygccxml_dev/pygccxml/pdb_reader/details.py 2008-02-25 20:47:57 UTC (rev 1262) +++ pygccxml_dev/pygccxml/pdb_reader/details.py 2008-02-26 20:38:16 UTC (rev 1263) @@ -1,4 +1,4 @@ -from msdia_details import msdia +from msvc_details import msdia from pygccxml import declarations def guess_class_type( udt_kind ): Deleted: pygccxml_dev/pygccxml/pdb_reader/msdia_details.py =================================================================== --- pygccxml_dev/pygccxml/pdb_reader/msdia_details.py 2008-02-25 20:47:57 UTC (rev 1262) +++ pygccxml_dev/pygccxml/pdb_reader/msdia_details.py 2008-02-26 20:38:16 UTC (rev 1263) @@ -1,80 +0,0 @@ -import os -import comtypes -import comtypes.client -import _winreg as win_registry -from distutils import msvccompiler - -class msdia_searcher_t: - def __init__( self ): - self.root_reg_key = win_registry.HKEY_LOCAL_MACHINE - - def find_path( self ): - vss_installed = self.__get_installed_vs_dirs() - msdia_dlls = self.__get_msdia_dll_paths( vss_installed ) - if 1 == len(msdia_dlls): - return msdia_dlls[0] - else: - #TODO find the highest version and use it. - pass - - def __get_msdia_dll_paths( self, vss_installed ): - msdia_dlls = [] - for vs in vss_installed: - debug_dir = os.path.join( vs, 'Common7', 'Packages', 'Debugger' ) - files = filter( lambda f: f.startswith( 'msdia' ) and f.endswith( '.dll' ) - , os.listdir( debug_dir ) ) - if not files: - continue - msdia_dlls.extend([ os.path.join( debug_dir, f ) for f in files ]) - if not msdia_dlls: - raise RuntimeError( 'pygccxml unable to find out msdiaXX.dll location' ) - return msdia_dlls - - def __get_installed_vs_dirs( self ): - vs_reg_path = 'Software\Microsoft\VisualStudio\SxS\VS7' - values = self.read_values( self.root_reg_key, vs_reg_path ) - return [ values.values()[0] ] - - def read_keys(self, base, key): - return msvccompiler.read_keys(base, key) - - def read_values(self, base, key): - return msvccompiler.read_values(base, key) - -msdia_path = msdia_searcher_t().find_path() -print msdia_path - -comtypes_client_gen_dir = comtypes.client.gen_dir -try: - comtypes.client.gen_dir = None - msdia = comtypes.client.GetModule( msdia_path ) -finally: - comtypes.client.gen_dir = comtypes_client_gen_dir - -#Adding code, that was not generated for some reason. - -class UdtKind: - UdtStruct, UdtClass, UdtUnion = (0, 1, 2) - -class CV_access_e: - CV_private, CV_protected, CV_public = (1, 2, 3) - -msdia.UdtKind = UdtKind -msdia.CV_access_e = CV_access_e - -class NameSearchOptions: - nsNone = 0 - nsfCaseSensitive = 0x1 - nsfCaseInsensitive = 0x2 - nsfFNameExt = 0x4 - nsfRegularExpression = 0x8 - nsfUndecoratedName = 0x10 - - # For backward compabibility: - nsCaseSensitive = nsfCaseSensitive - nsCaseInsensitive = nsfCaseInsensitive - nsFNameExt = nsfFNameExt - nsRegularExpression = nsfRegularExpression | nsfCaseSensitive - nsCaseInRegularExpression = nsfRegularExpression | nsfCaseInsensitive - -msdia.NameSearchOptions = NameSearchOptions Copied: pygccxml_dev/pygccxml/pdb_reader/msvc_details.py (from rev 1262, pygccxml_dev/pygccxml/pdb_reader/msdia_details.py) =================================================================== --- pygccxml_dev/pygccxml/pdb_reader/msvc_details.py (rev 0) +++ pygccxml_dev/pygccxml/pdb_reader/msvc_details.py 2008-02-26 20:38:16 UTC (rev 1263) @@ -0,0 +1,90 @@ +import os +import sys +import comtypes +import comtypes.client +import _winreg as win_registry +from distutils import msvccompiler + + +class binaries_searcher_t: + + def get_msbsc_path( self ): + relative_path = os.path.dirname( sys.modules[__name__].__file__) + absolute_path = os.path.abspath (relative_path) + return os.path.join( absolute_path, 'msbsc70.dll' ) + + def get_msdia_path( self ): + vss_installed = self.__get_installed_vs_dirs() + msdia_dlls = self.__get_msdia_dll_paths( vss_installed ) + if 1 == len(msdia_dlls): + return msdia_dlls[0] + else: + #TODO find the highest version and use it. + pass + + def __get_msdia_dll_paths( self, vss_installed ): + msdia_dlls = [] + for vs in vss_installed: + debug_dir = os.path.join( vs, 'Common7', 'Packages', 'Debugger' ) + files = filter( lambda f: f.startswith( 'msdia' ) and f.endswith( '.dll' ) + , os.listdir( debug_dir ) ) + if not files: + continue + msdia_dlls.extend([ os.path.join( debug_dir, f ) for f in files ]) + if not msdia_dlls: + raise RuntimeError( 'pygccxml unable to find out msdiaXX.dll location' ) + return msdia_dlls + + def __get_installed_vs_dirs( self ): + vs_reg_path = 'Software\Microsoft\VisualStudio\SxS\VS7' + values = self.read_values( win_registry.HKEY_LOCAL_MACHINE, vs_reg_path ) + return [ values.values()[0] ] + + def read_keys(self, base, key): + return msvccompiler.read_keys(base, key) + + def read_values(self, base, key): + return msvccompiler.read_values(base, key) + +bs = binaries_searcher_t() + +msdia_path = bs.get_msdia_path() +print 'msdia path: ', msdia_path + +msbsc_path = bs.get_msbsc_path() +print 'msbsc path: ', msbsc_path + +comtypes_client_gen_dir = comtypes.client.gen_dir +try: + comtypes.client.gen_dir = None + msdia = comtypes.client.GetModule( msdia_path ) +finally: + comtypes.client.gen_dir = comtypes_client_gen_dir + +#Adding code, that was not generated for some reason. + +class UdtKind: + UdtStruct, UdtClass, UdtUnion = (0, 1, 2) + +class CV_access_e: + CV_private, CV_protected, CV_public = (1, 2, 3) + +msdia.UdtKind = UdtKind +msdia.CV_access_e = CV_access_e + +class NameSearchOptions: + nsNone = 0 + nsfCaseSensitive = 0x1 + nsfCaseInsensitive = 0x2 + nsfFNameExt = 0x4 + nsfRegularExpression = 0x8 + nsfUndecoratedName = 0x10 + + # For backward compabibility: + nsCaseSensitive = nsfCaseSensitive + nsCaseInsensitive = nsfCaseInsensitive + nsFNameExt = nsfFNameExt + nsRegularExpression = nsfRegularExpression | nsfCaseSensitive + nsCaseInRegularExpression = nsfRegularExpression | nsfCaseInsensitive + +msdia.NameSearchOptions = NameSearchOptions Modified: pygccxml_dev/pygccxml/pdb_reader/scanner.py =================================================================== --- pygccxml_dev/pygccxml/pdb_reader/scanner.py 2008-02-25 20:47:57 UTC (rev 1262) +++ pygccxml_dev/pygccxml/pdb_reader/scanner.py 2008-02-26 20:38:16 UTC (rev 1263) @@ -5,7 +5,7 @@ import logging import comtypes import comtypes.client -from msdia_details import msdia +from msvc_details import msdia sys.path.append( r'../..' ) #sys.path.append( r'C:\dev\language-binding\pygccxml_dev' ) Modified: pygccxml_dev/pygccxml/utils/__init__.py =================================================================== --- pygccxml_dev/pygccxml/utils/__init__.py 2008-02-25 20:47:57 UTC (rev 1262) +++ pygccxml_dev/pygccxml/utils/__init__.py 2008-02-26 20:38:16 UTC (rev 1263) @@ -17,7 +17,8 @@ """implementation details""" logger = logging.getLogger(name) handler = logging.StreamHandler() - handler.setFormatter( logging.Formatter( os.linesep + '%(levelname)s %(message)s' ) ) + #handler.setFormatter( logging.Formatter( os.linesep + '%(levelname)s %(message)s' ) ) + handler.setFormatter( logging.Formatter( '%(levelname)s %(message)s' ) ) logger.addHandler(handler) logger.setLevel(logging.INFO) return logger This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |