Move some methods from ModulePool to Action

parent fefa6e77
......@@ -24,6 +24,8 @@
import sys
import logging
from hdlmake import new_dep_solver as dep_solver
class Action(object):
"""This is the base class providing the common Action methods"""
......@@ -65,3 +67,39 @@ class Action(object):
"Variable %s must be set in the manifest and equal to '%s'.",
name, value)
sys.exit("Exiting")
def build_complete_file_set(self):
"""Build file set with all the files listed in the complete pool"""
logging.debug("Begin build complete file set")
from hdlmake.srcfile import SourceFileSet
all_manifested_files = SourceFileSet()
for module in self:
all_manifested_files.add(module.files)
logging.debug("End build complete file set")
return all_manifested_files
def build_file_set(self, top_entity=None):
"""Build file set with only those files required by the top entity"""
logging.debug("Begin build file set for %s", top_entity)
all_files = self.build_complete_file_set()
if not self._deps_solved:
dep_solver.solve(all_files)
self._deps_solved = True
from hdlmake.srcfile import SourceFileSet
source_files = SourceFileSet()
source_files.add(dep_solver.make_dependency_set(all_files, top_entity))
logging.debug("End build file set")
return source_files
def get_top_module(self):
"""Get the Top module from the pool"""
return self.top_module
def is_everything_fetched(self):
"""Check if every module is already fetched"""
if len([m for m in self if not m.isfetched]) == 0:
return True
else:
return False
......@@ -30,7 +30,6 @@ import platform
from subprocess import PIPE, Popen
import sys
from . import new_dep_solver as dep_solver
from .util import path as path_mod
from . import fetch
from .env import Env
......@@ -190,36 +189,3 @@ class ModulePool(list, ActionCheck, ActionCore,
logging.debug("NOT appended to fetch queue: "
+ str(mod.url))
def build_complete_file_set(self):
"""Build file set with all the files listed in the complete pool"""
logging.debug("Begin build complete file set")
from .srcfile import SourceFileSet
all_manifested_files = SourceFileSet()
for module in self:
all_manifested_files.add(module.files)
logging.debug("End build complete file set")
return all_manifested_files
def build_file_set(self, top_entity=None):
"""Build file set with only those files required by the top entity"""
logging.debug("Begin build file set for %s", top_entity)
all_files = self.build_complete_file_set()
if not self._deps_solved:
dep_solver.solve(all_files)
self._deps_solved = True
from hdlmake.srcfile import SourceFileSet
source_files = SourceFileSet()
source_files.add(dep_solver.make_dependency_set(all_files, top_entity))
logging.debug("End build file set")
return source_files
def get_top_module(self):
"""Get the Top module from the pool"""
return self.top_module
def is_everything_fetched(self):
"""Check if every module is already fetched"""
if len([m for m in self if not m.isfetched]) == 0:
return True
else:
return False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment