MCPcopy Create free account
hub / github.com/Kitware/CMake / __merge_json_values

Function __merge_json_values

Source/cmConvertMSBuildXMLToJSON.py:177–202  ·  view source on GitHub ↗

Merges the values between the current and previous run of the script.

(current, previous)

Source from the content-addressed store, hash-verified

175###########################################################################################
176# private joining functions
177def __merge_json_values(current, previous):
178 """Merges the values between the current and previous run of the script."""
179 for value in current:
180 name = value['name']
181
182 # Find the previous value
183 previous_value = __find_and_remove_value(previous, value)
184
185 if previous_value is not None:
186 flags = value['flags']
187 previous_flags = previous_value['flags']
188
189 if flags != previous_flags:
190 logging.warning(
191 'Flags for %s are different. Using previous value.', name)
192
193 value['flags'] = previous_flags
194 else:
195 logging.warning('Value %s is a new value', name)
196
197 for value in previous:
198 name = value['name']
199 logging.warning(
200 'Value %s not present in current run. Appending value.', name)
201
202 current.append(value)
203
204
205def __find_and_remove_value(list, compare):

Callers 1

mainFunction · 0.85

Calls 2

__find_and_remove_valueFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…