MCPcopy Create free account
hub / github.com/django/code.djangoproject.com / CMD_COMPONENTS

Function CMD_COMPONENTS

traccheck.py:246–280  ·  view source on GitHub ↗
(env, options)

Source from the content-addressed store, hash-verified

244
245
246def CMD_COMPONENTS(env, options):
247 components = [
248 component
249 for component in sorted(env.registered_components)
250 if env.is_component_enabled(component)
251 ]
252
253 if options.check is None:
254 curtime = datetime.now().replace(microsecond=0)
255 header = (
256 f"# generated by {__file__} on {curtime} with Trac version {TRACVERSION}"
257 )
258 print(header, file=options.output)
259 for component in components:
260 print(component, file=options.output)
261 else:
262 expected_components = [
263 line.rstrip("\n") for line in options.check if not line.startswith("#")
264 ]
265
266 if components == expected_components:
267 printerr("The list of installed components matches the provided file")
268 return 0
269
270 difference = difflib.context_diff(
271 expected_components,
272 components,
273 fromfile=options.check.name,
274 tofile=f"<installed components from {options.trac_env}>",
275 lineterm="",
276 )
277 printerr("The list of installed components does not match the provided file:")
278 printerr()
279 printerr("\n".join(difference))
280 return 1
281
282
283def CMD_RUNTESTS(options):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected