(env, options)
| 244 | |
| 245 | |
| 246 | def 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 | |
| 283 | def CMD_RUNTESTS(options): |
nothing calls this directly
no outgoing calls
no test coverage detected