def __BuildToolPackageByName( self, toolPackages: List[Package]) -> Dict[str, PackageToolRecord]: resDict = {} # type: Dict[str, PackageToolRecord] for package in toolPackages: recipe = package.ResolvedDirectExperimentalRecipe if recipe is not None and recipe.ResolvedInstallLocation is not None and recipe.ValidateInstallation is not None: addToolList = [] # type: List[XmlRecipeValidateCommand] validation = recipe.ValidateInstallation for command in validation.CommandList: if command.CommandType == BuildRecipeValidateCommand.AddTool: commandEx = cast(XmlRecipeValidateCommandAddTool, command) toolName = IOUtil.GetFileNameWithoutExtension( commandEx.Name) if toolName in resDict: if resDict[toolName] != package: raise Exception( "Tool already registered by {0}".format( package.Name)) else: resDict[toolName] = PackageToolRecord( package, recipe.ResolvedInstallLocation.ResolvedPath, commandEx) return resDict
def GetPlatformDependentExecuteableName(exeName: str, buildPlatformType: int) -> str: exeName = exeName if not exeName.lower().endswith( ".exe") else IOUtil.GetFileNameWithoutExtension(exeName) if buildPlatformType == BuildPlatformType.Windows: return exeName + ".exe" return exeName
def __init__(self, package: Package, resolvedInstallPath: str, addToolCommand: XmlRecipeValidateCommandAddTool) -> None: super().__init__() self.Package = package self.ToolName = IOUtil.GetFileNameWithoutExtension(addToolCommand.Name) self.RelativeToolPath = IOUtil.GetDirectoryName(addToolCommand.Name) self.AbsoluteToolPath = IOUtil.Join(resolvedInstallPath, self.RelativeToolPath)
def __CacheTemplateLocations(self, config: Config) -> Dict[str, str]: """ Build a dict of all *.gen files found in the template import directories """ resDict = {} # type: Dict[str, str] for location in config.TemplateImportDirectories: files = IOUtil.GetFilesAt(location.ResolvedPath, True) for entry in files: if entry.endswith(".gen"): resDict[IOUtil.GetFileNameWithoutExtension(entry)] = IOUtil.Join(location.ResolvedPath, entry) return resDict
def __init__(self, log: Log, requirementTypes: List[str], filename: str) -> None: if not os.path.isfile(filename): raise FileNotFoundException("Could not locate gen file %s", filename) tree = ET.parse(filename) xmlElement = tree.getroot() if xmlElement.tag != 'FslBuildTemplate': raise XmlInvalidRootElement("The file did not contain the expected root tag 'FslBuildTemplate'") super().__init__(log, requirementTypes, xmlElement) self.Name = IOUtil.GetFileNameWithoutExtension(filename) self.DirectRequirements = self._GetXMLRequirements(xmlElement)
def __init__(self, config: Config, filename: str, subPackageSupport: SubPackageSupportConfig) -> None: if not os.path.isfile(filename): raise FileNotFoundException("Could not locate gen file %s", filename) tree = ET.parse(filename) xmlElement = tree.getroot() if xmlElement.tag != 'FslBuildTemplate': raise XmlInvalidRootElement( "The file did not contain the expected root tag 'FslBuildTemplate'" ) super().__init__(config, xmlElement, subPackageSupport) self.Name = IOUtil.GetFileNameWithoutExtension(filename) self.DirectRequirements = self._GetXMLRequirements(xmlElement)
def GetExecutableName(exeName: str, platformName: str) -> str: exeName = IOUtil.GetFileNameWithoutExtension(exeName) platformId = platformName.lower() if platformId == PlatformNameIdString.WINDOWS: return exeName + '.exe' return exeName