def ExportOS(instance, override_env):
  assert instance
  assert instance.os

  temp_dir = tempfile.mkdtemp()
  inst_os = OSFromDisk(instance.os)

  result = utils.RunCmd(["ln", "-s", inst_os.path,
                         utils.PathJoin(temp_dir, "os")])
  if result.failed:
    _Fail("Failed to copy OS package '%s' to '%s': %s, output '%s'",
          inst_os, temp_dir, result.fail_reason, result.output)

  env = OSEnvironment(instance, inst_os)
  env.update(override_env)

  with open(utils.PathJoin(temp_dir, "environment"), "w") as f:
    for var in env:
      f.write(var + "=" + env[var] + "\n")

  (fd, os_package) = tempfile.mkstemp(suffix=".tgz")
  os.close(fd)

  result = utils.RunCmd(["tar", "--dereference", "-czv",
                         "-f", os_package,
                         "-C", temp_dir,
                         "."])
  if result.failed:
    _Fail("Failed to create OS archive '%s': %s, output '%s'",
          os_package, result.fail_reason, result.output)

  result = utils.RunCmd(["rm", "-rf", temp_dir])
  if result.failed:
    _Fail("Failed to remove copy of OS package '%s' in '%s': %s, output '%s'",
          inst_os, temp_dir, result.fail_reason, result.output)

  return os_package
Create a Tool from an excellon file tool definition line.
dataset/ETHPy150Open ganeti/ganeti/lib/backend.py/ExportOS--crossover with--dataset/ETHPy150Open curtacircuitos/pcb-tools/gerber/excellon_statements.py/ExcellonTool.from_excellon