Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
PKGBUILD 2.88 KiB
# Maintainer: Thore Bödecker <foxxx0@archlinux.org>
# Contributor: wangjiezhe <wangjiezhe AT yandex DOT com>

pkgbase='python-cheroot'
_pkgbase="${pkgbase//python-/}"
pkgname=('python-cheroot' 'python2-cheroot')
pkgdesc="Highly-optimized, pure-python HTTP server"
pkgver=8.2.1
pkgrel=1
arch=('any')
url="https://github.com/cherrypy/cheroot"
license=('MIT')
makedepends=('python-six' 'python2-six' 'python-setuptools-scm'
  'python2-setuptools-scm' 'python2-backports.functools_lru_cache'
  'python2-backports.unittest_mock' 'tree' 'python-tox' 'python2-tox')
source=("https://files.pythonhosted.org/packages/source/${_pkgbase:0:1}/${_pkgbase}/${_pkgbase}-${pkgver}.tar.gz"
        "LICENSE"
        "disable-broken-tests.patch")
sha512sums=('3f6b55c6b2403569eedb1fe7b473d3a65ad5d06cb99a38370316db38b6138b1a6921c6b7d8ba64424c5b8c20c9c58ada33da7cb8ebb6f313610f63c1f364f862'
            '1106afed483b7258e4ae89c5d9459c3834412b31aac90169725ed62d2ab44f61f6f79e894d4c9e4d8bd99e14530ab778df2187784f0b25eaab86d312fad68944'
            'ee08317c027a36461a89642e47edd5f9706796dbd6c273bbda3a37da5b1578701f861b09f23957636de5e72f38c312ad07caf0216408ec5d543feea7130839ba')

prepare() {
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  patch -p1 -N -i "${srcdir}/disable-broken-tests.patch"

  # git-archive support is not needed since we use PyPI tarballs
  sed -i '/setuptools_scm_git_archive/d' setup.cfg

  cp -r "${srcdir}/${_pkgbase}-${pkgver}" "${srcdir}/${_pkgbase}-${pkgver}-py2"
}

build() {
  # setuptools wont find version from git tag
  export SETUPTOOLS_SCM_PRETEND_VERSION="${pkgver}"

  cd "${srcdir}/${_pkgbase}-${pkgver}"
  python setup.py build

  cd "${srcdir}/${_pkgbase}-${pkgver}-py2"
  python2 setup.py build
}

check() {
  cd "${srcdir}/${_pkgbase}-${pkgver}"
  tox

  cd "${srcdir}/${_pkgbase}-${pkgver}-py2"
  tox2
}

package_python-cheroot() {
  depends=('python-six')

  cd "${srcdir}/${_pkgbase}-${pkgver}"
  python setup.py install --root="$pkgdir/" --optimize=1

  # the author has promised to include a LICENSE file in future releases:
  # https://github.com/jaraco/skeleton/issues/1
  # for now the LICENSE file has been taken from:
  # https://github.com/jaraco/skeleton/blob/skeleton/LICENSE
  install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

package_python2-cheroot() {
  depends=('python2-six' 'python2-backports.functools_lru_cache'
           'python2-backports.unittest_mock')

  cd "${srcdir}/${_pkgbase}-${pkgver}-py2"
  python2 setup.py install --root="$pkgdir/" --optimize=1

  # the author has promised to include a LICENSE file in future releases:
  # https://github.com/jaraco/skeleton/issues/1
  # for now the LICENSE file has been taken from:
  # https://github.com/jaraco/skeleton/blob/skeleton/LICENSE
  install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  mv "${pkgdir}/usr/bin/cheroot" "${pkgdir}/usr/bin/cheroot2"
}

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