From 6284076f80b021f3af66fbb21b9e8240878759ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= <felix@thegcat.net>
Date: Sun, 6 Aug 2023 12:57:12 +0200
Subject: [PATCH] Apply updateded pretix plugin cookiecutter

https://github.com/pretix/pretix-plugin-cookiecutter
---
 .gitlab-ci.yml                                | 22 +++----
 .install-hooks.sh                             |  1 -
 README.md                                     |  6 +-
 pretix_keycloak_create_user/__init__.py       | 29 ----------
 pretix_keycloak_create_user/apps.py           | 26 +++++++++
 .../locale/de/LC_MESSAGES/django.po           | 12 ++++
 .../locale/de_Informal/LC_MESSAGES/django.po  | 12 ++++
 pretixplugin.toml                             |  1 +
 pyproject.toml                                | 43 ++++++++++++++
 setup.cfg                                     |  2 +
 setup.py                                      | 57 +------------------
 11 files changed, 111 insertions(+), 100 deletions(-)
 create mode 100644 pretix_keycloak_create_user/apps.py
 create mode 100644 pretix_keycloak_create_user/locale/de/LC_MESSAGES/django.po
 create mode 100644 pretix_keycloak_create_user/locale/de_Informal/LC_MESSAGES/django.po
 create mode 100644 pyproject.toml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b3f9601..6202e00 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,19 +9,11 @@ cache:
   paths:
     - .cache
 
-docformatter:
-  stage: linting
-  image: python:3
-  before_script:
-    - pip3 install -U pip docformatter
-  script:
-    - docformatter --check -r .
-
 black:
   stage: linting
   image: python:3
   before_script:
-    - pip3 install -U pip black
+    - pip3 install -U pip pretix black
   script:
     - black --check .
 
@@ -29,7 +21,7 @@ isort:
   stage: linting
   image: python:3
   before_script:
-    - pip3 install -U pip isort
+    - pip3 install -U pip pretix isort
   script:
     - isort -c .
 
@@ -37,6 +29,14 @@ flake8:
   stage: linting
   image: python:3
   before_script:
-    - pip3 install -U pip flake8
+    - pip3 install -U pip pretix flake8
   script:
     - flake8 .
+
+check-manifest:
+  stage: linting
+  image: python:3
+  before_script:
+    - pip3 install -U pip pretix check-manifest
+  script:
+    - check-manifest .
diff --git a/.install-hooks.sh b/.install-hooks.sh
index d95267e..2e423ff 100755
--- a/.install-hooks.sh
+++ b/.install-hooks.sh
@@ -10,7 +10,6 @@ fi
 echo "#!/bin/sh" >> $GIT_DIR/hooks/pre-commit
 echo "set -e" >> $GIT_DIR/hooks/pre-commit
 echo "source $VENV_ACTIVATE" >> $GIT_DIR/hooks/pre-commit
-echo "docformatter --check -r ." >> $GIT_DIR/hooks/pre-commit
 echo "black --check ." >> $GIT_DIR/hooks/pre-commit
 echo "isort -c ." >> $GIT_DIR/hooks/pre-commit
 echo "flake8 ." >> $GIT_DIR/hooks/pre-commit
diff --git a/README.md b/README.md
index 1143483..fee6b59 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 
 This is a plugin for [pretix](https://github.com/pretix/pretix).
 
-Let users create an keycloak acccount
+Let users create a keycloak acccount.
 
 ## Installation
 
@@ -32,18 +32,16 @@ Once the plugin is enabled you can configure it in Settings > Keycloak user crea
 This plugin has CI set up to enforce a few code style rules. To check
 locally, you need these packages installed:
 
-    pip install flake8 isort black docformatter
+    pip install flake8 isort black
 
 To check your plugin for rule violations, run:
 
-    docformatter --check -r .
     black --check .
     isort -c .
     flake8 .
 
 You can auto-fix some of these issues by running:
 
-    docformatter -r .
     isort .
     black .
 
diff --git a/pretix_keycloak_create_user/__init__.py b/pretix_keycloak_create_user/__init__.py
index 92257f2..5b60188 100644
--- a/pretix_keycloak_create_user/__init__.py
+++ b/pretix_keycloak_create_user/__init__.py
@@ -1,30 +1 @@
-from django.utils.translation import gettext_lazy
-
-try:
-    from pretix.base.plugins import PluginConfig
-except ImportError:
-    raise RuntimeError("Please use pretix 2.7 or above to run this plugin!")
-
 __version__ = "1.5.0"
-
-
-class PluginApp(PluginConfig):
-    name = "pretix_keycloak_create_user"
-    verbose_name = "Keycloak user creator"
-
-    class PretixPluginMeta:
-        name = gettext_lazy("Keycloak user creator")
-        author = "Fachschaft Informatik TU Dortmund"
-        description = gettext_lazy(
-            "Create users from pretix participants in a Keycloak realm."
-        )
-        visible = True
-        version = __version__
-        category = "FEATURE"
-        compatibility = "pretix>=2.7.0"
-
-    def ready(self):
-        from . import signals  # NOQA
-
-
-default_app_config = "pretix_keycloak_create_user.PluginApp"
diff --git a/pretix_keycloak_create_user/apps.py b/pretix_keycloak_create_user/apps.py
new file mode 100644
index 0000000..82d4136
--- /dev/null
+++ b/pretix_keycloak_create_user/apps.py
@@ -0,0 +1,26 @@
+from django.utils.translation import gettext_lazy
+
+from . import __version__
+
+try:
+    from pretix.base.plugins import PluginConfig
+except ImportError:
+    raise RuntimeError("Please use pretix 2.7 or above to run this plugin!")
+
+
+class PluginApp(PluginConfig):
+    default = True
+    name = "pretix_keycloak_create_user"
+    verbose_name = "Keycloak user creator"
+
+    class PretixPluginMeta:
+        name = gettext_lazy("Keycloak user creator")
+        author = "Fachschaft Informatik TU Dortmund"
+        description = gettext_lazy("Invite Pretix participants to a Keycloak realm.")
+        visible = True
+        version = __version__
+        category = "FEATURE"
+        compatibility = "pretix>=2.7.0"
+
+    def ready(self):
+        from . import signals  # NOQA
diff --git a/pretix_keycloak_create_user/locale/de/LC_MESSAGES/django.po b/pretix_keycloak_create_user/locale/de/LC_MESSAGES/django.po
new file mode 100644
index 0000000..089106a
--- /dev/null
+++ b/pretix_keycloak_create_user/locale/de/LC_MESSAGES/django.po
@@ -0,0 +1,12 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-03-07 19:01+0100\n"
+"PO-Revision-Date: \n"
+"Last-Translator: Fachschaft Informatik TU Dortmund\n"
+"Language-Team: \n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
diff --git a/pretix_keycloak_create_user/locale/de_Informal/LC_MESSAGES/django.po b/pretix_keycloak_create_user/locale/de_Informal/LC_MESSAGES/django.po
new file mode 100644
index 0000000..089106a
--- /dev/null
+++ b/pretix_keycloak_create_user/locale/de_Informal/LC_MESSAGES/django.po
@@ -0,0 +1,12 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2017-03-07 19:01+0100\n"
+"PO-Revision-Date: \n"
+"Last-Translator: Fachschaft Informatik TU Dortmund\n"
+"Language-Team: \n"
+"Language: de\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
diff --git a/pretixplugin.toml b/pretixplugin.toml
index 9100e1f..b9f0501 100644
--- a/pretixplugin.toml
+++ b/pretixplugin.toml
@@ -2,3 +2,4 @@
 package = "pretix-keycloak-create-user"
 modules = [ "pretix_keycloak_create_user" ]
 marketplace_name = "keycloak-create-user"
+
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..f97f273
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,43 @@
+[project]
+name = "pretix-keycloak-create-user"
+dynamic = ["version"]
+description = "Invite Pretix participants to a Keycloak realm."
+readme = "README.md"
+license = {text = "MIT"}
+keywords = ["pretix"]
+authors = [
+    {name = "Fachschaft Informatik TU Dortmund", email = "root@oh14.de"},
+]
+maintainers = [
+    {name = "Fachschaft Informatik TU Dortmund", email = "root@oh14.de"},
+]
+
+dependencies = [
+    "requests"
+]
+
+[project.entry-points."pretix.plugin"]
+pretix_keycloak_create_user = "pretix_keycloak_create_user: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/tudo-fsinfo/admin/pretix-keycloak-create-user"
+repository = "https://gitlab.fachschaften.org/tudo-fsinfo/admin/pretix-keycloak-create-user"
+
+[tool.setuptools]
+include-package-data = true
+
+[tool.setuptools.dynamic]
+version = {attr = "pretix_keycloak_create_user.__version__"}
+
+[tool.setuptools.packages.find]
+include = ["pretix*"]
+namespaces = false
diff --git a/setup.cfg b/setup.cfg
index 2346f6d..12cb2ca 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -40,3 +40,5 @@ ignore =
     Makefile
     manage.py
     tests/*
+	*.po
+	.gitkeep
diff --git a/setup.py b/setup.py
index bc91499..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_keycloak_create_user 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-keycloak-create-user",
-    version=__version__,
-    description="Invite Pretix participants to a Keycloak realm.",
-    long_description=long_description,
-    long_description_content_type="text/markdown",
-    url="https://gitlab.fachschaften.org/tudo-fsinfo/admin/pretix-keycloak-create-user",
-    project_urls={
-        "Changelog": "https://gitlab.fachschaften.org/tudo-fsinfo/admin/pretix-keycloak-create-user/-/blob/main/CHANGELOG.md",
-        "Tracker": "https://gitlab.fachschaften.org/tudo-fsinfo/admin/pretix-keycloak-create-user/-/issues",
-        "Pretix Marketplace": "https://marketplace.pretix.eu/products/pretix-keycloak-create-user/",
-    },
-    author="Fachschaft Informatik TU Dortmund",
-    author_email="root@oh14.de",
-    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_keycloak_create_user=pretix_keycloak_create_user:PretixPluginMeta
-""",
-)
+setup()
-- 
GitLab