Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e021bf4 authored by Jiyong Park's avatar Jiyong Park Committed by Automerger Merge Worker
Browse files

Handle the case when non-optional props have the same value am: 5df5873d am: cde65cd9

Original change: https://googleplex-android-review.googlesource.com/c/platform/build/+/12042312

Change-Id: I68b805c29c7e4728287a00aed892420a2a7af510
parents 07334569 cde65cd9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -88,6 +88,8 @@ def override_optional_props(prop_list, allow_dup=False):
    if len(overriding_props) > 1:
      # duplicated props are allowed when the all have the same value
      if all(overriding_props[0].value == p.value for p in overriding_props):
        for p in optional_props:
          p.delete("overridden by %s" % str(overriding_props[0]))
        continue
      # or if dup is explicitly allowed for compat reason
      if allow_dup:
+6 −0
Original line number Diff line number Diff line
@@ -221,11 +221,17 @@ class PropListTestcase(unittest.TestCase):
      stderr_redirect = io.StringIO()
      with contextlib.redirect_stderr(stderr_redirect):
        props = PropList("hello")
        optional_prop = props.get_props("foo")[2] # the last foo?=false one

        # we have duplicated foo=true and foo=true, but that's allowed
        # since they have the same value
        self.assertTrue(override_optional_props(props))

        # foo?=false should be commented out
        self.assertEqual("# Removed by post_process_props.py because " +
                         "overridden by foo=true\n#foo?=false",
                         str(optional_prop))

  def test_allowDuplicates(self):
    content = """
    # comment