From 9ed31cc5c8b11bb185df4205d684bbf4826300d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna=20=E2=80=9CCyberTailor=E2=80=9D?= Date: Mon, 8 May 2023 19:04:32 +0500 Subject: [PATCH] Added packaging (via Flit) --- mastoposter/__init__.py | 3 +++ mastoposter/__main__.py | 8 +++----- pyproject.toml | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 pyproject.toml diff --git a/mastoposter/__init__.py b/mastoposter/__init__.py index 3856348..47c9b16 100644 --- a/mastoposter/__init__.py +++ b/mastoposter/__init__.py @@ -26,6 +26,9 @@ from mastoposter.integrations import ( ) from mastoposter.types import Status +__version__ = "0" +__description__ = "Mastodon to [anything] reposter" + logger = getLogger() diff --git a/mastoposter/__main__.py b/mastoposter/__main__.py index 81b52dd..195b61a 100644 --- a/mastoposter/__main__.py +++ b/mastoposter/__main__.py @@ -23,7 +23,7 @@ from logging import ( getLevelName, getLogger, ) -from sys import stdout +from sys import argv, stdout from mastoposter import execute_integrations, load_integrations_from from mastoposter.integrations import FilteredIntegration from mastoposter.sources import websocket_source @@ -95,7 +95,7 @@ async def listen( await execute_integrations(status, drains) -def main(config_path: str): +def main(config_path: str = argv[1]): conf = ConfigParser(interpolation=ExtendedInterpolation()) conf.read(config_path) @@ -137,6 +137,4 @@ def main(config_path: str): if __name__ == "__main__": - from sys import argv - - main(argv[1]) + main() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8cfac9f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,37 @@ +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "mastoposter" +authors = [ + {name = "hatkidchan", email = "hatkidchan@gmail.com"} +] +readme = "README.md" +license = {file = "LICENSE"} +classifiers = [ + "Environment :: No Input/Output (Daemon)", + "Intended Audience :: End Users/Desktop", + "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", + "Topic :: Communications", + "Topic :: Internet :: WWW/HTTP" +] +keywords = ["mastodon", "discord", "telegram"] +requires-python = ">=3.7" +dependencies = [ + "Jinja2", + "beautifulsoup4", + "emoji", + "httpx", + "websockets" +] +dynamic = ["version", "description"] + +[project.urls] +Source = "https://github.com/hatkidchan/mastoposter" + +[project.scripts] +mastoposter = "mastoposter.__main__:main" + +[tool.flit.sdist] +include = ["config.ini"]