Commit 9e378856 authored by Tristan Gingold's avatar Tristan Gingold

reformating and cleanup.

parent ea5484da
...@@ -233,7 +233,6 @@ types:[<type 'int'>] ...@@ -233,7 +233,6 @@ types:[<type 'int'>]
def add_config_file(self, config_file): def add_config_file(self, config_file):
"""Add the Manifest to be processed by the parser""" """Add the Manifest to be processed by the parser"""
self.config_file = config_file self.config_file = config_file
return True
def add_prefix_code(self, code): def add_prefix_code(self, code):
"""Add the arbitrary Python to be executed just before the Manifest""" """Add the arbitrary Python to be executed just before the Manifest"""
......
...@@ -290,9 +290,8 @@ class ManifestParser(ConfigParser): ...@@ -290,9 +290,8 @@ class ManifestParser(ConfigParser):
manifest = _search_for_manifest(path) manifest = _search_for_manifest(path)
if manifest is None: if manifest is None:
raise Exception("No manifest found in path: {}".format(path)) raise Exception("No manifest found in path: {}".format(path))
else: logging.debug("Parse manifest in: %s", manifest)
logging.debug("Parse manifest in: %s", manifest) self.add_config_file(manifest)
return self.add_config_file(manifest)
def print_help(self): def print_help(self):
"""Print the help for the Manifest parser object""" """Print the help for the Manifest parser object"""
......
...@@ -72,8 +72,7 @@ class Module(ModuleContent): ...@@ -72,8 +72,7 @@ class Module(ModuleContent):
def remove_dir_from_disk(self): def remove_dir_from_disk(self):
"""Delete the module dir if it is already fetched and available""" """Delete the module dir if it is already fetched and available"""
if not self.isfetched: assert self.isfetched
return
logging.debug("Removing " + self.path) logging.debug("Removing " + self.path)
command_tmp = shell.rmdir_command() + " " + self.path command_tmp = shell.rmdir_command() + " " + self.path
shell.run(command_tmp) shell.run(command_tmp)
...@@ -106,8 +105,7 @@ class Module(ModuleContent): ...@@ -106,8 +105,7 @@ class Module(ModuleContent):
if self.manifest_dict or self.isfetched is False: if self.manifest_dict or self.isfetched is False:
return return
if self.path is None: assert self.path is not None
raise RuntimeError()
logging.debug(""" logging.debug("""
*********************************************************** ***********************************************************
...@@ -119,33 +117,31 @@ PARSE START: %s ...@@ -119,33 +117,31 @@ PARSE START: %s
manifest_parser.add_prefix_code(self.pool.options.prefix_code) manifest_parser.add_prefix_code(self.pool.options.prefix_code)
manifest_parser.add_suffix_code(self.pool.options.suffix_code) manifest_parser.add_suffix_code(self.pool.options.suffix_code)
parser_tmp = manifest_parser.add_manifest(self.path) # Look for the Manifest.py file
manifest_parser.add_manifest(self.path)
if not parser_tmp == None:
if self.parent is None: # Parse and extract variables from it.
extra_context = {} if self.parent is None:
else: extra_context = {}
extra_context = dict(self.top_module.manifest_dict)
extra_context["__manifest"] = self.path
# The parse method is where most of the parser action takes place!
opt_map = None
try:
opt_map = manifest_parser.parse(extra_context=extra_context)
except NameError as name_error:
raise Exception(
"Error while parsing {0}:\n{1}: {2}.".format(
self.path, type(name_error), name_error))
self.manifest_dict = opt_map
else: else:
self.manifest_dict = {} extra_context = dict(self.top_module.manifest_dict)
extra_context["__manifest"] = self.path
# The parse method is where most of the parser action takes place!
opt_map = None
try:
opt_map = manifest_parser.parse(extra_context=extra_context)
except NameError as name_error:
raise Exception(
"Error while parsing {0}:\n{1}: {2}.".format(
self.path, type(name_error), name_error))
self.manifest_dict = opt_map
# Process the parsed manifest_dict to assign the module properties # Process the parsed manifest_dict to assign the module properties
self.process_manifest() self.process_manifest()
self.process_git_submodules() self.process_git_submodules()
# Parse every detected submodule # Recurse: parse every detected submodule
for module_aux in self.submodules(): for module_aux in self.submodules():
module_aux.parse_manifest() module_aux.parse_manifest()
......
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