From 93a84617a81208bf4419064db460945b330570d7 Mon Sep 17 00:00:00 2001 From: missytake Date: Fri, 13 Oct 2023 20:04:10 +0200 Subject: [PATCH] add doveauth entrypoint for lua --- doveauth/pyproject.toml | 3 +++ doveauth/src/doveauth/__init__.py | 0 doveauth/{ => src/doveauth}/doveauth.lua | 0 doveauth/{ => src/doveauth}/doveauth.py | 6 +++++- doveauth/{ => src/doveauth}/test_doveauth.lua | 0 doveauth/{ => src/doveauth}/test_doveauth.py | 0 scripts/init.sh | 2 ++ 7 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 doveauth/src/doveauth/__init__.py rename doveauth/{ => src/doveauth}/doveauth.lua (100%) rename doveauth/{ => src/doveauth}/doveauth.py (98%) rename doveauth/{ => src/doveauth}/test_doveauth.lua (100%) rename doveauth/{ => src/doveauth}/test_doveauth.py (100%) diff --git a/doveauth/pyproject.toml b/doveauth/pyproject.toml index 95a2c6d4..a51a1f28 100644 --- a/doveauth/pyproject.toml +++ b/doveauth/pyproject.toml @@ -6,6 +6,9 @@ build-backend = "setuptools.build_meta" name = "doveauth" version = "0.1" +[project.scripts] +doveauth = "doveauth.doveauth:main" + [tool.pytest.ini_options] addopts = "-v -ra --strict-markers" diff --git a/doveauth/src/doveauth/__init__.py b/doveauth/src/doveauth/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/doveauth/doveauth.lua b/doveauth/src/doveauth/doveauth.lua similarity index 100% rename from doveauth/doveauth.lua rename to doveauth/src/doveauth/doveauth.lua diff --git a/doveauth/doveauth.py b/doveauth/src/doveauth/doveauth.py similarity index 98% rename from doveauth/doveauth.py rename to doveauth/src/doveauth/doveauth.py index 9741f2fa..ba6db22f 100644 --- a/doveauth/doveauth.py +++ b/doveauth/src/doveauth/doveauth.py @@ -45,7 +45,7 @@ def dump_result(res): print(f"{key}={value}") -if __name__ == "__main__": +def main(): if sys.argv[1] == "hexauth": login = base64.b16decode(sys.argv[2]).decode() password = base64.b16decode(sys.argv[3]).decode() @@ -55,3 +55,7 @@ if __name__ == "__main__": login = base64.b16decode(sys.argv[2]).decode() res = lookup_user(login) dump_result(res) + + +if __name__ == "__main__": + main() diff --git a/doveauth/test_doveauth.lua b/doveauth/src/doveauth/test_doveauth.lua similarity index 100% rename from doveauth/test_doveauth.lua rename to doveauth/src/doveauth/test_doveauth.lua diff --git a/doveauth/test_doveauth.py b/doveauth/src/doveauth/test_doveauth.py similarity index 100% rename from doveauth/test_doveauth.py rename to doveauth/src/doveauth/test_doveauth.py diff --git a/scripts/init.sh b/scripts/init.sh index a9f0358e..1dcabb53 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -2,3 +2,5 @@ python3 -m venv chatmail-pyinfra/venv chatmail-pyinfra/venv/bin/pip install pyinfra chatmail-pyinfra/venv/bin/pip install -e chatmail-pyinfra +python3 -m venv doveauth/venv +doveauth/venv/bin/pip install -e doveauth