From 542641b3e0c98f209d70498c706964619d198475 Mon Sep 17 00:00:00 2001
From: Dmitry Selyutin <ghostmansd@gmail.com>
Date: Wed, 21 Jun 2023 22:42:38 +0300
Subject: [PATCH] setup.py: reuse pyproject.toml

---
 setup.py | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 7f1a176..a71ae28 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,24 @@
+import toml
 from setuptools import setup
 
 if __name__ == "__main__":
-    setup()
+    with open("pyproject.toml", "r", encoding="UTF-8") as stream:
+        pyproject = toml.load(stream)
+        arguments = pyproject["project"]
+
+        arguments["packages"] = ["mdis"]
+        arguments["package_dir"] = {"": "src"}
+
+        authors = []
+        emails = []
+        for author in arguments.pop("authors"):
+            authors.append(author["name"])
+            emails.append(author["email"])
+        arguments["author"] = ", ".join(authors)
+        arguments["author_email"] = ", ".join(emails)
+
+        arguments.pop("urls")
+        arguments.pop("readme")
+        arguments.pop("requires-python")
+
+        setup(**pyproject["project"])
-- 
2.30.2