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

Unified Diff: pylib/gyp/generator/msvs.py

Issue 1188553003: MSVS: Normalize paths against gyp directory. (Closed) Base URL: http://chromium.googlesource.com/external/gyp@master
Patch Set: Fix last style change Created 5 years, 6 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 | test/msvs/filters/gyptest-filters-2010.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/generator/msvs.py
diff --git a/pylib/gyp/generator/msvs.py b/pylib/gyp/generator/msvs.py
index eb1e17d5bff1da91cfc267fd692a6e0507f6a55d..946c8d1fae6cd8c1001d4eaa5d37851741146eae 100644
--- a/pylib/gyp/generator/msvs.py
+++ b/pylib/gyp/generator/msvs.py
@@ -134,44 +134,49 @@ def _GetDomainAndUserName():
fixpath_prefix = None
-def _NormalizedSource(source):
+def _NormalizedSource(source, curdir=None):
"""Normalize the path.
But not if that gets rid of a variable, as this may expand to something
larger than one directory.
Arguments:
- source: The path to be normalize.d
+ source: The path to be normalized
+ curdir: Current direcory to normalize against (optional)
Returns:
The normalized path.
"""
normalized = os.path.normpath(source)
+ if curdir:
+ normalized = os.path.normpath(os.path.join(curdir, normalized))
+ normalized = os.path.relpath(normalized, curdir)
if source.count('$') == normalized.count('$'):
source = normalized
return source
-def _FixPath(path):
+def _FixPath(path, curdir=None):
"""Convert paths to a form that will make sense in a vcproj file.
Arguments:
path: The path to convert, may contain / etc.
+ curdir: Current directory of path (optional)
Returns:
The path with all slashes made into backslashes.
"""
if fixpath_prefix and path and not os.path.isabs(path) and not path[0] == '$':
path = os.path.join(fixpath_prefix, path)
path = path.replace('/', '\\')
- path = _NormalizedSource(path)
+ path = _NormalizedSource(path, curdir)
if path and path[-1] == '\\':
path = path[:-1]
return path
-def _FixPaths(paths):
+def _FixPaths(paths, curdir=None):
"""Fix each of the paths of the list."""
- return [_FixPath(i) for i in paths]
+ return [_FixPath(i, curdir) for i in paths]
def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None,
@@ -1479,7 +1484,7 @@ def _AdjustSourcesAndConvertToFilterHierarchy(
# Convert to proper windows form.
# NOTE: sources goes from being a set to a list here.
# NOTE: excluded_sources goes from being a set to a list here.
- sources = _FixPaths(sources)
+ sources = _FixPaths(sources, _FixPath(gyp_dir))
# Convert to proper windows form.
excluded_sources = _FixPaths(excluded_sources)
« no previous file with comments | « no previous file | test/msvs/filters/gyptest-filters-2010.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698