Commit 4d202f7d authored by Tristan Gingold's avatar Tristan Gingold

refactoring.

parent 7556de06
......@@ -47,6 +47,37 @@ class ModuleContent(ModuleConfig):
if "action" in self.manifest_dict:
self.action = self.manifest_dict["action"].lower()
def _create_file_list_from_paths(self, paths):
"""
Build a Source File Set containing the files indicated by the
provided list of paths
"""
from hdlmake.srcfile import create_source_file, SourceFileSet
srcs = SourceFileSet()
# Check if this is the top module and grab the include_dirs
if self.parent is None:
include_dirs = self.manifest_dict.get('include_dirs', [])
else:
include_dirs = self.top_manifest.manifest_dict.get(
'include_dirs', [])
for path_aux in paths:
if os.path.isdir(path_aux):
# If a path is a dir, add all the files of that dir.
dir_ = os.listdir(path_aux)
for f_dir in dir_:
f_dir = os.path.join(self.path, path_aux, f_dir)
if not os.path.isdir(f_dir):
srcs.add(create_source_file(path=f_dir,
module=self,
library=self.library,
include_dirs=include_dirs))
else:
srcs.add(create_source_file(path=path_aux,
module=self,
library=self.library,
include_dirs=include_dirs))
return srcs
def _process_manifest_files(self):
"""Process the files instantiated by the HDLMake module"""
from hdlmake.srcfile import SourceFileSet
......@@ -130,32 +161,3 @@ class ModuleContent(ModuleConfig):
makefiles_paths = self._make_list_of_paths(included_makefiles_aux)
self.incl_makefiles.extend(makefiles_paths)
def _create_file_list_from_paths(self, paths):
"""
Build a Source File Set containing the files indicated by the
provided list of paths
"""
from hdlmake.srcfile import create_source_file, SourceFileSet
srcs = SourceFileSet()
# Check if this is the top module and grab the include_dirs
if self.parent is None:
include_dirs = self.manifest_dict.get('include_dirs', [])
else:
include_dirs = self.top_manifest.manifest_dict.get(
'include_dirs', [])
for path_aux in paths:
if os.path.isdir(path_aux):
dir_ = os.listdir(path_aux)
for f_dir in dir_:
f_dir = os.path.join(self.path, path_aux, f_dir)
if not os.path.isdir(f_dir):
srcs.add(create_source_file(path=f_dir,
module=self,
library=self.library,
include_dirs=include_dirs))
else:
srcs.add(create_source_file(path=path_aux,
module=self,
library=self.library,
include_dirs=include_dirs))
return srcs
......@@ -43,14 +43,11 @@ class ModuleConfig(object):
def init_config(self, module_args):
"""This initializes the module configuration.
The function is executed by Module constructor"""
parent = module_args.parent
self.parent = module_args.parent
url = module_args.url
source = module_args.source
self.source = module_args.source
fetchto = module_args.fetchto
self.source = source
self.parent = parent
if self.source == 'local':
self.url, self.branch, self.revision = url, None, None
......
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