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

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: Removed unnecessary import. 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') | no next file with comments »
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):
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 # If |follow_symlink_path| is true (default) and |path| is a symlink, then
139 # this method returns a path to the real file represented by |path|. If it is
140 # false, this method returns a path to the symlink. If |path| is not a
141 # symlink, this option has no effect.
138 142
139 # Convert to normalized (and therefore absolute paths). 143 # Convert to normalized (and therefore absolute paths).
140 path = os.path.realpath(path) 144 if follow_path_symlink:
145 path = os.path.realpath(path)
146 else:
147 path = os.path.abspath(path)
141 relative_to = os.path.realpath(relative_to) 148 relative_to = os.path.realpath(relative_to)
142 149
143 # On Windows, we can't create a relative path to a different drive, so just 150 # On Windows, we can't create a relative path to a different drive, so just
144 # use the absolute path. 151 # use the absolute path.
145 if sys.platform == 'win32': 152 if sys.platform == 'win32':
146 if (os.path.splitdrive(path)[0].lower() != 153 if (os.path.splitdrive(path)[0].lower() !=
147 os.path.splitdrive(relative_to)[0].lower()): 154 os.path.splitdrive(relative_to)[0].lower()):
148 return path 155 return path
149 156
150 # Split the paths into components. 157 # Split the paths into components.
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 def CrossCompileRequested(): 597 def CrossCompileRequested():
591 # TODO: figure out how to not build extra host objects in the 598 # TODO: figure out how to not build extra host objects in the
592 # non-cross-compile case when this is enabled, and enable unconditionally. 599 # non-cross-compile case when this is enabled, and enable unconditionally.
593 return (os.environ.get('GYP_CROSSCOMPILE') or 600 return (os.environ.get('GYP_CROSSCOMPILE') or
594 os.environ.get('AR_host') or 601 os.environ.get('AR_host') or
595 os.environ.get('CC_host') or 602 os.environ.get('CC_host') or
596 os.environ.get('CXX_host') or 603 os.environ.get('CXX_host') or
597 os.environ.get('AR_target') or 604 os.environ.get('AR_target') or
598 os.environ.get('CC_target') or 605 os.environ.get('CC_target') or
599 os.environ.get('CXX_target')) 606 os.environ.get('CXX_target'))
OLDNEW
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698