aboutsummaryrefslogtreecommitdiff
path: root/crosperf/label.py
blob: 3b6fb8041d030237d13038f69356a38dd80c4c7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/python

# Copyright 2011 Google Inc. All Rights Reserved.

from utils.file_utils import FileUtils


class Label(object):
  def __init__(self, name, chromeos_image, chromeos_root, board):
    self.name = name
    self.chromeos_image = chromeos_image
    self.board = board

    if not chromeos_root:
      chromeos_root = FileUtils().ChromeOSRootFromImage(chromeos_image)
      if not chromeos_root:
        raise Exception("No ChromeOS root given for label '%s' and could not "
                        "determine one from image path: '%s'." %
                        (name, chromeos_image))
    else:
      chromeos_root = FileUtils().CanonicalizeChromeOSRoot(chromeos_root)
      if not chromeos_root:
        raise Exception("Invalid ChromeOS root given for label '%s': '%s'."
                        % (name, chromeos_root))

    self.chromeos_root = chromeos_root