setup.py: reuse pyproject.toml
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 21 Jun 2023 19:42:38 +0000 (22:42 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Wed, 21 Jun 2023 20:26:59 +0000 (23:26 +0300)
setup.py

index 7f1a1763ca9cebc7bc16576d353d3284ee5d3c7d..a71ae28842979f118eb540dbbcee241a03ff1861 100644 (file)
--- 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"])