def outputPackage(self, Package): self._outputDict.clear() outputDict = self._outputDict outputDict['name'] = Package.getName() outputDict['routines'] = [x for x in Package.getAllRoutines().iterkeys()] outputDict['non_fileman_globals'] = [] outputDict['fileman_globals'] = [] for globalVar in Package.getAllGlobals().itervalues(): globalName = globalVar.getName() if globalVar.isFileManFile(): fileNo = globalVar.getFileNo() fileName = globalVar.getFileManName() outputDict['fileman_globals'].append(dict({'name': globalName, 'file_no': fileNo, 'file_name': fileName})) else: outputDict['non_fileman_globals'].append(globalName) outputDict['original_name'] = Package.getOriginalName() outputDict['namespace'] = Package.getNamespaces() outputDict['globalspace'] = Package.getGlobalNamespace() outputDict['docLink'] = Package.getDocLink() outputDict['mirrorLink'] = Package.getDocMirrorLink() outputDict['dependency'] = self.__outputDependency__(Package) outputDict['dependent'] = self.__outputDependent__(Package) return json.dumps(outputDict)
def outputPackage(self, Package): self._outputDict.clear() outputDict = self._outputDict outputDict['name'] = Package.getName() outputDict['routines'] = [ x for x in Package.getAllRoutines().iterkeys() ] outputDict['non_fileman_globals'] = [] outputDict['fileman_globals'] = [] for globalVar in Package.getAllGlobals().itervalues(): globalName = globalVar.getName() if globalVar.isFileManFile(): fileNo = globalVar.getFileNo() fileName = globalVar.getFileManName() outputDict['fileman_globals'].append( dict({ 'name': globalName, 'file_no': fileNo, 'file_name': fileName })) else: outputDict['non_fileman_globals'].append(globalName) outputDict['original_name'] = Package.getOriginalName() outputDict['namespace'] = Package.getNamespaces() outputDict['globalspace'] = Package.getGlobalNamespace() outputDict['docLink'] = Package.getDocLink() outputDict['mirrorLink'] = Package.getDocMirrorLink() outputDict['dependency'] = self.__outputDependency__(Package) outputDict['dependent'] = self.__outputDependent__(Package) return json.dumps(outputDict)
def __outputIndividualPackage__(self, outDir, Package): logger.info("Writing Package %s" % Package) outputFile = open( os.path.join( outDir, "Package_%s.json" % (Package.getName().replace(' ', '_').replace('-', '_'))), 'wb') outputFile.write(self._packageEncoder.outputPackage(Package)) outputFile.write("\n") outputFile.close()
def __handleAllGlobals__(self, Package, PackageJson): crossRef = self._crossRef for globalName in PackageJson['non_fileman_globals']: crossRef.addGlobalToPackageByName(globalName, Package.getName()) packageName = PackageJson["name"] package = crossRef.getPackageByName(packageName) for fileManGlobalDict in PackageJson['fileman_globals']: globalName = fileManGlobalDict['name'] fileNo = fileManGlobalDict['file_no'] fileName = fileManGlobalDict['file_name'] GlobalVar = Global(globalName, fileNo, fileName, package) crossRef.addGlobalToPackage(GlobalVar, packageName)
def __handleAllRoutines__(self, Package, PackageJson): assert "routines" in PackageJson crossRef = self._crossRef for routineName in PackageJson['routines']: crossRef.addRoutineToPackageByName(routineName, Package.getName())
def __outputIndividualPackage__(self, outDir, Package): logger.info("Writing Package %s" % Package) outputFile = open(os.path.join(outDir,"Package_%s.json" % (Package.getName().replace(' ','_').replace('-','_'))),'wb') outputFile.write(self._packageEncoder.outputPackage(Package)) outputFile.write("\n") outputFile.close()