def __read_one_requirement(self, fileinfo, input_mods, object_cache): '''Read in one requirement from the file info.''' tracer.debug("Called.") # Check for correct filename if not fileinfo.get_filename().endswith(".req"): tracer.info("skipping file [%s]", fileinfo.get_filename()) return # Handle caching. vcs_id = fileinfo.get_vcs_id() rid = fileinfo.get_filename_sub_part()[:-4] req = object_cache.get("Requirement", vcs_id) tracer.info("Reading requirement [%s]", rid) if req is None: file_content = fileinfo.get_content() req = Requirement(file_content, rid, fileinfo.get_filename(), input_mods, self._config) # Add the requirement to the cache. object_cache.add(vcs_id, "Requirement", req) self._adapt_usablility(req) if req.is_usable(): # Store in the map, so that it is easy to access the # node by id. self.add_requirement(req) # Also store it in the digraph's node list for simple # access to the digraph algorithms. # self.nodes.append(req) else: logger.error(LogFormatter.format( 45, "could not be parsed", req.get_id())) tracer.debug("Finished.")
def __read_requirements(self, input_handler, commit): '''Reads in all the requirements from the input_handler.''' tracer.debug("called") filenames = input_handler.get_file_names(commit, "requirements") print("FILENAMES [%s]" % filenames) for filename in filenames: # Check for correct filename m = re.match("^.*\.req$", filename) if m == None: tracer.info("skipping file [%s]" % filename) continue # Handle caching. vcs_id = input_handler.get_vcs_id(commit, filename) rid = filename[:-4] print("RID [%s]" % rid) assert False req = self.__object_cache.get("Requirement", vcs_id) if req != None: # Double check the id if req.get_id() != rid: # TODO: exception assert False else: fd = input_handler.get_fd(commit, filename) req = Requirement(fd, rid, self, self.__input_mods, self.__config) # Add the requirement to the cache. self.__object_cache.add(vcs_id, "Requirement", req) if req.ok(): # Store in the map, so that it is easy to access the # node by id. self.__requirements[req.get_id()] = req # Also store it in the digraph's node list for simple # access to the digraph algorithms. # TODO: self.nodes.append(req) else: self.error(45, "could not be parsed", req.id) everythings_fine = False