0
Files
src/build/cp.py
yfriedman@chromium.org c9ba9b8796 Normalize output path to cp.py
The js unit test targets have subtle dependencies on sources.
Specifically, a rule pulls in js files and generates/runs js tests for
them. This can be an issue with a relative path when the commands are
run in parallel because a relative path may not exist. In this case, the
rule for cr.js which is in ui depends on chrome. An easy way to repro
this failure is:

$ ninja -C out/Debug unit_tests
$ rm -rf out/Debug/test_data
$ ninja -C out/Debug test_data/chrome/../ui/webui/resources/js/cr.js

Ninja is fine because it normalizes the path early enough whereas in
python we relied on the system to compute the path but out/Debug/test_data/chrome may not exist

BUG=235731

Hat-tip to cjhopman for help debugging.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197224 0039d316-1c4b-4281-b951-d872f2087c98
2013-04-30 01:57:11 +00:00

24 lines
592 B
Python
Executable File

#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Copy a file.
This module works much like the cp posix command - it takes 2 arguments:
(src, dst) and copies the file with path |src| to |dst|.
"""
import os
import shutil
import sys
def Main(src, dst):
# Use copy instead of copyfile to ensure the executable bit is copied.
return shutil.copy(src, os.path.normpath(dst))
if __name__ == '__main__':
sys.exit(Main(sys.argv[1], sys.argv[2]))