aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-waitress
diff options
context:
space:
mode:
Diffstat (limited to 'community/py3-waitress')
-rw-r--r--community/py3-waitress/APKBUILD74
-rw-r--r--community/py3-waitress/waitress.confd60
-rw-r--r--community/py3-waitress/waitress.initd80
3 files changed, 214 insertions, 0 deletions
diff --git a/community/py3-waitress/APKBUILD b/community/py3-waitress/APKBUILD
new file mode 100644
index 0000000000..2c65f86227
--- /dev/null
+++ b/community/py3-waitress/APKBUILD
@@ -0,0 +1,74 @@
+# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
+# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
+pkgname=py-waitress
+_pkgname=waitress
+pkgver=1.1.0
+pkgrel=2
+pkgdesc="A Python WSGI server"
+url="https://github.com/Pylons/waitress"
+arch="noarch"
+license="ZPL-2.1"
+checkdepends="py-nose"
+makedepends="python2-dev python3-dev py-setuptools"
+subpackages="py2-$_pkgname:_py2 py3-$_pkgname:_py3 $pkgname-openrc"
+source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
+ waitress.initd
+ waitress.confd"
+builddir="$srcdir/$_pkgname-$pkgver"
+
+build() {
+ cd "$builddir"
+
+ python2 setup.py build
+ python3 setup.py build
+}
+
+check() {
+ cd "$builddir"
+
+ # XXX: Some tests fail on python2 with "No file descriptors available".
+ python3 setup.py test
+}
+
+package() {
+ mkdir -p "$pkgdir"/usr/bin
+ cd "$pkgdir"
+
+ ln -s waitress-serve-3 usr/bin/waitress-serve
+
+ install -D -m 755 "$srcdir"/waitress.initd etc/init.d/waitress
+ install -D -m 644 "$srcdir"/waitress.confd etc/conf.d/waitress
+}
+
+openrc() {
+ default_openrc
+ depends="$pkgname=$pkgver-r$pkgrel"
+}
+
+_py2() {
+ replaces="$pkgname"
+ _py python2
+}
+
+_py3() {
+ _py python3
+}
+
+_py() {
+ local python="$1"
+ local pyver="${python#python}"
+ pkgdesc="$pkgdesc (for $python)"
+ depends="$python"
+ install_if="$pkgname=$pkgver-r$pkgrel $python"
+
+ cd "$builddir"
+ $python setup.py install --prefix=/usr --root="$subpkgdir"
+
+ cd "$subpkgdir"
+ mv usr/bin/waitress-serve usr/bin/waitress-serve-$pyver
+ rm -R usr/lib/python$pyver*/site-packages/$_pkgname/tests
+}
+
+sha512sums="d53cf027525aec6fbd49ab78c30fef1b83d8b58c6d2cbb191d45e69141d7c31d6cd195a0924ad862a4cc42e5d098813712c568f768f51825e96fac3dd4132fbe waitress-1.1.0.tar.gz
+5e85fdaaf564f1a581488cc8d26362775d8623f414c2a1bddcc7e3ac5bdbbb0ef48eda3f1b00d203dee3cc14b271a3324bfade7a16b9b6106dbb2da85a970d37 waitress.initd
+3f3fce6347784461c39f4281c371eabeff165dcfc273f1f92a6f50db35a36dd79faef70abf638dbe3f1894f050828cb3be755172cb7b8283bcbf9b0d5b2723da waitress.confd"
diff --git a/community/py3-waitress/waitress.confd b/community/py3-waitress/waitress.confd
new file mode 100644
index 0000000000..4484a51238
--- /dev/null
+++ b/community/py3-waitress/waitress.confd
@@ -0,0 +1,60 @@
+# YOU SHOULD NOT MODIFY THIS FILE! CREATE A COPY NAMED AFTER THE APPLICATION
+# YOU WANT TO RUN AND MODIFY THAT INSTEAD (and remove this notice).
+
+# Python executable to run waitress-serve with.
+#python="/usr/bin/python3"
+
+# User (and group) to run the application (e.g. app:www-data).
+#command_user="nobody"
+
+# Path of the log file to catch stdout/stderr of the process.
+logfile="/var/log/$RC_SVCNAME.log"
+
+
+# Base directory of the application.
+#basedir=
+
+# Name of the application's WSGI module (python file typically inside $basedir).
+wsgi_module="wsgi"
+
+# Name of attribute in $wsgi_module that contains WSGI object
+# or factory function.
+#wsgi_object="application"
+
+# Call the given object to get the WSGI application.
+#wsgi_call="no"
+
+
+# Tell waitress to listen on an ip port combination(s).
+# Example: listen="127.0.0.1:8080 [::1]:8080 *:8181"
+listen_on="*:8080"
+
+# Path of unix socket to create and listen on. The directory of the socket path
+# will be created if not exists and changed owner to the $user. It must not be
+# existing directory owned by root, such as /run. Use e.g. /run/app/server.sock.
+# If specified, $listen_on is effectively ignored.
+#unix_socket_path=
+
+# Octal permissions to use for the Unix domain socket. Default is 600.
+#unix_socket_perms=
+
+# Default wsgi.url_scheme value. Default is "http".
+#url_scheme=
+
+# The SCRIPT_NAME WSGI environment value.
+# Setting this to anything except the empty string will cause the WSGI
+# SCRIPT_NAME value to be the value passed minus any trailing slashes you add,
+# and it will cause the PATH_INFO of any request which is prefixed with this
+# value to be stripped of the prefix. Default is the empty string.
+#url_prefix=
+
+# Server identity used in the "Server" header in responses.
+# Default is "waitress".
+#server_ident=
+
+# Extra options for waitress-serve.
+# See https://docs.pylonsproject.org/projects/waitress/en/latest/runner.html.
+#waitress_opts=
+
+# Note: If you need to pass some environment variables to the application, set
+# start_stop_daemon_args="--env FOO=bar --env BAZ=qux"
diff --git a/community/py3-waitress/waitress.initd b/community/py3-waitress/waitress.initd
new file mode 100644
index 0000000000..0a1865d788
--- /dev/null
+++ b/community/py3-waitress/waitress.initd
@@ -0,0 +1,80 @@
+#!/sbin/openrc-run
+
+# Variables $user and $group are deprecated.
+: ${command_user:="${user:-"nobody"}${group:+":$group"}"}
+: ${python:="/usr/bin/python3"}
+: ${python_opts:="-u"} # this is needed for stdout/stderr redirect to work
+: ${wsgi_module:=}
+: ${wsgi_object:="application"}
+: ${wsgi_call:="no"}
+
+command="$python"
+command_args="$python_opts /usr/bin/waitress-serve"
+command_background="yes"
+
+pidfile="/run/$RC_SVCNAME.pid"
+start_stop_daemon_args="
+ --interpreted
+ --user $command_user
+ ${basedir:+--chdir $basedir}
+ ${start_stop_daemon_args:-}"
+
+depends() {
+ need net
+ after postgresql
+}
+
+start_pre() {
+ local waitress_args=""
+
+ if [ "$RC_SVCNAME" = "waitress" ]; then
+ ewarn "You are not supposed to run this runscript directly. Instead, you should"
+ ewarn "create a symlink for the application you want to run as well as a copy of"
+ ewarn "the configuration file and modify it appropriately, like so:"
+ ewarn ""
+ ewarn " ln -s waitress /etc/init.d/myapp"
+ ewarn " cp /etc/conf.d/waitress /etc/conf.d/myapp"
+ ewarn ""
+ fi
+
+ if [ -z "$wsgi_module" ]; then
+ eerror '$wsgi_module must be set!'; return 1
+ fi
+
+ if [ -n "${logfile:-}" ]; then
+ start_stop_daemon_args="$start_stop_daemon_args
+ --stdout $logfile --stderr $logfile"
+ checkpath -f -m 0644 -o ${command_user%:*} "$logfile"
+ fi
+
+ if [ -n "$unix_socket_path" ]; then
+ if [ "$(stat -c %u "${unix_socket_path%/*}" 2>/dev/null)" -eq 0 ]; then
+ eerror "Directory \"${unix_socket_path%/*}\" already exists and is owned by root!"
+ return 1
+ fi
+ checkpath -d -m 0755 -o ${command_user%:*} "${unix_socket_path%/*}"
+ fi
+
+ if yesno "$wsgi_call"; then
+ waitress_args="$waitress_args --call"
+ fi
+
+ local item; for item in ${listen_on:-}; do
+ waitress_args="$waitress_args --listen='$item'"
+ done
+
+ waitress_args="$waitress_args
+ $(optif --unix-socket "$unix_socket_path")
+ $(optif --unix-socket-perms "$unix_socket_perms")
+ $(optif --url-scheme "$url_scheme")
+ $(optif --url-prefix "$url_prefix")
+ $(optif --ident "$server_ident")
+ ${waitress_opts:-}
+ $wsgi_module:$wsgi_object"
+
+ command_args="$command_args $waitress_args"
+}
+
+optif() {
+ test -n "$2" && printf %s "$1='$2'"
+}