diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b3f96014ce44731b99564ecdd3c33ee1403010e3..6202e003ab3b9d1fa2684ce731202254d495e888 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 d95267ecf73e48947d916d83b8b2bbf6ee7382bd..2e423ff1aceb44b2b2563a9ec548c770dba9a924 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 11434836ab8549a5c1ef90060c08024f1d339051..fee6b595f3a3fbd50060831b7fc918fdb7acfcc1 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 92257f2788b6b73151a7379a949126b0203bbc82..5b601886131b044f9738fb1a32022bb045a52787 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 0000000000000000000000000000000000000000..82d41367ffaafc4f5b0302a4006cc8afa24014ca --- /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 0000000000000000000000000000000000000000..089106a1391dab7545588009c6f6dda8c31fe932 --- /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 0000000000000000000000000000000000000000..089106a1391dab7545588009c6f6dda8c31fe932 --- /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 9100e1fb30328fd5e83bf2dc4feacdbe74406b9b..b9f0501adcc19556e03065881a6bbb9a693fc28b 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 0000000000000000000000000000000000000000..f97f2738ad29029d080972e524336e21ba923936 --- /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 2346f6d8f9a972b2cc2a630eb2f9f7d7d2e2aa8a..12cb2cab1d55e566ff2daf04e267036c1ee58b69 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 bc9149975847b643c24d1606cac9337dcc599abf..b024da80e9c1c8c800cc1b46e90c1e783cb446cc 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()