OLD | NEW |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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): |
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.abspath(path) | 140 path = os.path.realpath(path) |
141 relative_to = os.path.realpath(relative_to) | 141 relative_to = os.path.realpath(relative_to) |
142 | 142 |
143 # On Windows, we can't create a relative path to a different drive, so just | 143 # On Windows, we can't create a relative path to a different drive, so just |
144 # use the absolute path. | 144 # use the absolute path. |
145 if sys.platform == 'win32': | 145 if sys.platform == 'win32': |
146 if (os.path.splitdrive(path)[0].lower() != | 146 if (os.path.splitdrive(path)[0].lower() != |
147 os.path.splitdrive(relative_to)[0].lower()): | 147 os.path.splitdrive(relative_to)[0].lower()): |
148 return path | 148 return path |
149 | 149 |
150 # Split the paths into components. | 150 # Split the paths into components. |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 def CrossCompileRequested(): | 590 def CrossCompileRequested(): |
591 # TODO: figure out how to not build extra host objects in the | 591 # TODO: figure out how to not build extra host objects in the |
592 # non-cross-compile case when this is enabled, and enable unconditionally. | 592 # non-cross-compile case when this is enabled, and enable unconditionally. |
593 return (os.environ.get('GYP_CROSSCOMPILE') or | 593 return (os.environ.get('GYP_CROSSCOMPILE') or |
594 os.environ.get('AR_host') or | 594 os.environ.get('AR_host') or |
595 os.environ.get('CC_host') or | 595 os.environ.get('CC_host') or |
596 os.environ.get('CXX_host') or | 596 os.environ.get('CXX_host') or |
597 os.environ.get('AR_target') or | 597 os.environ.get('AR_target') or |
598 os.environ.get('CC_target') or | 598 os.environ.get('CC_target') or |
599 os.environ.get('CXX_target')) | 599 os.environ.get('CXX_target')) |
OLD | NEW |