From f6ae368b66793c8ac97ab2fb51736e74b94ff903 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Felix=20Sch=C3=A4fer?= <felix@thegcat.net>
Date: Sat, 12 Feb 2022 20:47:44 +0100
Subject: [PATCH] Adapt to new Pretix plugin template

---
 .gitignore                              |  1 +
 .install-hooks.sh                       | 17 ++++++++++++++
 pretix_public_registrations/__init__.py |  5 +++-
 setup.cfg                               | 31 +++++++++++++++++++++++--
 setup.py                                |  9 ++++---
 5 files changed, 55 insertions(+), 8 deletions(-)
 create mode 100755 .install-hooks.sh

diff --git a/.gitignore b/.gitignore
index cc7fbd7..0f6b8f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,6 +51,7 @@ coverage.xml
 
 # Django stuff:
 *.log
+data/
 
 # Sphinx documentation
 docs/_build/
diff --git a/.install-hooks.sh b/.install-hooks.sh
new file mode 100755
index 0000000..d95267e
--- /dev/null
+++ b/.install-hooks.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+REPO_DIR=$(git rev-parse --show-toplevel)
+GIT_DIR=$REPO_DIR/.git
+VENV_ACTIVATE=$VIRTUAL_ENV/bin/activate
+if [[ ! -f $VENV_ACTIVATE ]]
+then
+    echo "Could not find your virtual environment"
+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
+chmod +x $GIT_DIR/hooks/pre-commit
diff --git a/pretix_public_registrations/__init__.py b/pretix_public_registrations/__init__.py
index f99c0ef..0ea0b8f 100644
--- a/pretix_public_registrations/__init__.py
+++ b/pretix_public_registrations/__init__.py
@@ -4,6 +4,8 @@ try:
 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'
@@ -14,7 +16,8 @@ class PluginApp(PluginConfig):
         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 = '1.4.0'
+        version = __version__
+        category = "FEATURE"
         compatibility = "pretix>=2.7.0"
 
     def ready(self):
diff --git a/setup.cfg b/setup.cfg
index 5cd9371..5bab541 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -9,6 +9,33 @@ default_section = THIRDPARTY
 include_trailing_comma = true
 known_third_party = pretix
 known_standard_library = typing
-multi_line_output = 5
-not_skip = __init__.py
+multi_line_output = 3
 skip = setup.py
+use_parentheses = True
+force_grid_wrap = 0
+line_length = 88
+known_first_party = pretix_public_registrations
+
+[tool:pytest]
+DJANGO_SETTINGS_MODULE = pretix.testutils.settings
+
+[coverage:run]
+source = pretix_public_registrations
+omit = */migrations/*,*/urls.py,*/tests/*
+
+[coverage:report]
+exclude_lines =
+    pragma: no cover
+    def __str__
+    der __repr__
+    if settings.DEBUG
+    NOQA
+    NotImplementedError
+
+[check-manifest]
+ignore =
+    .update-locales.sh
+    .install-hooks.sh
+    Makefile
+    manage.py
+    tests/*
diff --git a/setup.py b/setup.py
index 189fde2..03ca060 100644
--- a/setup.py
+++ b/setup.py
@@ -1,16 +1,15 @@
-# -*- coding: utf-8 -*-
-
 import os
 from distutils.command.build import build
 
 from django.core import management
 from setuptools import setup, find_packages
 
+from pretix_public_registrations import __version__
 
 try:
     with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as f:
         long_description = f.read()
-except:
+except Exception:
     long_description = ''
 
 
@@ -27,7 +26,7 @@ cmdclass = {
 
 setup(
     name='pretix-public-registrations',
-    version='1.4.0',
+    version=__version__,
     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.',
     long_description=long_description,
     keywords="pretix public registrations",
@@ -38,7 +37,7 @@ setup(
     },
     author='Felix Schäfer, Dominik Weitz',
     author_email='admin@kif.rocks',
-    license='MIT License',
+    license='MIT',
     classifiers=[
         "Development Status :: 5 - Production/Stable",
         "Environment :: Plugins",
-- 
GitLab