git: c70252fa679f - main - www/py-freenit: update to 0.2.17

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Sat, 29 Jan 2022 07:28:27 UTC
The branch main has been updated by tagattie:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c70252fa679f02d9bf04179f1edd0407f25c6d71

commit c70252fa679f02d9bf04179f1edd0407f25c6d71
Author:     Goran Mekić <meka@tilda.center>
AuthorDate: 2022-01-29 07:26:30 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2022-01-29 07:26:30 +0000

    www/py-freenit: update to 0.2.17
    
    Changelog: https://github.com/freenit-framework/backend/releases/tag/0.2.17
    
    PR:             257868
    Reported by:    Goran Mekić <meka@tilda.center> (maintainer)
    Reviewed by:    eduardo
---
 www/py-freenit/Makefile         | 46 +++++++++++------------------------------
 www/py-freenit/distinfo         |  6 +++---
 www/py-freenit/files/freenit.in | 36 ++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 37 deletions(-)

diff --git a/www/py-freenit/Makefile b/www/py-freenit/Makefile
index d22b37fbc330..a7e3bbe34158 100644
--- a/www/py-freenit/Makefile
+++ b/www/py-freenit/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	freenit
-PORTVERSION=	0.1.25
+PORTVERSION=	0.2.17
 CATEGORIES=	www devel python
 MASTER_SITES=	CHEESESHOP
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -10,46 +10,24 @@ COMMENT=	REST API framework based on Flask-Smorest
 LICENSE=	BSD2CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}bcrypt>=0:security/py-bcrypt@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}Flask-Collect>=1.3.2:www/py-flask-collect@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}Flask-Cors>=2.1.2:www/py-flask-cors@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}flask-jwt-extended>=3.24.1:www/py-flask-jwt-extended@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}flask-security>=3.0.0:www/py-flask-security@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}flask-smorest>=0.18.2:www/py-flask-smorest@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}email-validator>=0:mail/py-email-validator@${PY_FLAVOR}
-TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}factory-boy>=0:devel/py-factory-boy@${PY_FLAVOR} \
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}alembic>=0:databases/py-alembic@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}fastapi-users-db-ormar>=0:databases/py-fastapi-users-db-ormar@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}uvicorn>=0:www/py-uvicorn@${PY_FLAVOR}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest-asyncio>=0:devel/py-pytest-asyncio@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}pytest-factoryboy>=0:devel/py-pytest-factoryboy@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}pytest-flask>=0:devel/py-pytest-flask@${PY_FLAVOR}
+		${PYTHON_PKGNAMEPREFIX}pytest>=0:devel/py-pytest@${PY_FLAVOR}
 
-USES=		python:3.6+
+USES=		python:3.8+
 USE_PYTHON=	autoplist concurrent distutils
+USE_RC_SUBR=	freenit
+SUB_LIST=	PYTHON_VER=${PYTHON_VER}
 
 TEST_ENV=	PYTHONPATH=${WRKSRC}/src
 
 NO_ARCH=	yes
 
-OPTIONS_DEFINE=	SQLITE MYSQL PGSQL MONGO
-OPTIONS_DEFAULT=SQLITE
-
-SQLITE_DESC=	Support for SQLite database using PeeWee
-MYSQL_DESC=	Support for MySQL database using PeeWee
-PGSQL_DESC=	Support for PostgreSQL database using PeeWee
-MONGO_DESC=	Support for MongoDB using Flask-MongoEngine
-
-MIGRATE_DEP=		${PYTHON_PKGNAMEPREFIX}peewee_migrate>=1.1.6:databases/py-peewee_migrate@${PY_FLAVOR}
-SQLITE_USES=		sqlite
-SQLITE_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}peewee>0:databases/py-peewee@${PY_FLAVOR} \
-			${MIGRATE_DEP}
-MYSQL_USES=		mysql
-MYSQL_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}peewee>0:databases/py-peewee@${PY_FLAVOR} \
-			${MIGRATE_DEP}
-PGSQL_USES=		pgsql
-PGSQL_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}peewee>0:databases/py-peewee@${PY_FLAVOR} \
-			${MIGRATE_DEP}
-MONGO_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}flask-mongoengine>0:www/py-flask-mongoengine@${PY_FLAVOR}
-
-do-test:
-	cd ${WRKSRC} && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m pytest --ignore=freenit/project/ -v -rs -o addopts=
+# Requires newer pytest
+# do-test:
+# 	cd ${WRKSRC} && ${SETENV} ${TEST_ENV} FREENIT_ENV=test ${PYTHON_CMD} -m pytest --ignore=freenit/project/ -v -rs -o addopts=
 
 .include <bsd.port.mk>
diff --git a/www/py-freenit/distinfo b/www/py-freenit/distinfo
index 03b328ea541c..4fd1f48a6706 100644
--- a/www/py-freenit/distinfo
+++ b/www/py-freenit/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1610644687
-SHA256 (freenit-0.1.25.tar.gz) = 962417c33811b2c7bced9cdbb3ff0df6d7c379646aeaf52782dfbb1d4a3a8f05
-SIZE (freenit-0.1.25.tar.gz) = 2640348
+TIMESTAMP = 1643045706
+SHA256 (freenit-0.2.17.tar.gz) = a9f1e269dc348ab48cb46fc55c1353c67281e7c4a1aab8281cab2bd0d426dd21
+SIZE (freenit-0.2.17.tar.gz) = 18229
diff --git a/www/py-freenit/files/freenit.in b/www/py-freenit/files/freenit.in
new file mode 100644
index 000000000000..c3e59410873c
--- /dev/null
+++ b/www/py-freenit/files/freenit.in
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# PROVIDE: freenit
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name=freenit
+desc="Freenit backend"
+rcvar=${name}_enable
+load_rc_config $name
+
+: ${freenit_enable:="NO"}
+: ${freenit_project_root:="/usr/local"}
+: ${freenit_workers:="1"}
+: ${freenit_host:="0.0.0.0"}
+: ${freenit_port:="8000"}
+: ${freenit_module:="main:app"}
+
+pidfile="/var/run/${name}.pid"
+start_cmd="${name}_start"
+procname="%%PREFIX%%/bin/python%%PYTHON_VER%%"
+
+freenit_start() {
+  echo -n "Starting ${name} ... "
+  cd "${freenit_project_root}"
+  /usr/sbin/daemon -p "${pidfile}" -S "%%PREFIX%%/bin/uvicorn" --host "${freenit_host}" --port "${freenit_port}" --workers "${freenit_workers}" "${freenit_module}"
+  status=$?
+  if [ "${status}" = "0" ]; then
+    echo "done"
+  else
+    echo "failed!"
+  fi
+}
+
+run_rc_command $*