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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pylib/gyp/generator/ninja.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/common.py
diff --git a/pylib/gyp/common.py b/pylib/gyp/common.py
index b6875e43efcbc40a14eb6a258626455e7ed91054..d482a20df3cdd9193bfa705c03495409af008f75 100644
--- a/pylib/gyp/common.py
+++ b/pylib/gyp/common.py
@@ -131,13 +131,20 @@ def QualifiedTarget(build_file, target, toolset):
@memoize
-def RelativePath(path, relative_to):
+def RelativePath(path, relative_to, follow_path_symlink=True):
# Assuming both |path| and |relative_to| are relative to the current
# directory, returns a relative path that identifies path relative to
# relative_to.
+ # If |follow_symlink_path| is true (default) and |path| is a symlink, then
+ # this method returns a path to the real file represented by |path|. If it is
+ # false, this method returns a path to the symlink. If |path| is not a
+ # symlink, this option has no effect.
# Convert to normalized (and therefore absolute paths).
- path = os.path.realpath(path)
+ if follow_path_symlink:
+ path = os.path.realpath(path)
+ else:
+ path = os.path.abspath(path)
relative_to = os.path.realpath(relative_to)
# On Windows, we can't create a relative path to a different drive, so just
« 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