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

Unified Diff: build/scan_sources.py

Issue 11882002: Fix some scan_sources.py dependencies (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: merge with master Created 7 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/scan_sources.py
diff --git a/build/scan_sources.py b/build/scan_sources.py
index 44cb0043e2bff65aca58df6d0d52cbcd48cf3492..bd6253189f18d86e389ddb3795b38a1909b64202 100755
--- a/build/scan_sources.py
+++ b/build/scan_sources.py
@@ -59,6 +59,11 @@ class PathConverter(object):
ospath = os.path.realpath(ospath)
return self.ToPosixPath(ospath)
+ def dirname(self, pathname):
+ ospath = self.ToNativePath(pathname)
+ ospath = os.path.dirname(ospath)
+ return self.ToPosixPath(ospath)
+
class Resolver(object):
"""Resolver finds and generates relative paths for include files.
@@ -85,6 +90,14 @@ class Resolver(object):
return False
return True
+ def RemoveOneDirectory(self, pathname):
+ """Remove an include search path."""
+ pathname = self.pathobj.realpath(pathname)
+ DebugPrint('Removing DIR: %s' % pathname)
+ if pathname in self.search_dirs:
+ self.search_dirs.remove(pathname)
+ return True
+
def AddDirectories(self, pathlist):
"""Add list of space separated directories."""
failed = False
@@ -198,8 +211,13 @@ class WorkQueue(object):
scan_name = self.PopIfAvail()
while scan_name:
includes = self.scanner.ScanFile(scan_name)
+ # Add the directory of the current scanned file for resolving includes
+ # while processing includes for this file.
+ scan_dir = PathConverter().dirname(scan_name)
+ self.resolver.AddOneDirectory(scan_dir)
for include_file in includes:
self.PushIfNew(include_file)
+ self.resolver.RemoveOneDirectory(scan_dir)
scan_name = self.PopIfAvail()
return sorted(self.added_set)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698