From 855b1c04663d3e7d542cfe7b61e094e03c935b22 Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Sun, 26 Nov 2023 16:13:11 +0100 Subject: [PATCH] fixed dependency and removed unused script --- requirements.txt | 2 +- update_doc | 41 ----------------------------------------- 2 files changed, 1 insertion(+), 42 deletions(-) delete mode 100755 update_doc diff --git a/requirements.txt b/requirements.txt index 151f0db..018a005 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -ansible-module>0.1.3 +ansible-module>=0.1.3 diff --git a/update_doc b/update_doc deleted file mode 100755 index 3e36c26..0000000 --- a/update_doc +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/python -import importlib -import pathlib -import re -import sys - -sys.path.append(".") -mindocstring = "DOCUMENTATION = ''''''" -moduledir = pathlib.Path("plugins/modules") -regex = re.compile("DOCUMENTATION *= *r?(?P\"{3}|'{3})(---)?.*?(?P=quote)", re.MULTILINE | re.DOTALL) - -if __name__ == "__main__": - for modfile in moduledir.iterdir(): - if modfile.name in ( "__init__.py", "__pycache__", "unit.py.example"): - continue - mod = importlib.import_module(".".join((modfile.parts[:-1])+(modfile.stem,))) - if hasattr(mod, "Module"): - module = mod.Module - elif hasattr(mod, "__module_name__"): - module = getattr(mod, mod.__module_name__) - else: - print("Error loading Module of File: {}. No Module or __module_name__ defined".format(modfile)) - continue - try: - moddoc = module.doc() - except AttributeError: - print("Broken module. skipping {}".format(modfile)) - continue - except Exception as e: - print("Error in documentation of module {}: {}".format(modfile, e)) - continue - moddata = modfile.read_text() - match = regex.search(moddata) - if not match: - print("no Documentation set for module {}. Please add at least \"{}\" to the file".format(modfile.stem, mindocstring)) - continue - newmod = "{pre}DOCUMENTATION = {quote}{doc}{quote}{post}".format(pre=moddata[:match.start()], quote=match.group("quote"), doc=moddoc, post=moddata[match.end():]) - modfile.write_text(newmod) - print("updated the documentation of module {}".format(module.name)) - -# code: python