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

Function _build_component_tree

traccheck.py:17–33  ·  view source on GitHub ↗

Build a recursive data structure of all given component paths. For example: "trac.admin.web_ui.PluginAdminPanel" -> {"trac": {"admin": {"web_ui": "PluginAdminPanel": {}}}} "tracdjangoplugin.*" -> {"tracdjangoplugin": {"*": {}}} This will be used to determine if some config

(import_paths)

Source from the content-addressed store, hash-verified

15
16
17def _build_component_tree(import_paths):
18 """
19 Build a recursive data structure of all given component paths. For example:
20
21 "trac.admin.web_ui.PluginAdminPanel" -> {"trac": {"admin": {"web_ui": "PluginAdminPanel": {}}}}
22 "tracdjangoplugin.*" -> {"tracdjangoplugin": {"*": {}}}
23
24 This will be used to determine if some configured components are installed.
25 """
26 tree = {}
27 for path in import_paths:
28 branch = tree
29 for node in path.split("."):
30 branch.setdefault(node, {})
31 branch = branch[node]
32
33 return tree
34
35
36printerr = partial(print, file=sys.stderr)

Calls

no outgoing calls