fix plzidx issues, include bulma and systemd unit

This commit is contained in:
Sven Koehler committed 2024-01-18 14:55:26 +01:00
1 parent 9d406e5f92
commit bab90fe4d1
4 files changed
+89 -2

No files matched your search

@@ -0,0 +1,58 @@
From 2ab6f47039d4bd8c35794e388cc862c3bccb6bc5 Mon Sep 17 00:00:00 2001
From: Sven Koehler <git@svenkoehler.de>
Date: Tue, 16 Jan 2024 23:45:17 +0100
Subject: [PATCH 34/34] Drop mapped_columns (sqlachemy 2.0 feature)
---
plzidx/db.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/plzidx/db.py b/plzidx/db.py
index 8fe86e2..22c084e 100644
--- a/plzidx/db.py
+++ b/plzidx/db.py
@@ -1,7 +1,7 @@
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Table, ForeignKeyConstraint, func
from typing import List
-from sqlalchemy.orm import declarative_base, mapped_column, relationship, Mapped
+from sqlalchemy.orm import declarative_base, relationship
import datetime
@@ -29,10 +29,10 @@ association_table = Table(
class Tag(db.Model):
__tablename__ = 'tag'
- id: Mapped[int] = mapped_column(Integer, primary_key=True)
- text: Mapped[str] = mapped_column(String, unique=True, nullable=False)
+ id = Column(Integer, primary_key=True)
+ text = Column(String, unique=True, nullable=False)
- pads: Mapped[List['Pad']] = relationship('Pad', secondary=association_table, back_populates='tags')
+ pads = relationship('Pad', secondary=association_table, back_populates='tags')
def __repr__(self):
return f'<Tag text={self.text}>'
@@ -85,13 +85,13 @@ class Tag(db.Model):
class Pad(db.Model):
__tablename__ = 'pad'
- uuid: Mapped[str] = mapped_column(String, primary_key=True, nullable=False)
- updatedAt: Mapped[datetime.datetime] = mapped_column(DateTime, nullable=False)
+ uuid = Column(String, primary_key=True, nullable=False)
+ updatedAt = Column(DateTime, nullable=False)
- title: Mapped[str] = mapped_column(String)
- url: Mapped[str] = mapped_column(String, nullable=False)
+ title = Column(String)
+ url = Column(String, nullable=False)
- tags: Mapped[List['Tag']] = relationship('Tag', secondary=association_table, back_populates='pads')
+ tags = relationship('Tag', secondary=association_table, back_populates='pads')
def __repr__(self):
return f'<Pad uuid={self.uuid}, updatedAt={self.updatedAt}>'
--
2.37.1 (Apple Git-137.1)
+17 -2
View File
@@ -2,16 +2,27 @@ pkgname=hedgedoc-tag-searcher
pkgver=0.01 pkgver=0.01
pkgrel=1 pkgrel=1
pkgdesc="Global search for Hedgedoc pads by tags" pkgdesc="Global search for Hedgedoc pads by tags"
source=('hedgedoc-tag-searcher::git+https://github.com/Chaostreff-Potsdam/hedgedoc-tag-searcher.git#tag=v0.01') source=('hedgedoc-tag-searcher::git+https://github.com/Chaostreff-Potsdam/hedgedoc-tag-searcher.git#tag=v0.01' '0001-downgrade-to-sqlalchmy-1.4.patch' 'bulma.min.css' 'plzidx.service')
md5sums=('SKIP') sha512sums=('SKIP'
'84bcc457d18d9a6bc4178dbfaf267f9ef931ca753698648439db5776815c17dcb8daa363064842d305afbebd4639a93ecc094bf0427450affe598d1c8981576f'
'1eac4752424cd1261c6efc54c393fad12cdd393cbf415c00d4926bbda5c9bf8abb9666c36429996aacf4d543ce690bdea317d846fd6d1e8cd618f31cb9306ebd'
'2dacde841246faff873c8beac4c34a88d7385dba61aec8deae43ab23e6a4124780140c6cbf686ad250bf925f90cd53481f1a4da3fb1fb50389d5c3de213ca89e'
)
arch=("any") arch=("any")
license=("MIT") license=("MIT")
makedepends=("git" "python-build" "python-installer" "python-wheel") makedepends=("git" "python-build" "python-installer" "python-wheel")
depends=("python>=3" "python-flask" "python-flask-sqlalchemy" "python-pyaml" "python-dotenv" "python-psycopg2") depends=("python>=3" "python-flask" "python-flask-sqlalchemy" "python-pyaml" "python-dotenv" "python-psycopg2")
prepare() {
cd "$srcdir/$pkgname/"
patch --forward --strip=1 --input="${srcdir}/0001-downgrade-to-sqlalchmy-1.4.patch"
cp "${srcdir}/bulma.min.css" "plzidx/static/css/bulma.min.css"
}
build() { build() {
cd "$srcdir/$pkgname/" cd "$srcdir/$pkgname/"
python -m build --wheel --no-isolation python -m build --wheel --no-isolation
} }
@@ -20,4 +31,8 @@ package() {
python -m installer --destdir="$pkgdir" dist/*.whl python -m installer --destdir="$pkgdir" dist/*.whl
mkdir -p "$pkgdir/etc/webapps/$pkgname/" mkdir -p "$pkgdir/etc/webapps/$pkgname/"
mkdir -p "$pkgdir/usr/var/plzidx-instance/"
ln -s "/etc/webapps/$pkgname/config.py" "$pkgdir/usr/var/plzidx-instance/config.py"
install -Dm644 "${srcdir}/plzidx.service" "${pkgdir}/usr/lib/systemd/system/plzidx.service"
} }
+1
View File
@@ -0,0 +1 @@
/*! bulma.io v0.9.4 | MIT License | github.com/jgthms/bulma */.button,.file-cta,.file-name,.input,.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous,.select select,.textarea{-moz-appearance:none;-webkit-appearance:none;align-items:center;border:1px solid transparent;border-radius:4px;box-shadow:none;display:inline-flex;font-size:1rem;height:2.5em;justify-content:flex-start;line-height:1.5;padding-bottom:calc(.5em - 1px);padding-left:calc(.75em - 1px);padding-right:calc(.75em - 1px);padding-top:calc(.5em - 1px);position:relative;vertical-align:top}.button:active,.button:focus,.file-cta:active,.file-cta:focus,.file-name:active,.file-name:focus,.input:active,.input:focus,.is-active.button,.is-active.file-cta,.is-active.file-name,.is-active.input,.is-active.pagination-ellipsis,.is-active.pagination-link,.is-active.pagination-next,.is-active.pagination-previous,.is-active.textarea,.is-focused.button,.is-focused.file-cta,.is-focused.file-name,.is-focused.input,.is-focused.pagination-ellipsis,.is-focused.pagination-link,.is-focused.pagination-next,.is-focused.pagination-previous,.is-focused.textarea,.pagination-ellipsis:active,.pagination-ellipsis:focus,.pagination-link:active,.pagination-link:focus,.pagination-next:active,.pagination-next:focus,.pagination-previous:active,.pagination-previous:focus,.select select.is-active,.select select.is-focused,.select select:active,.select select:focus,.textarea:active,.textarea:focus{outline:0}.button[disabled],.file-cta[disabled],.file-name[disabled],.input[disabled],.pagination-ellipsis[disabled],.pagination-link[disabled],.pagination-next[disabled],.pagination-previous[disabled],.select fieldset[disabled] select,.select select[disabled],.textarea[disabled],fieldset[disabled] .button,fieldset[disabled] .file-cta,fieldset[disabled] .file-name,fieldset[disabled] .input,fieldset[disabled] .pagination-ellipsis,fieldset[disabled] .pagination-link,fieldset[disabled] .pagination-next,fieldset[disabled] .pagination-previous,fieldset[disabled] .select select,fieldset[disabled] .textarea{cursor:not-allowed}.breadcrumb,.button,.file,.is-unselectable,.pagination-ellipsis,.pagination-link,.pagination-next,.pagination-previous,.tabs{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.navbar-link:not(.is-arrowless)::after,.select:not(.is-multiple):not(.is-loading)::after{border:3px solid transparent;border-radius:2px;border-right:0;border-top:0;content:" ";display:block;height:.625em;margin-top:-.4375em;pointer-events:none;position:absolute;top:50%;transform:rotate(-45deg);transform-origin:center;width:.625em}.block:not(:last-child),.box:not(:last-child),.breadcrumb:not(:last-child),.content:not(:last-child),.level:not(:last-child),.message:not(:last-child),.notification:not(:last-child),.pagination:not(:last-child),.progress:not(:last-child),.subtitle:not(:last-child),.table-container:not(:last-child),.table:not(:last-child),.tabs:not(:last-child),.title:not(:last-child){margin-bottom:1.5rem}.delete,.modal-close{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-moz-appearance:none;-webkit-appearance:none;background-color:rgba(10,10,10,.2);border:none;border-radius:9999px;cursor:pointer;pointer-events:auto;display:inline-block;flex-grow:0;flex-shrink:0;font-size:0;height:20px;max-height:20px;max-width:20px;min-height:20px;min-width:20px;outline:0;position:relative;vertical-align:top;width:20px}.delete::after,.delete::before,.modal-close::after,.modal-close::before{background-color:#fff;content:"";display:block;left:50%;position:absolute;top:50%;transform:translateX(-50%) translateY(-50%) rotate(45deg);transform-origin:center center}.delete::before,.modal-close::before{height:2px;width:50%}.delete::after,.modal-close::after{height:50%;width:2px}.delete:focus,.delete:hover,.modal-close:focus,.modal-close:hover{background-color:rgba(10,10,10,.3)}.delete:active,.modal-close:active{background-color:rgba(10,10,10,.4)}.is-small.delete,.is-small.modal-close{height:16px;max-height:16px;max-width:16px;min-height:16px;min-width:16px;width:16px}.is-medium.delete,.is-medium.modal-close{height:24px;max-height:24px;max-width:24px;min-height:24px;min-width:24px;width:24px}.is-large.delete,.is-large.modal-close{height:32px;max-height:32px;max-width:32px;min-height:32px;min-width:32px;width:32px}.button.is-loading::after,.control.is-loading::after,.loader,.select.is-loading::after{-webkit-animation:spinAround .5s infinite linear;animation:spinAround .5s infinite linear;border:2px solid #dbdbdb;border-radius:9999px;border-right-color:transparent;border-top-color:transparent;content:"";display:block;height:1em;position:relative;width:1em}.hero-video,.image.is-16by9 .has-ratio,.image.is-16by9 img,.image.is-1by1 .has-ratio,.image.is-1by1 img,.image.is-1by2 .has-ratio,.image.is-1by2 img,.image.is-1by3 .has-ratio,.image.is-1by3 img,.image.is-2by1 .has-ratio,.imagLine truncated
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=Gunicorn instance to serve hedgedoc-tag-searcher
After=network.target
[Service]
RuntimeDirectory=plzidx
RuntimeDirectoryMode=755
User=plzidx
Group=plzidx
ExecStart=/usr/bin/gunicorn --workers 1 --bind unix:/run/plzidx/plzidx.sock -u plzidx -g plzidx 'plzidx:create_app()'
[Install]
WantedBy=multi-user.target