def rh_one_rs(self, cs, rs, files): for f in files: # Only files which end in .req are used m = re.match("^.*\.req$", f.name) if m==None: continue rid = f.name[:-4] req = Requirement(f.data_stream, rid, rs, cs.mods, cs.opts, cs.config) if req.ok(): rs.add_req(req) else: rs.not_usable() # Modules must only be handled when there are some requirements. if len(rs.reqs)>0: rs.handle_modules()
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
def deprecated_read(self, directory): everythings_fine = True files = os.listdir(directory) for f in files: m = re.match("^.*\.req$", f) if m == None: continue rid = f[:-4] fd = codecs.open(os.path.join(directory, f), "r", "utf-8") req = Requirement(fd, rid, self, self.mods, self.config) if req.ok(): # Store in the map, so that it is easy to access the # node by id. self.reqs[req.id] = req # Also store it in the digraph's node list for simple # access to the digraph algorithms. self.nodes.append(req) else: self.error(45, "could not be parsed", req.id) everythings_fine = False self.ts = time.time() return everythings_fine