def upgrade(self, dependency, upgraded): #print "Upgrading from ",dependency,"to",upgraded packageXML= bDOM.link(self.__path) dependencyList= bDOM.findTagByPath(packageXML, "dependencies") if dependencyList: for dep in dependencyList.getElementsByTagName("dependency"): location= bDOM.extractTextFromTagContents(dep) depID= bID.ID(location) if depID.equals(dependency): bDOM.changeTagContents(packageXML, dep, upgraded.filename()) break packageFile= open(self.__path, 'w') packageXML.writexml(packageFile) packageFile.close() packageXML.unlink()
def upgrade(self, dependency, upgraded): #print "Upgrading from ",dependency,"to",upgraded packageXML = bDOM.link(self.__path) dependencyList = bDOM.findTagByPath(packageXML, "dependencies") if dependencyList: for dep in dependencyList.getElementsByTagName("dependency"): location = bDOM.extractTextFromTagContents(dep) depID = bID.ID(location) if depID.equals(dependency): bDOM.changeTagContents(packageXML, dep, upgraded.filename()) break packageFile = open(self.__path, 'w') packageXML.writexml(packageFile) packageFile.close() packageXML.unlink()
def addPrevious(self, identifier): packageXML= bDOM.link(self.__path) previousList= bDOM.findTagByPath(packageXML, "previous") if not previousList: previousList= packageXML.createElement('previous') previousList.appendChild(packageXML.createTextNode("\n\t")) packageXML.documentElement.appendChild(packageXML.createTextNode("\t")) packageXML.documentElement.appendChild(previousList) packageXML.documentElement.appendChild(packageXML.createTextNode("\n")) nextVersion= packageXML.createElement('version') versionText= packageXML.createTextNode(identifier.filename()) nextVersion.appendChild(versionText) previousList.appendChild(packageXML.createTextNode("\t")) previousList.appendChild(nextVersion) previousList.appendChild(packageXML.createTextNode("\n\t")) packageFile= open(self.__path, 'w') packageXML.writexml(packageFile) packageFile.close() packageXML.unlink()
def addPrevious(self, identifier): packageXML = bDOM.link(self.__path) previousList = bDOM.findTagByPath(packageXML, "previous") if not previousList: previousList = packageXML.createElement('previous') previousList.appendChild(packageXML.createTextNode("\n\t")) packageXML.documentElement.appendChild( packageXML.createTextNode("\t")) packageXML.documentElement.appendChild(previousList) packageXML.documentElement.appendChild( packageXML.createTextNode("\n")) nextVersion = packageXML.createElement('version') versionText = packageXML.createTextNode(identifier.filename()) nextVersion.appendChild(versionText) previousList.appendChild(packageXML.createTextNode("\t")) previousList.appendChild(nextVersion) previousList.appendChild(packageXML.createTextNode("\n\t")) packageFile = open(self.__path, 'w') packageXML.writexml(packageFile) packageFile.close() packageXML.unlink()
def parseXMLListOfExports(xml, pathToList, itemName, itemList, warningList): itemXMLList= bDOM.findTagByPath(xml, pathToList) if itemXMLList: for export in itemXMLList.getElementsByTagName(itemName): location= bDOM.extractTextFromTagContents(export) itemList.append(bID.ID(location))
def parseXMLListOfExports(xml, pathToList, itemName, itemList, warningList): itemXMLList = bDOM.findTagByPath(xml, pathToList) if itemXMLList: for export in itemXMLList.getElementsByTagName(itemName): location = bDOM.extractTextFromTagContents(export) itemList.append(bID.ID(location))