def preInit(cls): """ Determines host OS. Sets supported targets based on present folders. """ #Determine host OS cls.hostOs = platform.system().lower() cls.hostOsVersion = platform.release().lower() cls.hostCPU = getCPUFamily(platform.machine()) #Create path variables used in preparation process. Settings.preInit() #Set available targets cls.__setSupportedTargets() #Add three paths, where can be found templates, in the PYTHONPATH Utility.addModulePath( Settings.userWorkingPath ) #User working directory - from where script is run Utility.addModulePath( Settings.rootScriptsPath) #Folder where are scripts file Utility.addModulePath( Settings.templatesPath ) #Subfolder in scripts folder, that contains only template files Utility.addPath(Settings.localBuildToolsPath) #Determine python executable path and add python's Scripts folder in the system PATH executablePath = Utility.getExecutablePath('python') if executablePath != None: pythonPath = os.path.dirname(executablePath) pythonScriptsPath = os.path.join(pythonPath, 'Scripts') #Add python's Scripts folder in the PATH Utility.addPath(pythonScriptsPath)
def __updateDepotToolsPath(cls): """ Checks if Google's depot tools is in the PATH, removes it and add local depot tool path in PATH. """ #Search if gclient is one of the folders in the PATH depotToolPath = Utility.searchFileInPATH('gclient') if depotToolPath != None: cls.logger.debug('Removing depot tools path \'' + depotToolPath + '\' from the PATH.') #Remove depot tools path from the PATH Utility.removePath(depotToolPath) cls.logger.info('Adding depot tools path \'' + Settings.localDepotToolsPath + '\' to the PATH.') #Add local depot tools path in the PATH Utility.addPath(Settings.localDepotToolsPath)