From fc7659258a0ecf9b81ac4aabb5833b9560aaba36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= <felix@thegcat.net>
Date: Mon, 6 Feb 2023 21:09:33 +0100
Subject: [PATCH] Apply updateded pretix plugin cookiecutter

https://github.com/pretix/pretix-plugin-cookiecutter
---
 .gitlab-ci.yml                          | 16 ++++++-------
 .install-hooks.sh                       |  1 -
 MANIFEST.in                             |  2 ++
 README.rst                              | 30 ++++++++++++++++++++-----
 pretix_public_registrations/__init__.py | 30 -------------------------
 pretix_public_registrations/apps.py     | 29 ++++++++++++++++++++++++
 pretixplugin.toml                       |  5 +++++
 setup.cfg                               |  3 +++
 setup.py                                |  3 ++-
 9 files changed, 73 insertions(+), 46 deletions(-)
 create mode 100644 pretix_public_registrations/apps.py
 create mode 100644 pretixplugin.toml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b3f9601..6873363 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,14 +9,6 @@ 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
@@ -40,3 +32,11 @@ flake8:
     - pip3 install -U pip flake8
   script:
     - flake8 .
+
+check-manifest:
+  stage: linting
+  image: python:3
+  before_script:
+    - pip3 install -U pip 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/MANIFEST.in b/MANIFEST.in
index 621bf7a..921a18f 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,3 +1,5 @@
 recursive-include pretix_public_registrations/static *
 recursive-include pretix_public_registrations/templates *
 recursive-include pretix_public_registrations/locale *
+include LICENSE
+exclude .gitlab-ci.yml
diff --git a/README.rst b/README.rst
index d89c444..ae1110e 100644
--- a/README.rst
+++ b/README.rst
@@ -3,23 +3,41 @@ Pretix public registrations
 
 This is a plugin for `pretix`_.
 
+This plugin will give the option to attendees of an event to mark their registration as public. Public registrations
+will be shown along their answers to questions marked as public by the organizers on a world-readable page.
+
 Development setup
 -----------------
 
 1. Make sure that you have a working `pretix development setup`_.
 
-2. Clone this repository, eg to ``local/pretix-public-registrations``.
+2. Clone this repository.
 
 3. Activate the virtual environment you use for pretix development.
 
-4. Execute ``python setup.py develop`` within this directory to register this
-   application with pretix's plugin registry.
+4. Execute ``python setup.py develop`` within this directory to register this application with pretix's plugin registry.
 
 5. Execute ``make`` within this directory to compile translations.
 
-6. Restart your local pretix server. You can now use the plugin from this
-   repository for your events by enabling it in the 'plugins' tab in the
-   settings.
+6. Restart your local pretix server. You can now use the plugin from this repository for your events by enabling it in
+   the 'plugins' tab in the settings.
+
+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
+
+To check your plugin for rule violations, run::
+
+    black --check .
+    isort -c .
+    flake8 .
+
+You can auto-fix some of these issues by running::
+
+    isort .
+    black .
+
+To automatically check for these issues before you commit, you can run ``.install-hooks``.
 
 
 License
diff --git a/pretix_public_registrations/__init__.py b/pretix_public_registrations/__init__.py
index bb61b3f..3e8d9f9 100644
--- a/pretix_public_registrations/__init__.py
+++ b/pretix_public_registrations/__init__.py
@@ -1,31 +1 @@
-from django.utils.translation import gettext_lazy as _
-
-try:
-    from pretix.base.plugins import PluginConfig
-except ImportError:
-    raise RuntimeError("Please use pretix 2.7 or above to run this plugin!")
-
 __version__ = "1.4.0"
-
-
-class PluginApp(PluginConfig):
-    name = "pretix_public_registrations"
-    verbose_name = "Pretix public registrations"
-
-    class PretixPluginMeta:
-        name = _("Pretix public registrations")
-        author = "Felix Schäfer, Dominik Weitz"
-        description = _(
-            "This plugin will give the option to attendees of an event to mark their registration as public. "
-            "Public registrations will be shown along their answers to questions marked as public by the organizers on a world-readable page."
-        )
-        visible = True
-        version = __version__
-        category = "FEATURE"
-        compatibility = "pretix>=2.7.0"
-
-    def ready(self):
-        from . import signals  # NOQA
-
-
-default_app_config = "pretix_public_registrations.PluginApp"
diff --git a/pretix_public_registrations/apps.py b/pretix_public_registrations/apps.py
new file mode 100644
index 0000000..1aa6464
--- /dev/null
+++ b/pretix_public_registrations/apps.py
@@ -0,0 +1,29 @@
+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):
+    name = "pretix_public_registrations"
+    verbose_name = "Pretix public registrations"
+
+    class PretixPluginMeta:
+        name = gettext_lazy("Pretix public registrations")
+        author = "Felix Schäfer, Dominik Weitz"
+        description = gettext_lazy(
+            "This plugin will give the option to attendees of an event to mark their registration as public. "
+            "Public registrations will be shown along their answers to questions marked as public by the organizers on "
+            "a world-readable page."
+        )
+        visible = True
+        version = __version__
+        category = "FEATURE"
+        compatibility = "pretix>=2.7.0"
+
+    def ready(self):
+        from . import signals  # NOQA
diff --git a/pretixplugin.toml b/pretixplugin.toml
new file mode 100644
index 0000000..186a19b
--- /dev/null
+++ b/pretixplugin.toml
@@ -0,0 +1,5 @@
+[plugin]
+package = "pretix-public-registrations"
+modules = [ "pretix_public_registrations" ]
+marketplace_name = "public-registrations"
+
diff --git a/setup.cfg b/setup.cfg
index 5bab541..697a7d5 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -36,6 +36,9 @@ exclude_lines =
 ignore =
     .update-locales.sh
     .install-hooks.sh
+    pretixplugin.toml
     Makefile
     manage.py
     tests/*
+	*.po
+	.gitkeep
diff --git a/setup.py b/setup.py
index b8901e5..f0817c5 100644
--- a/setup.py
+++ b/setup.py
@@ -2,10 +2,11 @@ import os
 from distutils.command.build import build
 
 from django.core import management
-from setuptools import setup, find_packages
+from setuptools import find_packages, setup
 
 from pretix_public_registrations import __version__
 
+
 try:
     with open(
         os.path.join(os.path.dirname(__file__), "README.rst"), encoding="utf-8"
-- 
GitLab