Bug 875023 - Make Rule._executeweak faster in e.g. dom/bindings. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 23 May 2013 07:27:50 +0200
changeset 343 9a7fff5332b075bbcb23ed53c906d11218058546
parent 342 e35c8b3b0cbb5b03e717f0dc48ceb1cb58effe37
child 344 211b0c4298e397526bd87af4fc080d2ca819f921
push id216
push usermh@glandium.org
push dateThu, 23 May 2013 05:30:49 +0000
reviewersted
bugs875023
Bug 875023 - Make Rule._executeweak faster in e.g. dom/bindings. r=ted
pymake/parserdata.py
--- a/pymake/parserdata.py
+++ b/pymake/parserdata.py
@@ -162,19 +162,23 @@ class Rule(Statement):
             self._execute(makefile, context)
 
     def _executeweak(self, makefile, context):
         """
         If the context is weak (we're just handling dependencies) we can make a number of assumptions here.
         This lets us go really fast and is generally good.
         """
         assert context.weak
-        assert len(self.targetexp.resolvesplit(makefile, makefile.variables)) == 1
-        target = self.targetexp.resolvesplit(makefile, makefile.variables)[0]
         deps = self.depexp.resolvesplit(makefile, makefile.variables)
+        # Skip targets with no rules and no dependencies
+        if not deps:
+            return
+        targets = self.targetexp.resolvesplit(makefile, makefile.variables)
+        assert len(targets) == 1
+        target = targets[0]
         rule = data.Rule(deps, self.doublecolon, loc=self.targetexp.loc, weakdeps=True)
         makefile.gettarget(target).addrule(rule)
         makefile.foundtarget(target)
         context.currule = rule
 
     def _execute(self, makefile, context):
         assert not context.weak