Ejemplo n.º 1
0
def FindBasePNaCl():
  """ Find the base directory of the PNaCl toolchain """
  # The bin/ directory is one of:
  # <base>/bin if <base> is /path/to/pnacl_translator
  # <base>/newlib/bin or <base>/glibc/bin otherwise
  bindir = env.getone('DRIVER_BIN')

  # If this is a translator dir, use pnacl_translator
  translator_dir = FindBaseDir(
      lambda cur: pathtools.basename(cur) == 'pnacl_translator')
  if translator_dir is not None:
    return shell.escape(translator_dir)
  # Else use ../..
  basedir = pathtools.dirname(pathtools.dirname(bindir))
  return shell.escape(basedir)
Ejemplo n.º 2
0
def FindBasePNaCl():
    """ Find the base directory of the PNaCl toolchain """
    # The bin/ directory is one of:
    # <base>/bin if <base> is /path/to/pnacl_translator
    # <base>/newlib/bin or <base>/glibc/bin otherwise
    bindir = env.getone('DRIVER_BIN')

    # If this is a translator dir, use pnacl_translator
    translator_dir = FindBaseDir(
        lambda cur: pathtools.basename(cur) == 'pnacl_translator')
    if translator_dir is not None:
        return shell.escape(translator_dir)
    # Else use ../..
    basedir = pathtools.dirname(pathtools.dirname(bindir))
    return shell.escape(basedir)
Ejemplo n.º 3
0
def FindBaseToolchain():
    """ Find toolchain/OS_ARCH directory """
    base_dir = FindBaseDir(lambda cur: pathtools.basename(cur) == 'toolchain')
    if base_dir is None:
        Log.Fatal("Unable to find 'toolchain' directory")
    toolchain_dir = os.path.join(base_dir,
                                 '%s_%s' % (GetOSName(), GetArchNameShort()))
    return shell.escape(toolchain_dir)
Ejemplo n.º 4
0
def FindBaseToolchain():
  """ Find toolchain/OS_ARCH directory """
  base_dir = FindBaseDir(lambda cur: pathtools.basename(cur) == 'toolchain')
  if base_dir is None:
    Log.Fatal("Unable to find 'toolchain' directory")
  toolchain_dir = os.path.join(
      base_dir,
      '%s_%s' % (GetOSName(), GetArchNameShort())
  )
  return shell.escape(toolchain_dir)
Ejemplo n.º 5
0
 def append(self, varname, *vals):
   escaped = [ shell.escape(v) for v in vals ]
   if len(self.data[varname]) > 0:
     self.data[varname] += ' '
   self.data[varname] += ' '.join(escaped)
Ejemplo n.º 6
0
def AddPrefix(prefix, varname):
  values = env.get(varname)
  return ' '.join([prefix + shell.escape(v) for v in values ])
Ejemplo n.º 7
0
def FindBasePNaCl():
  """ Find the base directory of the PNaCl toolchain """
  # The <base> directory is one level up from the <base>/bin:
  bindir = env.getone('DRIVER_BIN')
  basedir = pathtools.dirname(bindir)
  return shell.escape(basedir)
Ejemplo n.º 8
0
def FindBaseNaCl():
  """ Find native_client/ directory """
  dir = FindBaseDir(lambda cur: pathtools.basename(cur) == 'native_client')
  if dir is None:
    Log.Fatal("Unable to find 'native_client' directory")
  return shell.escape(dir)
Ejemplo n.º 9
0
 def append(self, varname, *vals):
     escaped = [shell.escape(v) for v in vals]
     if len(self.data[varname]) > 0:
         self.data[varname] += ' '
     self.data[varname] += ' '.join(escaped)
Ejemplo n.º 10
0
def FindBaseToolchain():
  """ Find toolchain/ directory """
  dir = FindBaseDir(lambda cur: pathtools.basename(cur) == 'toolchain')
  if dir is None:
    Log.Fatal("Unable to find 'toolchain' directory")
  return shell.escape(dir)
Ejemplo n.º 11
0
def AddPrefix(prefix, varname):
  values = env.get(varname)
  return ' '.join([prefix + shell.escape(v) for v in values ])
Ejemplo n.º 12
0
def FindBasePNaCl():
  """ Find the base directory of the PNaCl toolchain """
  # The <base> directory is one level up from the <base>/bin:
  bindir = env.getone('DRIVER_BIN')
  basedir = pathtools.dirname(bindir)
  return shell.escape(basedir)
Ejemplo n.º 13
0
def FindBaseToolchain():
  """ Find toolchain/ directory """
  dir = FindBaseDir(lambda cur: pathtools.basename(cur) == 'toolchain')
  if dir is None:
    Log.Fatal("Unable to find 'toolchain' directory")
  return shell.escape(dir)
Ejemplo n.º 14
0
def FindBaseNaCl():
  """ Find native_client/ directory """
  dir = FindBaseDir(lambda cur: pathtools.basename(cur) == 'native_client')
  if dir is None:
    Log.Fatal("Unable to find 'native_client' directory")
  return shell.escape(dir)