blob: e5e32f135ddd490c57f383f29860949b69d946b3 [file] [log] [blame]
Chris Sosa7c931362010-10-11 19:49:01 -07001# Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved.
rtc@google.comded22402009-10-26 22:36:21 +00002# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Gilad Arnoldabb352e2012-09-23 01:24:27 -07005import os
6import sys
7
Zdenek Behan59d8aa72011-02-24 01:09:02 +01008
Sean O'Connor14b6a0a2010-03-20 23:23:48 -07009class BuildObject(object):
rtc@google.comded22402009-10-26 22:36:21 +000010 """
rtc@google.com64244662009-11-12 00:52:08 +000011 Common base class that defines key paths in the source tree.
rtc@google.comded22402009-10-26 22:36:21 +000012 """
rtc@google.com64244662009-11-12 00:52:08 +000013 def __init__(self, root_dir, static_dir):
Zdenek Behan59d8aa72011-02-24 01:09:02 +010014 self.devserver_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
rtc@google.com64244662009-11-12 00:52:08 +000015 self.static_dir = static_dir
Zdenek Behan92cece82011-03-02 22:35:04 +010016 try:
17 self.scripts_dir = '%s/src/scripts' % os.environ['CROS_WORKON_SRCROOT']
18 except KeyError:
19 # Outside of chroot: This is a corner case. Since we live either in
20 # platform/dev or /usr/bin/, scripts have to live in ../../../src/scripts
21 self.scripts_dir = os.path.abspath(os.path.join(
22 self.devserver_dir, '../../../src/scripts'))