~minus/stewdio-api

d2e5dae89a93394103c5c23e24291ad2fc8049e2 — minus 6 years ago 5ca0ebe tmp
Add PKGBUILD
A contrib/archlinux/PKGBUILD => contrib/archlinux/PKGBUILD +49 -0
@@ 0,0 1,49 @@
# Maintainer: minus <minus@mnus.de>

_gitname=stewdio-api
pkgname="${_gitname}-git"
_gitbranch=master
pkgver=r99.5ca0ebe
pkgrel=1
pkgdesc="Stewdio web radio core API server"
url="https://git.sr.ht/~minus/${_gitname}"
license=('MIT')
source=("git+https://git.sr.ht/~minus/${_gitname}#branch=${_gitbranch}")
source=("stewdio-api::git+file:///home/minus/dev/stewdio/stewdio-search/.git#branch=master")
sha512sums=('SKIP')
arch=('any')
depends=(
  'gunicorn'
  'python'
  'python-eventlet'
  'python-flask'
  'python-flask-socketio'
  'python-psycopg2'
  'python-redis'
  'python-requests'
  'python-rply'
)
makedepends=('git')
conflicts=("${_gitname}")
provides=("${_gitname}")

pkgver() {
  cd "${srcdir}/${_gitname}"
  (
    set -o pipefail
    git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
      printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
  )
}

build() {
  cd "${srcdir}/${_gitname}"
  python setup.py build
}

package() {
  cd "${srcdir}/${_gitname}"
  python setup.py install --root="${pkgdir}" --optimize=1
}

# vim:set et sw=2 sts=2:

A contrib/archlinux/stewdio-api.install => contrib/archlinux/stewdio-api.install +1 -0
@@ 0,0 1,1 @@
useradd radio

A contrib/archlinux/stewdio-api.service => contrib/archlinux/stewdio-api.service +13 -0
@@ 0,0 1,13 @@
[Unit]
Description=uWSGI Stewdio Web API
After=syslog.target

[Service]
ExecStart=/usr/bin/gunicorn -b 127.0.0.1:8011 --worker-class eventlet stewdio:app
Restart=always
KillSignal=SIGQUIT
User=radio
Group=radio

[Install]
WantedBy=multi-user.target

A setup.py => setup.py +32 -0
@@ 0,0 1,32 @@
#!/usr/bin/env python3
from distutils.core import setup
import subprocess
import glob
import os

ver = os.environ.get("PKGVER") or subprocess.run(['git', 'describe', '--tags'],
      stdout=subprocess.PIPE).stdout.decode().strip()

with open('requirements.txt') as f:
    reqs = [l.strip() for l in f]

setup(
  name = 'stewdio',
  packages = [
      'stewdio',
      'stewdio.search',
  ],
  version = ver,
  description = 'Stewdio radio controller',
  author = 'minus',
  author_email = 'minus@mnus.de',
  url = 'https://git.sr.ht/~minus/stewdio-api',
  install_requires = reqs,
  license = 'MIT',
  package_data={
      'stewdio': [
          'templates/*.html',
          'static/*',
      ]
  },
)