archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / python-pyudev / trunk / PKGBUILD
blob5ba2314daff67608b5ac1825546de4949c30c70b
1 # Maintainer: Filipe LaĆ­ns (FFY00) <lains@archlinux.org>
2 # Contributor: Andrea Scarpino <andrea@archlinux.org>
3 # Contributor: examon <examon.mail[at]gmail[dot]com>
4 # Contributor: Sebastian Wiesner <lunaryorn googlemail com>
5 # Contributor: Dwight Schauer <dschauer@ti.com>
7 _pkgname=pyudev
8 pkgname=python-$_pkgname
9 pkgver=0.24.1
10 pkgrel=1
11 arch=('any')
12 url='https://github.com/pyudev/pyudev'
13 license=('LGPL')
14 pkgdesc='Python bindings to libudev'
15 depends=('python-six' 'systemd')
16 makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel' 'python-sphinx')
17 checkdepends=('python-pytest' 'python-docutils' 'python-hypothesis' 'python-pip')
18 optdepends=('python-pyqt5: PyQt integration'
19             'pyside2: PySide integration'
20             'python-wxpython: WX integration')
21 source=("$_pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
22 sha512sums=('68d64113a465588411e494a010e1b19f68ed0f8fabff154d6f3066a22ff38fcd52ee73b9a00be15f5e51ea38152cd97f2ff3fda406981431a6d5a6fa0484e874')
24 prepare() {
25   cd $_pkgname-$pkgver
27   # Remove failing tests (we can't test udev inside makepkg)
28   rm tests/test_{util,discover,device,monitor,enumerate,observer}.py
30   # Fix documentation build
31   sed -i "s|os.path.join(doc_directory, os.pardir)|os.path.join(doc_directory, os.pardir, 'src')|
32           s|b'autodoc-process-docstring'|'autodoc-process-docstring'|" doc/conf.py
35 build() {
36   cd $_pkgname-$pkgver
38   python -m build -nw
40   # Generate documentation
41   sphinx-apidoc -f -e -o doc src/pyudev
42   sphinx-build -a -b html doc doc/html
45 check() {
46   cd $_pkgname-$pkgver
48   PYTHONPATH=src python -m pytest
51 package() {
52   cd $_pkgname-$pkgver
54   python -m installer -d "$pkgdir" dist/*.whl
56   # Install documentation
57   install -dm 755 "$pkgdir"/usr/share/doc/$pkgname
58   cp -r -a --no-preserve=ownership doc/html "$pkgdir"/usr/share/doc/$pkgname
59   rm -rf "$pkgdir"/usr/share/doc/$pkgname/html/.doctrees