From: Dmitry Selyutin <ghostmansd@gmail.com>
Date: Wed, 21 Jun 2023 19:42:38 +0000 (+0300)
Subject: setup.py: reuse pyproject.toml
X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=542641b3e0c98f209d70498c706964619d198475;p=mdis.git

setup.py: reuse pyproject.toml
---

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"])