Beispiel #1
0
    def saveModuleDictionaryToDisk(self, _strPath):
        """
        This method saves the module dictionary to disk in form of XML.
        This method should be private but is kept public in order to be unit tested.

        @param _strPath: Path to the module dictionary XML file
        @type _strPath: python string
        """
        xsDataDictionaryPlugin = XSDataDictionary()
        strEdnaHome = EDUtilsPath.EDNA_HOME
        for strModule in self.__dictModuleLocation:
            xsDataKeyValuePair = XSDataKeyValuePair()
            xsDataKeyValuePair.setKey(XSDataString(strModule))
            strModuleLocation = self.__dictModuleLocation[strModule]
            # Remove the path up to $EDNA_HOME
            strModuleLocationStripped = strModuleLocation.replace(
                strEdnaHome, "")
            if (strModuleLocationStripped.startswith("/")
                    or strModuleLocationStripped.startswith("\\")):
                strModuleLocationStripped = strModuleLocationStripped[1:]
            xsDataKeyValuePair.setValue(
                XSDataString(strModuleLocationStripped))
            xsDataDictionaryPlugin.addKeyValuePair(xsDataKeyValuePair)
        try:
            xsDataDictionaryPlugin.exportToFile(_strPath)
        except Exception:
            self.warning("The module cache could not be written to disk.")
    def saveModuleDictionaryToDisk(self, _strPath):
        """
        This method saves the module dictionary to disk in form of XML.
        This method should be private but is kept public in order to be unit tested.

        @param _strPath: Path to the module dictionary XML file
        @type _strPath: python string
        """
        xsDataDictionaryPlugin = XSDataDictionary()
        strEdnaHome = EDUtilsPath.EDNA_HOME
        for strModule in self.__dictModuleLocation:
            xsDataKeyValuePair = XSDataKeyValuePair()
            xsDataKeyValuePair.setKey(XSDataString(strModule))
            strModuleLocation = self.__dictModuleLocation[ strModule ]
            # Remove the path up to $EDNA_HOME
            strModuleLocationStripped = strModuleLocation.replace(strEdnaHome, "")
            if (strModuleLocationStripped.startswith("/") or  strModuleLocationStripped.startswith("\\")):
                strModuleLocationStripped = strModuleLocationStripped[1:]
            xsDataKeyValuePair.setValue(XSDataString(strModuleLocationStripped))
            xsDataDictionaryPlugin.addKeyValuePair(xsDataKeyValuePair)
        try:
            xsDataDictionaryPlugin.exportToFile(_strPath)
        except:
            self.warning("The module cache could not be written to disk.")