From 2e2efbff9d636f276c90df0f72332ac4ca666745 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 9 Aug 2024 11:02:55 +0200 Subject: [PATCH 1/6] Remove duplicate project setup file --- README.rst | 2 +- setup.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) delete mode 100644 setup.py diff --git a/README.rst b/README.rst index 51a38e6..e33a33f 100644 --- a/README.rst +++ b/README.rst @@ -59,7 +59,7 @@ Development setup 3. Activate the virtual environment you use for pretalx development. -4. Execute ``python setup.py develop`` within this directory to register +4. Execute ``python -m pip install -e .`` within this directory to register this application with pretalx's plugin registry. 5. Execute ``make`` within this directory to compile translations. diff --git a/setup.py b/setup.py deleted file mode 100644 index 6068493..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -from setuptools import setup - -setup() From d54087b7d02cb3a40adaac20af0f41bea2f26015 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 9 Aug 2024 11:04:00 +0200 Subject: [PATCH 2/6] Use dynamic version --- pretalx_broadcast_tools/__init__.py | 1 + pretalx_broadcast_tools/apps.py | 3 ++- pyproject.toml | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 pretalx_broadcast_tools/__init__.py diff --git a/pretalx_broadcast_tools/__init__.py b/pretalx_broadcast_tools/__init__.py new file mode 100644 index 0000000..8a124bf --- /dev/null +++ b/pretalx_broadcast_tools/__init__.py @@ -0,0 +1 @@ +__version__ = "2.2.0" diff --git a/pretalx_broadcast_tools/apps.py b/pretalx_broadcast_tools/apps.py index 49afbca..77ab4ac 100644 --- a/pretalx_broadcast_tools/apps.py +++ b/pretalx_broadcast_tools/apps.py @@ -1,5 +1,6 @@ from django.apps import AppConfig from django.utils.translation import gettext_lazy +from pretalx_broadcast_tools import __version__ class PluginApp(AppConfig): @@ -15,7 +16,7 @@ class PluginApp(AppConfig): "embedded into your broadcasting software" ) visible = True - version = "2.2.0" + version = __version__ category = "FEATURE" def ready(self): diff --git a/pyproject.toml b/pyproject.toml index bec5d33..bc30223 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pretalx-broadcast-tools" -version = "2.2.0" +dynamic = ["version"] description = """ Some tools which can be used for supporting a broadcasting software. This currently includes a generator for PDF printouts, a 'lower thirds' @@ -35,5 +35,8 @@ repository = "https://github.com/Kunsi/pretalx-plugin-broadcast-tools.git" [tool.setuptools] include-package-data = true +[tool.setuptools.dynamic] +version = {attr = "pretalx_broadcast_tools.__version__"} + [tool.setuptools.packages.find] include = ["pretalx*"] From 6f8c536cb895e8fb0dcc89193387880e33847e26 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 9 Aug 2024 11:04:13 +0200 Subject: [PATCH 3/6] Build wheels --- pyproject.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index bc30223..5ee17b7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,9 +24,8 @@ dependencies = [ pretalx_broadcast_tools = "pretalx_broadcast_tools:PretalxPluginMeta" [build-system] -requires = [ - "setuptools", -] +build-backend = "setuptools.build_meta" +requires = ["setuptools", "wheel"] [project.urls] homepage = "https://github.com/Kunsi/pretalx-plugin-broadcast-tools" From 545bdfb96646f82b09968c0b0150f235815cd3cb Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 9 Aug 2024 11:12:02 +0200 Subject: [PATCH 4/6] Code style --- pretalx_broadcast_tools/apps.py | 1 + pretalx_broadcast_tools/exporter.py | 2 +- pretalx_broadcast_tools/views/qr.py | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pretalx_broadcast_tools/apps.py b/pretalx_broadcast_tools/apps.py index 77ab4ac..4834890 100644 --- a/pretalx_broadcast_tools/apps.py +++ b/pretalx_broadcast_tools/apps.py @@ -1,5 +1,6 @@ from django.apps import AppConfig from django.utils.translation import gettext_lazy + from pretalx_broadcast_tools import __version__ diff --git a/pretalx_broadcast_tools/exporter.py b/pretalx_broadcast_tools/exporter.py index 2c2d2bd..fcd87e1 100644 --- a/pretalx_broadcast_tools/exporter.py +++ b/pretalx_broadcast_tools/exporter.py @@ -17,7 +17,7 @@ from reportlab.platypus import ( TableStyle, ) -from .utils.placeholders import placeholders +from pretalx_broadcast_tools.utils.placeholders import placeholders A4_WIDTH, A4_HEIGHT = A4 PAGE_PADDING = 10 * mm diff --git a/pretalx_broadcast_tools/views/qr.py b/pretalx_broadcast_tools/views/qr.py index 618b562..ec55d65 100644 --- a/pretalx_broadcast_tools/views/qr.py +++ b/pretalx_broadcast_tools/views/qr.py @@ -1,4 +1,4 @@ -from xml.etree import ElementTree as ET +from xml.etree import ElementTree import qrcode import qrcode.image.svg @@ -15,7 +15,7 @@ class BroadcastToolsFeedbackQrCodeSvg(View): image = qrcode.make( f"{domain}{talk.urls.feedback}", image_factory=qrcode.image.svg.SvgImage ) - svg_data = mark_safe(ET.tostring(image.get_image()).decode()) + svg_data = mark_safe(ElementTree.tostring(image.get_image()).decode()) return HttpResponse(svg_data, content_type="image/svg+xml") @@ -26,5 +26,5 @@ class BroadcastToolsPublicQrCodeSvg(View): image = qrcode.make( f"{domain}{talk.urls.public}", image_factory=qrcode.image.svg.SvgImage ) - svg_data = mark_safe(ET.tostring(image.get_image()).decode()) + svg_data = mark_safe(ElementTree.tostring(image.get_image()).decode()) return HttpResponse(svg_data, content_type="image/svg+xml") From c9e72db1f778389a2b581950a55ad9c9069db6f2 Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 9 Aug 2024 11:12:11 +0200 Subject: [PATCH 5/6] Fix urls.py --- pretalx_broadcast_tools/urls.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pretalx_broadcast_tools/urls.py b/pretalx_broadcast_tools/urls.py index daab6b1..876d38d 100644 --- a/pretalx_broadcast_tools/urls.py +++ b/pretalx_broadcast_tools/urls.py @@ -1,5 +1,5 @@ from django.urls import re_path -from pretalx.event.models.event import SLUG_CHARS +from pretalx.event.models.event import SLUG_REGEX from .views.event_info import BroadcastToolsEventInfoView from .views.orga import BroadcastToolsOrgaView @@ -9,37 +9,37 @@ from .views.static_html import BroadcastToolsLowerThirdsView, BroadcastToolsRoom urlpatterns = [ re_path( - f"^(?P[{SLUG_CHARS}]+)/p/broadcast-tools/event.json$", + rf"^(?P{SLUG_REGEX})/p/broadcast-tools/event.json$", BroadcastToolsEventInfoView.as_view(), name="event_info", ), re_path( - f"^(?P[{SLUG_CHARS}]+)/p/broadcast-tools/schedule.json$", + f"^(?P{SLUG_REGEX})/p/broadcast-tools/schedule.json$", BroadcastToolsScheduleView.as_view(), name="schedule", ), re_path( - f"^(?P[{SLUG_CHARS}]+)/p/broadcast-tools/lower-thirds/$", + f"^(?P{SLUG_REGEX})/p/broadcast-tools/lower-thirds/$", BroadcastToolsLowerThirdsView.as_view(), name="lowerthirds", ), re_path( - f"^(?P[{SLUG_CHARS}]+)/p/broadcast-tools/feedback-qr/(?P[0-9]+).svg$", + f"^(?P{SLUG_REGEX})/p/broadcast-tools/feedback-qr/(?P[0-9]+).svg$", BroadcastToolsFeedbackQrCodeSvg.as_view(), name="feedback_qr_id", ), re_path( - f"^(?P[{SLUG_CHARS}]+)/p/broadcast-tools/public-qr/(?P[0-9]+).svg$", + f"^(?P{SLUG_REGEX})/p/broadcast-tools/public-qr/(?P[0-9]+).svg$", BroadcastToolsPublicQrCodeSvg.as_view(), name="public_qr_id", ), re_path( - f"^(?P[{SLUG_CHARS}]+)/p/broadcast-tools/room-info/$", + f"^(?P{SLUG_REGEX})/p/broadcast-tools/room-info/$", BroadcastToolsRoomInfoView.as_view(), name="room_info", ), re_path( - f"^orga/event/(?P[{SLUG_CHARS}]+)/settings/p/broadcast-tools/$", + f"^orga/event/(?P{SLUG_REGEX})/settings/p/broadcast-tools/$", BroadcastToolsOrgaView.as_view(), name="orga", ), From 7c053570673659632cc42f270d5d72a0cc03a57c Mon Sep 17 00:00:00 2001 From: Tobias Kunze Date: Fri, 9 Aug 2024 11:12:16 +0200 Subject: [PATCH 6/6] Fix imports --- pretalx_broadcast_tools/views/orga.py | 2 +- pretalx_broadcast_tools/views/schedule.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pretalx_broadcast_tools/views/orga.py b/pretalx_broadcast_tools/views/orga.py index 487db1c..6eba32a 100644 --- a/pretalx_broadcast_tools/views/orga.py +++ b/pretalx_broadcast_tools/views/orga.py @@ -1,5 +1,5 @@ from django.views.generic import FormView -from pretalx.common.mixins.views import PermissionRequired +from pretalx.common.views.mixins import PermissionRequired from ..forms import BroadcastToolsSettingsForm diff --git a/pretalx_broadcast_tools/views/schedule.py b/pretalx_broadcast_tools/views/schedule.py index ccb6360..f838489 100644 --- a/pretalx_broadcast_tools/views/schedule.py +++ b/pretalx_broadcast_tools/views/schedule.py @@ -5,7 +5,7 @@ from django.http import JsonResponse from django.urls import reverse from django.views import View from pretalx.agenda.views.schedule import ScheduleMixin -from pretalx.common.mixins.views import EventPermissionRequired +from pretalx.common.views.mixins import EventPermissionRequired from pretalx.schedule.exporters import ScheduleData from ..utils.placeholders import placeholders