Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1037)

Side by Side Diff: buildutil.py

Issue 6591116: devserver: scripts_dir detection that also works outside the chroot (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/dev-util.git@master
Patch Set: 80 chars Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os, sys 5 import os, sys
6 6
7 class BuildObject(object): 7 class BuildObject(object):
8 """ 8 """
9 Common base class that defines key paths in the source tree. 9 Common base class that defines key paths in the source tree.
10 """ 10 """
11 def __init__(self, root_dir, static_dir): 11 def __init__(self, root_dir, static_dir):
12 self.app_id = '87efface-864d-49a5-9bb3-4b050a7c227a' 12 self.app_id = '87efface-864d-49a5-9bb3-4b050a7c227a'
13 self.root_dir = root_dir 13 self.root_dir = root_dir
14 self.scripts_dir = '%s/src/scripts' % os.environ['CROS_WORKON_SRCROOT']
15 self.devserver_dir = os.path.dirname(os.path.abspath(sys.argv[0])) 14 self.devserver_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
16 self.static_dir = static_dir 15 self.static_dir = static_dir
17 self.x86_pkg_dir = '%s/build/x86/local_packages' % self.root_dir 16 self.x86_pkg_dir = '%s/build/x86/local_packages' % self.root_dir
17 try:
18 self.scripts_dir = '%s/src/scripts' % os.environ['CROS_WORKON_SRCROOT']
19 except KeyError:
20 # Outside of chroot: This is a corner case. Since we live either in
21 # platform/dev or /usr/bin/, scripts have to live in ../../../src/scripts
22 self.scripts_dir = os.path.abspath(os.path.join(
23 self.devserver_dir, '../../../src/scripts'))
18 24
19 def AssertSystemCallSuccess(self, err, cmd='unknown'): 25 def AssertSystemCallSuccess(self, err, cmd='unknown'):
20 """ 26 """
21 TODO(rtc): This code should probably live somewhere else. 27 TODO(rtc): This code should probably live somewhere else.
22 """ 28 """
23 if err != 0: 29 if err != 0:
24 raise Exception('%s failed to execute' % cmd) 30 raise Exception('%s failed to execute' % cmd)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698