示例#1
0
    def new_module(self, parent, url, source, fetchto, process_manifest=True):
        """Add new module to the pool.

        This is the only way to add new modules to the pool. Thanks to it the pool can easily
        control its content
        """
        from module import Module
        self._deps_solved = False
        if source != fetch.LOCAL:
            clean_url, branch, revision = path_mod.url_parse(url)
        else:
            clean_url, branch, revision = url, None, None
        if url in [m.raw_url for m in self
                   ]:  # check if module is not already in the pool
            # same_url_mod = [m for m in self if m.raw_url == url][0]
            # if branch != same_url_mod.branch:
            #     logging.error("Requested the same module, but different branches."
            #                   "URL: %s\n" % clean_url +
            #                   "branches: %s and %s\n" % (branch, same_url_mod.branch))
            #     sys.exit("\nExiting")
            # if revision != same_url_mod.revision:
            #     logging.error("Requested the same module, but different revisions."
            #                   "URL: %s\n" % clean_url +
            #                   "revisions: %s (from %s)\n and \n%s (from %s)\n" % (revision,
            #                                                                       parent.path,
            #                                                                       same_url_mod.revision,
            #                                                                       same_url_mod.parent.path))
            #     sys.exit("\nExiting")
            return [m for m in self if m.raw_url == url][0]
        else:
            if self.global_fetch:  # if there is global fetch parameter (HDLMAKE_COREDIR env variable)
                fetchto = self.global_fetch  # screw module's particular fetchto

            new_module = Module(
                parent=parent,
                url=url,
                source=source,
                fetchto=fetchto,
                pool=self)
            self._add(new_module)
            if not self.top_module:
                global_mod.top_module = new_module
                self.top_module = new_module
                new_module.parse_manifest()
                if process_manifest is True:
                    new_module.process_manifest()
            return new_module
示例#2
0
    def new_module(self, parent, url, source, fetchto, process_manifest=True):
        """Add new module to the pool.

        This is the only way to add new modules to the pool. Thanks to it the pool can easily
        control its content
        """
        from module import Module
        self._deps_solved = False
        if source != fetch.LOCAL:
            clean_url, branch, revision = path_mod.url_parse(url)
        else:
            clean_url, branch, revision = url, None, None
        if url in [m.raw_url for m in self]:  # check if module is not already in the pool
            # same_url_mod = [m for m in self if m.raw_url == url][0]
            # if branch != same_url_mod.branch:
            #     logging.error("Requested the same module, but different branches."
            #                   "URL: %s\n" % clean_url +
            #                   "branches: %s and %s\n" % (branch, same_url_mod.branch))
            #     sys.exit("\nExiting")
            # if revision != same_url_mod.revision:
            #     logging.error("Requested the same module, but different revisions."
            #                   "URL: %s\n" % clean_url +
            #                   "revisions: %s (from %s)\n and \n%s (from %s)\n" % (revision,
            #                                                                       parent.path,
            #                                                                       same_url_mod.revision,
            #                                                                       same_url_mod.parent.path))
            #     sys.exit("\nExiting")
            return [m for m in self if m.raw_url == url][0]
        else:
            if self.global_fetch:            # if there is global fetch parameter (HDLMAKE_COREDIR env variable)
                fetchto = self.global_fetch  # screw module's particular fetchto

            new_module = Module(parent=parent,
                                url=url, source=source,
                                fetchto=fetchto,
                                pool=self)
            self._add(new_module)
            if not self.top_module:
                global_mod.top_module = new_module
                self.top_module = new_module
                new_module.parse_manifest()
                if process_manifest is True:
                    new_module.process_manifest()
            return new_module
示例#3
0
文件: module.py 项目: NickeZ/hdl-make
    def __init__(self, parent, url, source, fetchto, pool):
        assert url is not None
        assert source is not None

        self.manifest_dict = None
        self.fetchto = fetchto
        self.pool = pool
        self.source = source
        self.parent = parent
        self.isparsed = False
        self.isprocessed = False
        self.include_dirs = None
        self.library = "work"
        self.local = []
        self.git = []
        self.svn = []
        self.target = None
        self.action = None
        self.vmap_opt = None
        self.vlog_opt = None
        self.vcom_opt = None
        self.revision = None
        self.quartus_preflow = None
        self.quartus_postflow = None
        self._files = None
        self.manifest = None
        self.incl_makefiles = []
        self.force_tool = None
        self.syn_device = None
        self.syn_grade = None
        self.syn_package = None
        self.syn_project = None
        self.syn_top = None
        self.syn_tool = None
        self.syn_ise_version = None
        self.syn_pre_script = None
        self.syn_post_script = None
        self.sim_only_files = None
        self.sim_pre_script = None
        self.sim_post_script = None
        self.top_module = None
        self.commit_id = None

        self.raw_url = url
        if source != fetch.LOCAL:
            self.url, self.branch, self.revision = path_mod.url_parse(url)
        else:
            self.url, self.branch, self.revision = url, None, None

        if source == fetch.LOCAL and not os.path.exists(url):
            logging.error("Path to the local module doesn't exist:\n" + url
                          + "\nThis module was instantiated in: " + str(parent))
            quit()

        if source == fetch.LOCAL:
            self.path = url
            self.isfetched = True
        else:
            if os.path.exists(os.path.abspath(os.path.join(fetchto, self.basename))):
                self.path = os.path.abspath(os.path.join(fetchto, self.basename))
                self.isfetched = True
                logging.debug("Module %s (parent: %s) is fetched." % (url, parent.path))
            else:
                self.path = None
                self.isfetched = False
                logging.debug("Module %s (parent: %s) is NOT fetched." % (url, parent.path))

        self.manifest = None

        self.git_submodules = []
示例#4
0
    def __init__(self, parent, url, source, fetchto, pool):
        assert url is not None
        assert source is not None

        self.manifest_dict = None
        self.fetchto = fetchto
        self.pool = pool
        self.source = source
        self.parent = parent
        self.isparsed = False
        self.isprocessed = False
        self.include_dirs = None
        self.library = "work"
        self.local = []
        self.git = []
        self.svn = []
        self.target = None
        self.action = None
        self.vmap_opt = None
        self.vlog_opt = None
        self.vcom_opt = None
        self.revision = None
        self.quartus_preflow = None
        self.quartus_postmodule = None
        self.quartus_postflow = None
        self._files = None
        self.manifest = None
        self.incl_makefiles = []
        self.force_tool = None
        self.syn_device = None
        self.syn_grade = None
        self.syn_package = None
        self.syn_project = None
        self.syn_top = None
        self.syn_tool = None
        self.syn_ise_version = None
        self.syn_pre_script = None
        self.syn_post_script = None
        self.sim_only_files = None
        self.sim_pre_script = None
        self.sim_post_script = None
        self.top_module = None
        self.commit_id = None

        self.raw_url = url
        if source != fetch.LOCAL:
            self.url, self.branch, self.revision = path_mod.url_parse(url)
        else:
            self.url, self.branch, self.revision = url, None, None

        if source == fetch.LOCAL and not os.path.exists(url):
            logging.error("Path to the local module doesn't exist:\n" + url
                          + "\nThis module was instantiated in: " + str(parent))
            quit()

        if source == fetch.LOCAL:
            self.path = url
            self.isfetched = True
        else:
            if os.path.exists(os.path.abspath(os.path.join(fetchto, self.basename))) and os.listdir(os.path.abspath(os.path.join(fetchto, self.basename))):
                self.path = os.path.abspath(os.path.join(fetchto, self.basename))
                self.isfetched = True
                logging.debug("Module %s (parent: %s) is fetched." % (url, parent.path))
            else:
                self.path = None
                self.isfetched = False
                logging.debug("Module %s (parent: %s) is NOT fetched." % (url, parent.path))

        self.manifest = None

        self.git_submodules = []