def process_files(self): total_warnings = 0 file_extension = '_rflx.cpp' #----------Loop oover all the input files-------------- for source in self.files: path, fullname = os.path.split(source) name = fullname[:fullname.find('.')] xmlfile = os.path.join(self.outputDir, name + '.xml') if (self.outputFile): dicfile = os.path.join(self.outputDir, self.outputFile) else: dicfile = os.path.join(self.outputDir, name + file_extension) #---------------Parse the header file with GCC_XML cmd = '%s %s "%s" -fxml=%s %s -D__REFLEX__' % ( self.gccxml, self.gccxmlopt, source, xmlfile, self.cppopt) if 'debug' in self.opts: print '--->> genreflex: INFO: invoking ', cmd if not self.quiet: print '--->> genreflex: INFO: Parsing file %s with GCC_XML' % source, status = os.system(cmd) if status: print '\n--->> genreflex: ERROR: processing file with gccxml. genreflex command failed.' sys.exit(1) else: if not self.quiet: print 'OK' gccxmlinfo = self.genGccxmlInfo() #---------------Generate the dictionary--------------- if not self.quiet: print '--->> genreflex: INFO: Generating Reflex Dictionary' dg = gendict.genDictionary(source, self.opts) dg.parse(xmlfile) classes = dg.selclasses(self.selector, self.deep) functions = dg.selfunctions(self.selector) enums = dg.selenums(self.selector) variables = dg.selvariables(self.selector) cnames, warnings, errors = dg.generate(dicfile, classes, functions, enums, variables, gccxmlinfo) total_warnings += warnings #------------Produce Seal Capabilities source file------ if self.capabilities: if os.path.isdir(self.capabilities): capfile = os.path.join(self.capabilities, 'capabilities.cpp') else: capfile = os.path.join(self.outputDir, self.capabilities) gencapa.genCapabilities(capfile, name, cnames) #------------Produce rootmap file----------------------- if self.rootmap: if os.path.isdir(self.rootmap): mapfile = os.path.join(self.rootmap, 'rootmap') else: mapfile = os.path.join(self.outputDir, self.rootmap) if not self.rootmaplib: self.rootmaplib = 'lib' + name + '.so' genrootmap.genRootMap(mapfile, name, self.rootmaplib, cnames, classes) #------------Report unused class selections in selection if self.selector: warnings += self.selector.reportUnusedClasses() #------------Delete intermediate files------------------ if 'debug' not in self.opts: os.remove(xmlfile) #------------Exit with status if warnings -------------- if warnings and self.opts.get('fail_on_warnings', False): print '--->> genreflex: ERROR: Exiting with error due to %d warnings ( --fail_on_warnings enabled )' % warnings sys.exit(1)
def process_files(self): total_errors = 0 total_warnings = 0 file_extension = '_rflx.cpp' #----------Loop oover all the input files-------------- for source in self.files: path, fullname = os.path.split(source) name = fullname[:fullname.find('.')] xmlfile = os.path.join(self.outputDir, name + '.xml') if (self.outputFile): dicfile = os.path.join(self.outputDir, self.outputFile) else: dicfile = os.path.join(self.outputDir, name + file_extension) #---------------Parse the header file with GCC_XML if sys.platform == 'win32': cmd = '"%s" %s "%s" -fxml=%s %s -D__REFLEX__' % ( self.gccxml, self.gccxmlopt, source, xmlfile, self.cppopt) else: cmd = '%s %s "%s" -fxml=%s %s -D__REFLEX__' % ( self.gccxml, self.gccxmlopt, source, xmlfile, self.cppopt) if 'debug' in self.opts: print '--->> genreflex: INFO: invoking ', cmd if not self.quiet: print '--->> genreflex: INFO: Parsing file %s with GCC_XML' % source, if sys.platform == 'win32': # bug http://bugs.python.org/issue1524: os.system fails if the # command is quoted and something else in the command is quoted. # Workaround: prepend "call ": cmd = "call " + cmd status = os.system(cmd) if status: print '\n--->> genreflex: ERROR: processing file with gccxml. genreflex command failed.' total_errors += 1 continue else: if not self.quiet: print 'OK' gccxmlinfo = self.genGccxmlInfo() #---------------Generate the dictionary--------------- if not self.quiet: print '--->> genreflex: INFO: Generating Reflex Dictionary' dg = gendict.genDictionary(source, self.opts, self.gccxmlvers) dg.parse(xmlfile) classes = dg.selclasses(self.selector, self.deep) functions = dg.selfunctions(self.selector) enums = dg.selenums(self.selector) variables = dg.selvariables(self.selector) if self.selector: cnames, warnings, errors = dg.generate( dicfile, classes, functions, enums, variables, gccxmlinfo, self.selector.io_read_rules, self.selector.io_readraw_rules) else: cnames, warnings, errors = dg.generate(dicfile, classes, functions, enums, variables, gccxmlinfo) if errors or (warnings and self.opts.get('fail_on_warnings', False)): os.remove(dicfile) total_errors += errors total_warnings += warnings #------------Produce Seal Capabilities source file------ if self.capabilities: if os.path.isdir(self.capabilities): capfile = os.path.join(self.capabilities, 'capabilities.cpp') else: capfile = os.path.join(self.outputDir, self.capabilities) gencapa.genCapabilities(capfile, name, cnames) #------------Produce rootmap file----------------------- if self.rootmap: if os.path.isdir(self.rootmap): mapfile = os.path.join(self.rootmap, 'rootmap') else: mapfile = os.path.join(self.outputDir, self.rootmap) if not self.rootmaplib: self.rootmaplib = 'lib' + name + '.so' cnames += [td['fullname'] for td in dg.typedefs_for_usr] classes += dg.typedefs_for_usr genrootmap.genRootMap(mapfile, name, self.rootmaplib, cnames, classes) #------------Delete intermediate files------------------ if 'debug' not in self.opts: os.remove(xmlfile) #------------Report unused class selections in selection if self.selector: total_warnings += self.selector.reportUnusedClasses() #------------Exit with status if errors ---------------- if total_errors: sys.exit(1) #------------Exit with status if warnings -------------- if total_warnings and self.opts.get('fail_on_warnings', False): print '--->> genreflex: ERROR: Exiting with error due to %d warnings ( --fail_on_warnings enabled )' % total_warnings sys.exit(1)
def process_files(self): total_errors = 0 total_warnings = 0 file_extension = '_rflx.cpp' #----------Loop oover all the input files-------------- gccxmlinfo = self.genGccxmlInfo() for source in self.files : path, fullname = os.path.split(source) name = fullname[:fullname.find('.')] xmlfile = os.path.join(self.outputDir,name+'_gccxmlout.xml') if( self.outputFile ) : dicfile = os.path.join(self.outputDir,self.outputFile) else : dicfile = os.path.join(self.outputDir,name+file_extension) if self.gccxmlpost == '' : #---------------Parse the header file with GCC_XML if sys.platform == 'win32' : cmd = '"%s" %s "%s" -fxml=%s %s -D__REFLEX__' %(self.gccxml, self.gccxmlopt, source, xmlfile, self.cppopt) else : cmd = '%s %s "%s" -fxml=%s %s -D__REFLEX__' %(self.gccxml, self.gccxmlopt, source, xmlfile, self.cppopt) if 'debug' in self.opts : print '--->> genreflex: INFO: invoking ', cmd if not self.quiet : print '--->> genreflex: INFO: Parsing file %s with GCC_XML' % source, if sys.platform == 'win32' : # bug http://bugs.python.org/issue1524: os.system fails if the # command is quoted and something else in the command is quoted. # Workaround: prepend "call ": cmd = "call " + cmd status = os.system(cmd) if status : print '\n--->> genreflex: ERROR: processing file with gccxml. genreflex command failed.' total_errors += 1 continue else: if not self.quiet : print 'OK' else: if not self.quiet : print '--->> genreflex: INFO: Postprocessing GCC_XML output file', self.gccxmlpost xmlfile = self.gccxmlpost #---------------Generate the dictionary--------------- if not self.quiet : print '--->> genreflex: INFO: Generating Reflex Dictionary' dg = gendict.genDictionary(source, self.opts, self.gccxmlvers) dg.parse(xmlfile) classes = dg.selclasses(self.selector, self.deep) functions = dg.selfunctions(self.selector) enums = dg.selenums(self.selector) variables = dg.selvariables(self.selector) if self.selector : cnames, warnings, errors = dg.generate(dicfile, classes, functions, enums, variables, gccxmlinfo, self.selector.io_read_rules, self.selector.io_readraw_rules ) else : cnames, warnings, errors = dg.generate(dicfile, classes, functions, enums, variables, gccxmlinfo) if errors or (warnings and self.opts.get('fail_on_warnings', False)): os.remove(dicfile) total_errors += errors total_warnings += warnings #------------Produce Seal Capabilities source file------ if self.capabilities : if os.path.isdir(self.capabilities) : capfile = os.path.join(self.capabilities, 'capabilities.cpp') else : capfile = os.path.join(self.outputDir, self.capabilities) gencapa.genCapabilities(capfile, name, cnames) #------------Produce rootmap file----------------------- if self.rootmap : if os.path.isdir(self.rootmap) : mapfile = os.path.join(self.rootmap, 'rootmap') else : mapfile = os.path.join(self.outputDir, self.rootmap) if not self.rootmaplib : self.rootmaplib = 'lib'+name+'.so' for td in dg.typedefs_for_usr: # Autoload entries are classes by default. Only include non-free typedefs # such that CINT gets notified that they are not classes when their enclosed # scope's dictionary is set up. # Scoped names have name != fullname; ensure that the typedef's scope is # part of the dictionary, too. if td['fullname'] != td['name'] \ and len(td['fullname']) > 3 \ and td['fullname'][0:-len(td['name']) - 2] in cnames: cnames += [ td['fullname'] ] classes+= dg.typedefs_for_usr genrootmap.genRootMap(mapfile, name, self.rootmaplib, cnames, classes) #------------Delete intermediate files------------------ if 'debug' not in self.opts and self.gccxmlpost == '': os.remove(xmlfile) #------------Report unused class selections in selection if self.selector : total_warnings += self.selector.reportUnusedClasses() #------------Exit with status if errors ---------------- if total_errors: sys.exit(1) #------------Exit with status if warnings -------------- if total_warnings and self.opts.get('fail_on_warnings',False) : print '--->> genreflex: ERROR: Exiting with error due to %d warnings ( --fail_on_warnings enabled )' % total_warnings sys.exit(1)
def process_files(self): total_errors = 0 total_warnings = 0 file_extension = '_rflx.cpp' #----------Loop oover all the input files-------------- gccxmlinfo = self.genGccxmlInfo() for source in self.files: path, fullname = os.path.split(source) name = fullname[:fullname.find('.')] xmlfile = os.path.join(self.outputDir, name + '_gccxmlout.xml') if (self.outputFile): dicfile = os.path.join(self.outputDir, self.outputFile) else: dicfile = os.path.join(self.outputDir, name + file_extension) if self.gccxmlpost == '': #---------------Parse the header file with GCC_XML if sys.platform == 'win32': cmd = '"%s" %s "%s" -fxml=%s %s -D__REFLEX__' % ( self.gccxml, self.gccxmlopt, source, xmlfile, self.cppopt) else: cmd = '%s %s "%s" -fxml=%s %s -D__REFLEX__' % ( self.gccxml, self.gccxmlopt, source, xmlfile, self.cppopt) if 'debug' in self.opts: print '--->> genreflex: INFO: invoking ', cmd if not self.quiet: print '--->> genreflex: INFO: Parsing file %s with GCC_XML' % source, if sys.platform == 'win32': # bug http://bugs.python.org/issue1524: os.system fails if the # command is quoted and something else in the command is quoted. # Workaround: prepend "call ": cmd = "call " + cmd status = os.system(cmd) if status: print '\n--->> genreflex: ERROR: processing file with gccxml. genreflex command failed.' total_errors += 1 continue else: if not self.quiet: print 'OK' else: if not self.quiet: print '--->> genreflex: INFO: Postprocessing GCC_XML output file', self.gccxmlpost xmlfile = self.gccxmlpost #---------------Generate the dictionary--------------- if not self.quiet: print '--->> genreflex: INFO: Generating Reflex Dictionary' dg = gendict.genDictionary(source, self.opts, self.gccxmlvers) dg.parse(xmlfile) classes = dg.selclasses(self.selector, self.deep) functions = dg.selfunctions(self.selector) enums = dg.selenums(self.selector) variables = dg.selvariables(self.selector) try: if self.selector: cnames, warnings, errors = dg.generate( dicfile, classes, functions, enums, variables, gccxmlinfo, self.selector.io_read_rules, self.selector.io_readraw_rules) else: cnames, warnings, errors = dg.generate( dicfile, classes, functions, enums, variables, gccxmlinfo) if errors or (warnings and self.opts.get('fail_on_warnings', False)): os.remove(dicfile) except: # remove output file even if evil things happened os.remove(dicfile) raise total_errors += errors total_warnings += warnings #------------Produce Seal Capabilities source file------ if self.capabilities: if os.path.isdir(self.capabilities): capfile = os.path.join(self.capabilities, 'capabilities.cpp') else: capfile = os.path.join(self.outputDir, self.capabilities) gencapa.genCapabilities(capfile, name, cnames) #------------Produce rootmap file----------------------- if self.rootmap: if os.path.isdir(self.rootmap): mapfile = os.path.join(self.rootmap, 'rootmap') else: mapfile = os.path.join(self.outputDir, self.rootmap) if not self.rootmaplib: self.rootmaplib = 'lib' + name + '.so' for td in dg.typedefs_for_usr: # Autoload entries are classes by default. Only include non-free typedefs # such that CINT gets notified that they are not classes when their enclosed # scope's dictionary is set up. # Scoped names have name != fullname; ensure that the typedef's scope is # part of the dictionary, too. if td['fullname'] != td['name'] \ and len(td['fullname']) > 3 \ and td['fullname'][0:-len(td['name']) - 2] in cnames: cnames += [td['fullname']] classes += dg.typedefs_for_usr genrootmap.genRootMap(mapfile, name, self.rootmaplib, cnames, classes) #------------Delete intermediate files------------------ if 'debug' not in self.opts and self.gccxmlpost == '': os.remove(xmlfile) #------------Report unused class selections in selection if self.selector: total_warnings += self.selector.reportUnusedClasses() #------------Exit with status if errors ---------------- if total_errors: sys.exit(1) #------------Exit with status if warnings -------------- if total_warnings and self.opts.get('fail_on_warnings', False): os.remove(dicfile) print '--->> genreflex: ERROR: Exiting with error due to %d warnings ( --fail_on_warnings enabled )' % total_warnings sys.exit(1)