def __init__(self, log: Log, xmlElement: ET.Element) -> None: super().__init__(log, xmlElement, "EnvironmentVariable", BuildRecipeValidateCommand.EnvironmentVariable) self.Name = self._ReadAttrib(xmlElement, 'Name') # type: str method = self._ReadAttrib(xmlElement, 'Method') self.AllowEndSlash = self._ReadBoolAttrib(xmlElement, 'AllowEndSlash', False) # type: bool self.Method = BuildRecipeValidateMethod.FromString(method) # type: int
def __init__(self, log: Log, xmlElement: ET.Element) -> None: super().__init__(log, xmlElement, "Path", BuildRecipeValidateCommand.Path) self.Name = self._ReadAttrib(xmlElement, 'Name') method = self._ReadAttrib(xmlElement, 'Method') self.Method = BuildRecipeValidateMethod.FromString(method) if '\\' in self.Name: raise Exception("A path can not contain backslash '\\': '{0}'".format(self.Name)) if self.Name.endswith('/'): raise Exception("A path can not end with a slash '/': '{0}'".format(self.Name)) self.Name = IOUtil.NormalizePath(self.Name)
def __ValidatePath(self, rErrorRecordList: List[ErrorRecord], installationPath: Optional[str], command: XmlRecipeValidateCommandPath) -> bool: result, value = self.__DoValidatePath(rErrorRecordList, installationPath, command) if self.__Log.Verbosity >= 1: self.__Log.LogPrint("Validating path '{0}' '{1}': {2}".format( command.Name, BuildRecipeValidateMethod.TryToString(command.Method, True), result)) if self.__Log.Verbosity >= 2: self.__Log.LogPrint(" '{0}'".format(value)) return result
def __ValidateEnvironmentVariable( self, rErrorRecordList: List[ErrorRecord], command: XmlRecipeValidateCommandEnvironmentVariable) -> bool: result, value = self.__DoValidateEnvironmentVariable( rErrorRecordList, command) if self.__BasicConfig.Verbosity >= 1: self.__BasicConfig.LogPrint( "Validating environment variable '{0}' '{1}': {2}".format( command.Name, BuildRecipeValidateMethod.TryToString( command.Method, True), result)) if self.__BasicConfig.Verbosity >= 2: self.__BasicConfig.LogPrint(" '{0}'".format(value)) return result