def includes1Visit(self, obj): """ Defined to generate includes within a file. Usually used for the base classes but also for Serial types @param args: the instance of the concrete element to operation on. """ relative_path = self.relativePath() # DEBUG.debug("Relative path: %s", relative_path) # c = includes1SerialCpp.includes1SerialCpp() c.name = obj.get_name() # # Hack to fix the include file so it is consistent... if self.__config.get("serialize", "XMLDefaultFileName") == "False": c.name = obj.get_xml_filename().split("SerializableAi.xml")[0] c.namespace = "" # # Added configurable override for includes for testing # if self.__config.get("includes", "serial_include_path") == "None": if relative_path is not None: c.include_path = relative_path else: c.include_path = obj.get_namespace() else: c.include_path = self.__config.get("includes", "serial_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 Serial 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 = includes1SerialCpp.includes1SerialCpp() c.name = obj.get_name() # # Hack to fix the include file so it is consistent... if self.__config.get("serialize", "XMLDefaultFileName") == "False": c.name = obj.get_xml_filename().split("SerializableAi.xml")[0] c.namespace = "" # # Added configurable override for includes for testing # if self.__config.get("includes", "serial_include_path") == "None": if relative_path != None: c.include_path = relative_path else: c.include_path = obj.get_namespace() else: c.include_path = self.__config.get("includes", "serial_include_path") self._writeTmpl(c, "includes1Visit")