Bug 1363811 - Modify the name of the DependsFunction.__or__ implementation method. r?chmanchester draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 17 May 2017 15:16:48 +0900
changeset 580723 5f568887e58875358a655d380066fb974288012f
parent 580722 42cefc0670f9b3fd20473d983136ee16800e6231
child 580724 364bf647bf8aaff1f64f4f85c0d7aad8d0405e6a
push id59648
push userbmo:mh+mozilla@glandium.org
push dateThu, 18 May 2017 22:06:14 +0000
reviewerschmanchester
bugs1363811
milestone55.0a1
Bug 1363811 - Modify the name of the DependsFunction.__or__ implementation method. r?chmanchester Like the test change, it makes the intent clearer.
python/mozbuild/mozbuild/configure/__init__.py
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -118,23 +118,23 @@ class DependsFunction(object):
             ', '.join(repr(d) for d in self.dependencies),
         )
 
     def __or__(self, other):
         if isinstance(other, SandboxDependsFunction):
             other = self.sandbox._depends.get(other)
         assert isinstance(other, DependsFunction)
         assert self.sandbox is other.sandbox
-        return CombinedDependsFunction(self.sandbox, self.first_true,
+        return CombinedDependsFunction(self.sandbox, self.or_impl,
                                        (self, other))
 
     @staticmethod
-    def first_true(iterable):
-        # Like the builtin any(), but returns the first element that is true,
-        # instead of True. If none are true, returns the last element.
+    def or_impl(iterable):
+        # Applies "or" to all the items of iterable.
+        # e.g. if iterable contains a, b and c, returns `a or b or c`.
         for i in iterable:
             if i:
                 return i
         return i
 
 
 class CombinedDependsFunction(DependsFunction):
     def __init__(self, sandbox, func, dependencies):