def includes1Visit(self, obj): """ Defined to generate includes within a file. Usually used for the base classes but also for Port types @param args: the instance of the concrete element to operation on. """ relative_path = self.relativePath() # DEBUG.debug("Relative path: %s", relative_path) # c = includes1PortCpp.includes1PortCpp() c.include_file = obj.get_xml_filename().replace( "PortAi.xml", "PortAc.hpp") # # Added configurable override for includes for testing # if self.__config.get("includes", "port_include_path") == "None": if relative_path is not None: c.port_include_path = relative_path else: c.port_include_path = obj.get_namespace() else: c.port_include_path = self.__config.get("includes", "port_include_path") # self._writeTmpl(c, "includes1Visit")
def includes1Visit(self, obj): """ Defined to generate includes within a file. Usually used for the base classes but also for Port types @parms args: the instance of the concrete element to operation on. """ # If BUILD_ROOT is set get me the relative path to current execution location relative_path = None path = os.getcwd() # normalize path to Linux separators - TKC path = path.replace("\\", "/") if ModelParser.BUILD_ROOT != None: path = os.path.normpath(os.path.realpath(path)) build_root = os.path.normpath( os.path.realpath(ModelParser.BUILD_ROOT)) if path[:len(build_root)].lower() == build_root.lower(): relative_path = path[len(build_root + '/'):] else: PRINT.info( "ERROR: BUILD_ROOT (%s) and current execution path (%s) not consistent!" % (ModelParser.BUILD_ROOT, path)) sys.exit(-1) # DEBUG.debug("Relative path: %s", relative_path) # c = includes1PortCpp.includes1PortCpp() c.include_file = obj.get_xml_filename().replace( "PortAi.xml", "PortAc.hpp") # # Added configurable override for includes for testing # if self.__config.get("includes", "port_include_path") == "None": if relative_path != None: c.port_include_path = relative_path else: c.port_include_path = obj.get_namespace() else: c.port_include_path = self.__config.get("includes", "port_include_path") # self._writeTmpl(c, "includes1Visit")