From 29653fc04b821af50f3b95701ef9ccc344fde303 Mon Sep 17 00:00:00 2001 From: Albrecht Muehlenschulte Date: Fri, 6 May 2022 12:43:33 +0200 Subject: [PATCH 1/4] adds script --- matrix_webhook/__main__.py | 7 ++++++- pyproject.toml | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/matrix_webhook/__main__.py b/matrix_webhook/__main__.py index da99dcc..ff32a7b 100644 --- a/matrix_webhook/__main__.py +++ b/matrix_webhook/__main__.py @@ -3,7 +3,12 @@ import logging from . import app, conf -if __name__ == "__main__": + +def main(): log_format = "%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(message)s" logging.basicConfig(level=50 - 10 * conf.VERBOSE, format=log_format) app.run() + + +if __name__ == "__main__": + main() diff --git a/pyproject.toml b/pyproject.toml index f929ad2..2896dc2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,3 +27,6 @@ ignore = ["D200", "D203", "D204", "D212"] [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +matrix-webhook = "matrix_webhook.__main__:main" From 7b9605a363c7c7d5102ffd1a3d113012cbe61dd5 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Mon, 1 Aug 2022 23:46:37 +0200 Subject: [PATCH 2/4] document scripts --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3392da6..f87cc0f 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ docker pull nim65s/matrix-webhook Create a matrix user for the bot, and launch this app it with the following arguments or environment variables: ``` +matrix-webhook -h +# OR python -m matrix_webhook -h # OR docker run --rm -it nim65s/matrix-webhook -h From 50e93180ee6fead1160bf1a259e0d563bdc82662 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Mon, 1 Aug 2022 23:46:13 +0200 Subject: [PATCH 3/4] test scripts --- .github/workflows/entrypoint.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/workflows/entrypoint.yml diff --git a/.github/workflows/entrypoint.yml b/.github/workflows/entrypoint.yml new file mode 100644 index 0000000..9425846 --- /dev/null +++ b/.github/workflows/entrypoint.yml @@ -0,0 +1,12 @@ +name: Test entrypoints +on: [push, pull_request] +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: python -m pip install -U pip + - run: python -m pip install . + - run: matrix-webhook -h + - run: python -m matrix_webhook -h From 6c7d015b8def638529ac648caa34fe2648676d42 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Mon, 1 Aug 2022 23:59:20 +0200 Subject: [PATCH 4/4] add missing docstring --- matrix_webhook/__main__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/matrix_webhook/__main__.py b/matrix_webhook/__main__.py index ff32a7b..18d4fcc 100644 --- a/matrix_webhook/__main__.py +++ b/matrix_webhook/__main__.py @@ -5,6 +5,7 @@ from . import app, conf def main(): + """Start everything.""" log_format = "%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(message)s" logging.basicConfig(level=50 - 10 * conf.VERBOSE, format=log_format) app.run()