From 2f2355b70523718ddaf4cada563087fdfcc35ffc Mon Sep 17 00:00:00 2001 From: stvn Date: Tue, 18 May 2021 15:57:42 -0700 Subject: [PATCH] build: add script to list installed XBlocks Story ===== As an XBlock developer, I want to know which XBlocks are installed so I can debug (and know which to add to Advanced Settings in Studio). Testing ======= - `make studio-shell` - `python scripts/xblock/list-installed.py` Integration =========== I plan to invoke this from `devstack` (after installing XBlocks). Tickets ======= Fixes CENG-95 Fixes stvstnfrd/openedx-meta#153 --- scripts/xblock/list-installed.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 scripts/xblock/list-installed.py diff --git a/scripts/xblock/list-installed.py b/scripts/xblock/list-installed.py new file mode 100644 index 0000000000..c1152d749d --- /dev/null +++ b/scripts/xblock/list-installed.py @@ -0,0 +1,31 @@ +""" +Lookup list of installed XBlocks, to aid XBlock developers +""" +import pkg_resources + + +def get_without_builtins(): + """ + Get all installed XBlocks + + but try to omit built-in XBlocks, else the output is less helpful + """ + xblocks = [ + entry_point.name + for entry_point in pkg_resources.iter_entry_points('xblock.v1') + if not entry_point.module_name.startswith('xmodule') + ] + xblocks = sorted(xblocks) + return xblocks + + +def main(): + """ + Run the main script + """ + for name in get_without_builtins(): + print(name) + + +if __name__ == '__main__': + main()