From e4e424d6f4968190b51c7333c9ec47a9026745b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= <felix@thegcat.net>
Date: Wed, 4 Oct 2023 11:39:12 +0200
Subject: [PATCH] Move to pyproject.toml

---
 CHANGELOG.md   |  2 ++
 pyproject.toml | 52 +++++++++++++++++++++++++++++++++++++++++++++
 setup.py       | 57 ++------------------------------------------------
 3 files changed, 56 insertions(+), 55 deletions(-)
 create mode 100644 pyproject.toml

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2cec291..375b220 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 ## [Unreleased]
+### Changed
+- Move to pyproject.toml
 
 ## [1.7.1] - 2023-10-04
 ### Fixed
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..1ff19c1
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,52 @@
+[project]
+name = "pretix-matrix-inviter"
+dynamic = ["version"]
+description = "Invite pretix participants to a Matrix Room or Space."
+readme = "README.md"
+license = {text = "MIT License"}
+keywords = ["pretix", "matrix"]
+authors = [
+    {name = "Felix Schäfer", email = "admin@kif.rocks"},
+]
+maintainers = [
+    {name = "Felix Schäfer", email = "admin@kif.rocks"},
+]
+classifiers = [
+    "Development Status :: 5 - Production/Stable",
+    "Framework :: Django",
+    "License :: OSI Approved :: MIT License",
+    "Topic :: Communications :: Chat",
+]
+
+dependencies = [
+    "requests",
+]
+
+[project.entry-points."pretix.plugin"]
+pretix_matrix_inviter = "pretix_matrix_inviter:PretixPluginMeta"
+
+[project.entry-points."distutils.commands"]
+build = "pretix_plugin_build.build:CustomBuild"
+
+[build-system]
+requires = [
+    "setuptools",
+    "pretix-plugin-build",
+]
+
+[project.urls]
+Homepage = "https://gitlab.fachschaften.org/kif/pretix-matrix-inviter"
+Repository = "https://gitlab.fachschaften.org/kif/pretix-matrix-inviter"
+Changelog = "https://gitlab.fachschaften.org/kif/pretix-matrix-inviter/-/blob/main/CHANGELOG.md"
+Tracker = "https://gitlab.fachschaften.org/kif/pretix-matrix-inviter/-/issues"
+"pretix Marketplace" = "https://marketplace.pretix.eu/products/pretix-matrix-inviter/"
+
+[tool.setuptools]
+include-package-data = true
+
+[tool.setuptools.dynamic]
+version = {attr = "pretix_matrix_inviter.__version__"}
+
+[tool.setuptools.packages.find]
+include = ["pretix*"]
+namespaces = false
diff --git a/setup.py b/setup.py
index c98e867..b024da8 100644
--- a/setup.py
+++ b/setup.py
@@ -1,57 +1,4 @@
-import os
-from distutils.command.build import build
+from setuptools import setup
 
-from django.core import management
-from setuptools import find_packages, setup
 
-from pretix_matrix_inviter import __version__
-
-
-try:
-    with open(
-        os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf-8"
-    ) as f:
-        long_description = f.read()
-except Exception:
-    long_description = ""
-
-
-class CustomBuild(build):
-    def run(self):
-        management.call_command("compilemessages", verbosity=1)
-        build.run(self)
-
-
-cmdclass = {"build": CustomBuild}
-
-
-setup(
-    name="pretix-matrix-inviter",
-    version=__version__,
-    description="Invite pretix participants to a Matrix Room or Space.",
-    long_description=long_description,
-    long_description_content_type="text/markdown",
-    url="https://gitlab.fachschaften.org/kif/pretix-matrix-inviter",
-    project_urls={
-        "Changelog": "https://gitlab.fachschaften.org/kif/pretix-matrix-inviter/-/blob/main/CHANGELOG.md",
-        "Tracker": "https://gitlab.fachschaften.org/kif/pretix-matrix-inviter/-/issues",
-        "pretix Marketplace": "https://marketplace.pretix.eu/products/pretix-matrix-inviter/",
-    },
-    author="Felix Schäfer",
-    author_email="admin@kif.rocks",
-    license="MIT",
-    classifiers=[
-        "Development Status :: 5 - Production/Stable",
-        "Framework :: Django",
-        "License :: OSI Approved :: MIT License",
-        "Topic :: Communications :: Chat",
-    ],
-    install_requires=["requests"],
-    packages=find_packages(exclude=["tests", "tests.*"]),
-    include_package_data=True,
-    cmdclass=cmdclass,
-    entry_points="""
-[pretix.plugin]
-pretix_matrix_inviter=pretix_matrix_inviter:PretixPluginMeta
-""",
-)
+setup()
-- 
GitLab