Example #1
0
    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)
Example #2
0
  def __updateChangeTimeStamp(cls):
    """
      Creates or uptades LASTCHANGE.committime, required by gn.
      :return ret: NO_ERROR if timestamp is successfully updated. Otherwise error code.
    """
    ret = NO_ERROR

    try:
      lastchangeModulePath = convertToPlatformPath(config.LAST_CHANGE_MODULE_PATH)
      Utility.pushd(lastchangeModulePath)

      Utility.addModulePath(os.getcwd())
      
      import lastchange

      lastchange.main(['','-o','LASTCHANGE'])

    except Exception as error:
      ret = errors.ERROR_PREPARE_UPDATING_TIMESTEMP_FAILED
      cls.logger.error(str(error))
    finally:
      Utility.popd()

    return ret