parameters: (self, context)
docstring: Override Prepare from cr.Platform.
docstring_summary: Override Prepare from cr.Platform.
docstring_tokens: Override Prepare from cr . Platform .
function: def Prepare(self, context):
      """Override Prepare from cr.Platform."""
      super(AndroidPlatform, self).Prepare(context)
      try:
        # capture the result of env setup if we have not already done so
        if not self._env_ready:
          # See what the env would be without env setup
          before = context.exported
          before['GYP_DEFINES'] = before.get(
              'GYP_DEFINES', '') + ' target_arch={CR_ENVSETUP_ARCH}'
          # Run env setup and capture/parse its output
          envsetup = 'source {CR_ENVSETUP}'
          output = cr.Host.CaptureShell(context, envsetup + ' > /dev/null && env')
          env_setup = cr.Config('envsetup', literal=True, export=True)
          for line in output.split('\n'):
            (key, op, value) = line.partition('=')
            if op:
              key = key.strip()
              if key not in _IGNORE_ENV:
                env_setup[key] = env_setup.ParseValue(value.strip())
              if key == 'PATH':
                self._env_paths = value.strip().split(os.path.pathsep)
              if key == 'GYP_DEFINES':
                # Make a version of GYP_DEFINES that is the combination of base
                # setting and envsetup, needs to override the overrides
                # Note: Forcing it into the top level scope - sledge-hammer
                context[key] = value.strip() + ' ' + before.get(key, '')
          items = env_setup.exported.items()
          if not items:
            # Because of the way envsetup is run, the exit code does not make it
            # back to us. Instead, we assume if we got no environment at all, it
            # must have failed.
            print 'Envsetup failed!'
            exit(1)
          # Find all the things that envsetup changed
          for key, value in env_setup.exported.items():
            if str(value) != str(before.get(key, None)):
              self._env[key] = value
        self._env_ready = True
      except subprocess.CalledProcessError, e:
        exit(e.returncode)
function_tokens: def Prepare ( self , context ) : super ( AndroidPlatform , self ) . Prepare ( context ) try : # capture the result of env setup if we have not already done so if not self . _env_ready : # See what the env would be without env setup before = context . exported before [ 'GYP_DEFINES' ] = before . get ( 'GYP_DEFINES' , '' ) + ' target_arch={CR_ENVSETUP_ARCH}' # Run env setup and capture/parse its output envsetup = 'source {CR_ENVSETUP}' output = cr . Host . CaptureShell ( context , envsetup + ' > /dev/null && env' ) env_setup = cr . Config ( 'envsetup' , literal = True , export = True ) for line in output . split ( '\n' ) : ( key , op , value ) = line . partition ( '=' ) if op : key = key . strip ( ) if key not in _IGNORE_ENV : env_setup [ key ] = env_setup . ParseValue ( value . strip ( ) ) if key == 'PATH' : self . _env_paths = value . strip ( ) . split ( os . path . pathsep ) if key == 'GYP_DEFINES' : # Make a version of GYP_DEFINES that is the combination of base # setting and envsetup, needs to override the overrides # Note: Forcing it into the top level scope - sledge-hammer context [ key ] = value . strip ( ) + ' ' + before . get ( key , '' ) items = env_setup . exported . items ( ) if not items : # Because of the way envsetup is run, the exit code does not make it # back to us. Instead, we assume if we got no environment at all, it # must have failed. print 'Envsetup failed!' exit ( 1 ) # Find all the things that envsetup changed for key , value in env_setup . exported . items ( ) : if str ( value ) != str ( before . get ( key , None ) ) : self . _env [ key ] = value self . _env_ready = True except subprocess . CalledProcessError , e : exit ( e . returncode )