Commit 3766ed1c authored by maruel@chromium.org's avatar maruel@chromium.org

Revert r144460 "Remove the linux-only CR_SOURCE_ROOT environment variable...

Revert r144460 "Remove the linux-only CR_SOURCE_ROOT environment variable override of base::DIR_SOURCE_ROOT."

CR_SOURCE_ROOT is used in practice by linux user(s), plural still to be
determined, mostly for ChromeOS related development.

R=willchan@chromium.org
BUG=
TEST=


Review URL: https://chromiumcodereview.appspot.com/10808048

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148621 0039d316-1c4b-4281-b951-d872f2087c98
parent e72cb5ad
...@@ -74,6 +74,20 @@ bool PathProviderPosix(int key, FilePath* result) { ...@@ -74,6 +74,20 @@ bool PathProviderPosix(int key, FilePath* result) {
#endif #endif
} }
case base::DIR_SOURCE_ROOT: { case base::DIR_SOURCE_ROOT: {
// Allow passing this in the environment, for more flexibility in build
// tree configurations (sub-project builds, gyp --output_dir, etc.)
scoped_ptr<base::Environment> env(base::Environment::Create());
std::string cr_source_root;
if (env->GetVar("CR_SOURCE_ROOT", &cr_source_root)) {
path = FilePath(cr_source_root);
if (file_util::PathExists(path)) {
*result = path;
return true;
} else {
DLOG(WARNING) << "CR_SOURCE_ROOT is set, but it appears to not "
<< "point to a directory.";
}
}
// On POSIX, unit tests execute two levels deep from the source root. // On POSIX, unit tests execute two levels deep from the source root.
// For example: out/{Debug|Release}/net_unittest // For example: out/{Debug|Release}/net_unittest
if (PathService::Get(base::DIR_EXE, &path)) { if (PathService::Get(base::DIR_EXE, &path)) {
......
...@@ -25,11 +25,15 @@ def fix_python_path(cmd): ...@@ -25,11 +25,15 @@ def fix_python_path(cmd):
def run_executable(cmd, env): def run_executable(cmd, env):
"""Runs an executable with: """Runs an executable with:
- environment variable CR_SOURCE_ROOT set to the root directory.
- environment variable LANGUAGE to en_US.UTF-8. - environment variable LANGUAGE to en_US.UTF-8.
- Reuses sys.executable automatically. - Reuses sys.executable automatically.
""" """
# Many tests assume a English interface... # Many tests assume a English interface...
env['LANGUAGE'] = 'en_US.UTF-8' env['LANGUAGE'] = 'en_US.UTF-8'
# Used by base/base_paths_linux.cc as an override. Just make sure the default
# logic is used.
env.pop('CR_SOURCE_ROOT', None)
# Ensure paths are correctly separated on windows. # Ensure paths are correctly separated on windows.
cmd[0] = cmd[0].replace('/', os.path.sep) cmd[0] = cmd[0].replace('/', os.path.sep)
cmd = fix_python_path(cmd) cmd = fix_python_path(cmd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment