Bug 914935 - Fix pymake handling of colon in includedep files. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 12 Sep 2013 08:14:44 +0900
changeset 352 5809e5d90994
parent 351 2b0f505e953c
child 353 5d83a8746631
push id223
push usermh@glandium.org
push dateWed, 11 Sep 2013 23:23:02 +0000
reviewersgps
bugs914935
Bug 914935 - Fix pymake handling of colon in includedep files. r=gps
pymake/parser.py
--- a/pymake/parser.py
+++ b/pymake/parser.py
@@ -367,16 +367,19 @@ def parsefile(pathname):
     """
     Parse a filename into a parserdata.StatementList. A cache is used to avoid re-parsing
     makefiles that have already been parsed and have not changed.
     """
 
     pathname = os.path.realpath(pathname)
     return _parsecache.get(pathname)
 
+# colon followed by anything except a slash (Windows path detection)
+_depfilesplitter = re.compile(r':(?![\\/])')
+
 def parsedepfile(pathname):
     """
     Parse a filename listing only depencencies into a parserdata.StatementList.
     """
     def continuation_iter(lines):
         current_line = []
         for line in lines:
             line = line.rstrip()
@@ -389,17 +392,17 @@ def parsedepfile(pathname):
             yield ''.join(current_line)
             current_line = []
         if current_line:
             yield ''.join(current_line)
 
     pathname = os.path.realpath(pathname)
     stmts = parserdata.StatementList()
     for line in continuation_iter(open(pathname).readlines()):
-        target, deps = line.split(":", 1)
+        target, deps = _depfilesplitter.split(line, 1)
         stmts.append(parserdata.Rule(data.StringExpansion(target, None),
                                      data.StringExpansion(deps, None), False))
     return stmts
 
 def parsestring(s, filename):
     """
     Parse a string containing makefile data into a parserdata.StatementList.
     """