Ejemplo n.º 1
0
	def testDetailsAccessors(self):
		pi = PluginInfo("mouf","/bla/mouf")
		details = ConfigParser()
		details.add_section("Core")
		details.set("Core","Name","hop")
		details.set("Core","Module","/greuh")
		details.add_section("Documentation")
		details.set("Documentation","Author","me")
		pi.details = details
		# Beware this is not so obvious: the plugin info still points
		# (and possibly modifies) the same instance of ConfigParser
		self.assertEqual(details,pi.details)
		# also the name and path are kept to their original value when
		# the details is set in one go.
		self.assertEqual("mouf",pi.name)
		self.assertEqual("/bla/mouf",pi.path)
		# check that some other info do change...
		self.assertEqual("me",pi.author)
Ejemplo n.º 2
0
	def testDetailsAccessors(self):
		pi = PluginInfo("mouf","/bla/mouf")
		details = ConfigParser()
		details.add_section("Core")
		details.set("Core","Name","hop")
		details.set("Core","Module","/greuh")
		details.add_section("Documentation")
		details.set("Documentation","Author","me")
		pi.details = details
		# Beware this is not so obvious: the plugin info still points
		# (and possibly modifies) the same instance of ConfigParser
		self.assertEqual(details,pi.details)
		# also the name and path are kept to their original value when
		# the details is set in one go.
		self.assertEqual("mouf",pi.name)
		self.assertEqual("/bla/mouf",pi.path)
		# check that some other info do change...
		self.assertEqual("me",pi.author)
    def getInfosDictFromPlugin(self, dirpath, filename):
        """
		Returns the extracted plugin informations as a dictionary.
		This function ensures that "name" and "path" are provided.
		"""
        # use the filename alone to extract minimal informations.
        infos = {}
        module_name = os.path.splitext(filename)[0]
        plugin_filename = os.path.join(dirpath, filename)
        if module_name == "__init__":
            module_name = os.path.basename(dirpath)
            plugin_filename = dirpath
        infos["name"] = "%s" % module_name
        infos["path"] = plugin_filename
        cf_parser = ConfigParser()
        cf_parser.add_section("Core")
        cf_parser.set("Core", "Name", infos["name"])
        cf_parser.set("Core", "Module", infos["path"])
        return infos, cf_parser
Ejemplo n.º 4
0
	def getInfosDictFromPlugin(self, dirpath, filename):
		"""
		Returns the extracted plugin informations as a dictionary.
		This function ensures that "name" and "path" are provided.
		"""
		# use the filename alone to extract minimal informations.
		infos = {}
		module_name = os.path.splitext(filename)[0]
		plugin_filename = os.path.join(dirpath,filename)
		if module_name == "__init__":
			module_name = os.path.basename(dirpath)
			plugin_filename = dirpath
		infos["name"] = "%s" % module_name
		infos["path"] = plugin_filename
		cf_parser = ConfigParser()
		cf_parser.add_section("Core")
		cf_parser.set("Core","Name",infos["name"])
		cf_parser.set("Core","Module",infos["path"])
		return infos,cf_parser