Example #1
0
 def __initModuleDictionary(self):
     """
     This private method initialises the dictionary with all plugins. If the path to
     the dictionary cache file exists the plugins are loaded, otherwise
     the plugin root directories are searched and the dictionary is
     written to the cache file.
     """
     if (os.path.exists(EDUtilsPath.getEdnaPluginCachePath())):
         self.loadModuleDictionaryFromDisk(EDUtilsPath.getEdnaPluginCachePath())
     else:
         self.__searchRootDirectories()
         self.saveModuleDictionaryToDisk(EDUtilsPath.getEdnaPluginCachePath())
Example #2
0
 def __initModuleDictionary(self):
     """
     This private method initialises the dictionary with all plugins. If the path to
     the dictionary cache file exists the plugins are loaded, otherwise
     the plugin root directories are searched and the dictionary is
     written to the cache file.
     """
     if (os.path.exists(EDUtilsPath.getEdnaPluginCachePath())):
         self.loadModuleDictionaryFromDisk(EDUtilsPath.getEdnaPluginCachePath())
     else:
         self.__searchRootDirectories()
         self.saveModuleDictionaryToDisk(EDUtilsPath.getEdnaPluginCachePath())
Example #3
0
    def getModuleLocation(self, _strModuleName):
        """
        This method returns the location of a module, e.g. XSDataCommon.

        @param _strModuleName: Name of the module
        @type _strModuleName: python string

        @return: Path to the module location
        @type: python string
        """
        strModuleLocation = None
        if (self.__dictModuleLocation is None):
            with self.locked():
                if self.__dictModuleLocation is None:
                    self.__initModuleDictionary()
        if (_strModuleName in self.__dictModuleLocation):
            strModuleLocation = self.__dictModuleLocation[_strModuleName]
            strDirectoryIgnored = self.checkDirectoriesForIgnoreFile(
                strModuleLocation)
            if strDirectoryIgnored:
                self.warning(
                    "Module location %s ignored because directory %s contains %s"
                    %
                    (strModuleLocation, strDirectoryIgnored, self.IGNORE_FILE))
                self.__searchRootDirectories()
                self.saveModuleDictionaryToDisk(
                    EDUtilsPath.getEdnaPluginCachePath())
                strModuleLocation = None
        else:
            with self.locked():
                # The module was not found - force reloading of all plugins
                self.warning(
                    "Module %s not found, forcing reloading of all modules..."
                    % _strModuleName)
                self.__searchRootDirectories()
                # Save the new dictionary in any case - even if the plugin might not be found.
                self.saveModuleDictionaryToDisk(
                    EDUtilsPath.getEdnaPluginCachePath())
                if (_strModuleName in self.__dictModuleLocation.keys()):
                    strModuleLocation = self.__dictModuleLocation[
                        _strModuleName]
                    # Fix for bug #395 - update the saved cache
                    self.DEBUG(
                        "EDFactoryPlugin.loadModule: Updating the module cache file %s"
                        % EDUtilsPath.getEdnaPluginCachePath())
                else:
                    self.DEBUG(
                        "EDFactoryPlugin.loadModule: module %s not found after forced reload of all modules."
                        % _strModuleName)
        return strModuleLocation
Example #4
0
    def getModuleLocation(self, _strModuleName):
        """
        This method returns the location of a module, e.g. XSDataCommon.

        @param _strModuleName: Name of the module
        @type _strModuleName: python string

        @return: Path to the module location
        @type: python string
        """
        strModuleLocation = None
        if (self.__dictModuleLocation is None):
            with self.locked():
                if self.__dictModuleLocation is None:
                    self.__initModuleDictionary()
        if (_strModuleName in self.__dictModuleLocation):
            strModuleLocation = self.__dictModuleLocation[ _strModuleName ]
            strDirectoryIgnored = self.checkDirectoriesForIgnoreFile(strModuleLocation)
            if strDirectoryIgnored:
                self.warning("Module location %s ignored because directory %s contains %s" % (strModuleLocation, strDirectoryIgnored, self.IGNORE_FILE))
                self.__searchRootDirectories()
                self.saveModuleDictionaryToDisk(EDUtilsPath.getEdnaPluginCachePath())
                strModuleLocation = None
        else:
            with self.locked():
                # The module was not found - force reloading of all plugins
                self.warning("Module %s not found, forcing reloading of all modules..." % _strModuleName)
                self.__searchRootDirectories()
                # Save the new dictionary in any case - even if the plugin might not be found.
                self.saveModuleDictionaryToDisk(EDUtilsPath.getEdnaPluginCachePath())
                if (_strModuleName in self.__dictModuleLocation.keys()):
                    strModuleLocation = self.__dictModuleLocation[ _strModuleName ]
                    # Fix for bug #395 - update the saved cache
                    self.DEBUG("EDFactoryPlugin.loadModule: Updating the module cache file %s" % EDUtilsPath.getEdnaPluginCachePath())
                else:
                    self.DEBUG("EDFactoryPlugin.loadModule: module %s not found after forced reload of all modules." % _strModuleName)
        return strModuleLocation