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

Side by Side Diff: pylib/gyp/common.py

Issue 1365163002: Make the ninja generator handle symlinked paths correctly. (Closed) Base URL: https://chromium.googlesource.com/external/gyp@master
Patch Set: Added 'chdir=outdir' per Nico's suggestion on the last CL. Created 5 years, 2 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
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | pylib/gyp/generator/ninja.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 Google Inc. All rights reserved. 1 # Copyright (c) 2012 Google Inc. 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 from __future__ import with_statement 5 from __future__ import with_statement
6 6
7 import collections 7 import collections
8 import errno 8 import errno
9 import filecmp 9 import filecmp
10 import os.path 10 import os.path
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 # "Qualified" means the file that a target was defined in and the target 124 # "Qualified" means the file that a target was defined in and the target
125 # name, separated by a colon, suffixed by a # and the toolset name: 125 # name, separated by a colon, suffixed by a # and the toolset name:
126 # /path/to/file.gyp:target_name#toolset 126 # /path/to/file.gyp:target_name#toolset
127 fully_qualified = build_file + ':' + target 127 fully_qualified = build_file + ':' + target
128 if toolset: 128 if toolset:
129 fully_qualified = fully_qualified + '#' + toolset 129 fully_qualified = fully_qualified + '#' + toolset
130 return fully_qualified 130 return fully_qualified
131 131
132 132
133 @memoize 133 @memoize
134 def RelativePath(path, relative_to): 134 def RelativePath(path, relative_to, follow_path_symlink=True):
scottmg 2015/09/24 21:30:51 could you add some explanation for this arg here?
lindleyf 2015/09/24 21:47:14 I've added a comment here and at the point of use.
135 # Assuming both |path| and |relative_to| are relative to the current 135 # Assuming both |path| and |relative_to| are relative to the current
136 # directory, returns a relative path that identifies path relative to 136 # directory, returns a relative path that identifies path relative to
137 # relative_to. 137 # relative_to.
138 138
139 # Convert to normalized (and therefore absolute paths). 139 # Convert to normalized (and therefore absolute paths).
140 path = os.path.realpath(path) 140 if follow_path_symlink:
141 path = os.path.realpath(path)
142 else:
143 path = os.path.abspath(path)
141 relative_to = os.path.realpath(relative_to) 144 relative_to = os.path.realpath(relative_to)
142 145
143 # On Windows, we can't create a relative path to a different drive, so just 146 # On Windows, we can't create a relative path to a different drive, so just
144 # use the absolute path. 147 # use the absolute path.
145 if sys.platform == 'win32': 148 if sys.platform == 'win32':
146 if (os.path.splitdrive(path)[0].lower() != 149 if (os.path.splitdrive(path)[0].lower() !=
147 os.path.splitdrive(relative_to)[0].lower()): 150 os.path.splitdrive(relative_to)[0].lower()):
148 return path 151 return path
149 152
150 # Split the paths into components. 153 # Split the paths into components.
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 def CrossCompileRequested(): 593 def CrossCompileRequested():
591 # TODO: figure out how to not build extra host objects in the 594 # TODO: figure out how to not build extra host objects in the
592 # non-cross-compile case when this is enabled, and enable unconditionally. 595 # non-cross-compile case when this is enabled, and enable unconditionally.
593 return (os.environ.get('GYP_CROSSCOMPILE') or 596 return (os.environ.get('GYP_CROSSCOMPILE') or
594 os.environ.get('AR_host') or 597 os.environ.get('AR_host') or
595 os.environ.get('CC_host') or 598 os.environ.get('CC_host') or
596 os.environ.get('CXX_host') or 599 os.environ.get('CXX_host') or
597 os.environ.get('AR_target') or 600 os.environ.get('AR_target') or
598 os.environ.get('CC_target') or 601 os.environ.get('CC_target') or
599 os.environ.get('CXX_target')) 602 os.environ.get('CXX_target'))
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | pylib/gyp/generator/ninja.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698