Don't modify the PWD in gyp_v8

When running gyp in parallel mode (soon the default), we need to be able
to find the script by looking at the path relative to the PWD when the
script was originally invoked.

Instead of changing the directory and relying on relative paths, just
use absolute paths (as gyp_chromium does).

BUG=v8:2973
R=ulan@chromium.org
LOG=n

Review URL: https://codereview.chromium.org/122183004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18439 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
jochen@chromium.org 2014-01-02 13:50:50 +00:00
parent d8a03de590
commit 22376a103a

View File

@ -36,13 +36,8 @@ import platform
import shlex
import sys
script_dir = os.path.dirname(__file__)
v8_root = os.path.normpath(os.path.join(script_dir, os.pardir))
if __name__ == '__main__':
os.chdir(v8_root)
script_dir = os.path.dirname(__file__)
v8_root = '.'
script_dir = os.path.dirname(os.path.realpath(__file__))
v8_root = os.path.abspath(os.path.join(script_dir, os.pardir))
sys.path.insert(0, os.path.join(v8_root, 'build', 'gyp', 'pylib'))
import gyp
@ -142,10 +137,7 @@ if __name__ == '__main__':
# path separators even on Windows due to the use of shlex.split().
args.extend(shlex.split(gyp_file))
else:
# Note that this must not start with "./" or things break.
# So we rely on having done os.chdir(v8_root) above and use the
# relative path.
args.append(os.path.join('build', 'all.gyp'))
args.append(os.path.join(script_dir, 'all.gyp'))
args.extend(['-I' + i for i in additional_include_files(args)])