1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """Paths to common resources in the Chrome repository."""
10 _THIS_DIR
= os
.path
.abspath(os
.path
.dirname(__file__
))
14 """Returns the path to the root src directory."""
15 return os
.path
.abspath(os
.path
.join(_THIS_DIR
, os
.pardir
, os
.pardir
,
20 """Returns the path to the src/chrome/test/data directory."""
21 return os
.path
.join(GetSrc(), 'chrome', 'test', 'data')
24 def GetBuildDir(required_paths
):
25 """Returns the preferred build directory that contains given paths."""
26 dirs
= ['out', 'build', 'xcodebuild']
27 rel_dirs
= [os
.path
.join(x
, 'Release') for x
in dirs
]
28 debug_dirs
= [os
.path
.join(x
, 'Debug') for x
in dirs
]
29 full_dirs
= [os
.path
.join(GetSrc(), x
) for x
in rel_dirs
+ debug_dirs
]
30 for build_dir
in full_dirs
:
31 for required_path
in required_paths
:
32 if not os
.path
.exists(os
.path
.join(build_dir
, required_path
)):
36 raise RuntimeError('Cannot find build directory containing ' +
37 ', '.join(required_paths
))