Esempio n. 1
0
	def load_json_from_wiki(self, wikipage, default = {}):
		page = self.dw.getpage(wikipage)
		doc = wikiutils.strip_code_sections(page)
		data = '\n'.join(doc)
		try:
			return json.loads(data)
		except ValueError as e:
			logging.warning("Unable to read json data from page %s. No valid JSON!" % wikipage)
		return default
Esempio n. 2
0
 def load_json_from_wiki(self, wikipage, default={}):
     page = self.dw.getpage(wikipage)
     doc = wikiutils.strip_code_sections(page)
     data = '\n'.join(doc)
     try:
         return json.loads(data)
     except ValueError as e:
         logging.warning(
             "Unable to read json data from page %s. No valid JSON!" %
             wikipage)
     return default
    def initialize(self, dw, licenses, partners, pub):
        if self.metapage is None:
            logging.info("No meta page available for SE %s" % self.get_name())
            return

        meta = dw.getpage(self.metapage)
        if meta is None:
            return

        metadata = wikiutils.strip_code_sections(meta)
        metajson = "\n".join(metadata)

        self.set_metajson(metajson)

        try:
            se_spec = json.loads(metajson)
        except ValueError as e:
            logging.warning("Unable to read meta data from page %s. No valid JSON!\n%s" % (self.metapage, e))
            return

        schema = None
        with open("se-meta-schema.json", "r") as schema_file:
            schema = json.load(schema_file)

        if schema is None:
            logging.warning("Could not validate json schema due to missing schema file")
            return

        try:
            validate(se_spec, schema)
        except ValidationError as e:
            logging.warning("Invalid meta data for SE at %s.\n%s" % (self.metapage, e))
            return
        except SchemaError as e:
            logging.warning("Could not validate json schema due to an invalid json schema.\n%s" % e)
            return

        self.set_metaspec(se_spec)

        self.setup_naming_conventions(dw)

        self.fill_license(licenses)
        self.fill_contacts(partners)
        self.fill_auto_values(dw, pub)
        self.fill_nice_owners(partners)
        self.resolve_wiki_references(dw, pub)

        self.set_valid()
	def load(dw, meta_page, partners, licenses, pub, skipchecks = []):
		ms = MetaStructure()
		
		logging.info("Loading page of meta structure %s ..." % meta_page)
		page = dw.getpage(meta_page)
		if page is None:
			return None
		doc = wikiutils.strip_code_sections(page)
		metadoc = '\n'.join(doc)

		meta_adapter = MetaAdapter(partners)
		
		mp = MetaProcessor(meta_adapter)
		
		logging.info("Parsing meta structure ...")
		meta_ast = mp.process(metadoc)
		if meta_ast is None:
			return None
		logging.info("Finished parsing.")
		
		ms.set_ast(meta_ast, meta_adapter)

		logging.info("Processing meta structure ...")

		ms.extract_basic_entities()
		
		logging.info("Extract Specific Enablers")
		ms.extract_ses(dw, partners, licenses, pub, skipchecks)
		
		logging.info("Extract applications")
		ms.extract_apps(partners)
		
		logging.info("Extract experiments")
		ms.extract_experiments(partners)

		logging.info("Extract releases")
		ms.extract_releases()

		logging.info("Meta structure successfully loaded.")
		
		return ms
Esempio n. 5
0
	def load(dw, meta_page, partners, licenses, pub, skipchecks = []):
		ms = MetaStructure()
		
		logging.info("Loading page of meta structure %s ..." % meta_page)
		page = dw.getpage(meta_page)
		if page is None:
			return None
		doc = wikiutils.strip_code_sections(page)
		metadoc = '\n'.join(doc)

		meta_adapter = MetaAdapter(partners)
		
		mp = MetaProcessor(meta_adapter)
		
		logging.info("Parsing meta structure ...")
		meta_ast = mp.process(metadoc)
		if meta_ast is None:
			return None
		logging.info("Finished parsing.")
		
		ms.set_ast(meta_ast, meta_adapter)

		logging.info("Processing meta structure ...")

		ms.extract_basic_entities()
		
		logging.info("Extract Specific Enablers")
		ms.extract_ses(dw, partners, licenses, pub, skipchecks)
		
		logging.info("Extract applications")
		ms.extract_apps(partners)
		
		logging.info("Extract experiments")
		ms.extract_experiments(partners)

		logging.info("Extract releases")
		ms.extract_releases()

		logging.info("Meta structure successfully loaded.")
		
		return ms
Esempio n. 6
0
	def load_code_from_wiki(self, wikipage):
		page = self.dw.getpage(wikipage)
		if page is None:
			return None
		doc = wikiutils.strip_code_sections(page)
		return '\n'.join(doc)
Esempio n. 7
0
 def load_code_from_wiki(self, wikipage):
     page = self.dw.getpage(wikipage)
     if page is None:
         return None
     doc = wikiutils.strip_code_sections(page)
     return '\n'.join(doc)