summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 96ce84b5802bde090a1568b8a1c8199aa4897cb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com>

pkgname=python-picologging
_name=${pkgname#python-}
pkgver=0.9.3
pkgrel=3
pkgdesc="An optimized logging library for Python"
arch=(x86_64)
url="https://github.com/microsoft/picologging"
license=(MIT)
depends=(
  gcc-libs
  glibc
  python
)
makedepends=(
  cmake
  ninja
  python-build
  python-installer
  python-scikit-build
  python-setuptools
  python-wheel
)
checkdepends=(
  python-flaky
  python-hypothesis
  python-pytest
  python-pytest-memray
)

source=(
  "$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz"
  "remove-build-dependencies-cmake-ninja.patch"
)
sha256sums=(
  'ed5e9d31c2d06fd02d4304bfb98cb200acbf11e1f03d6a5b341263cf312a18b2'
  '7a74c72ad8fafa38116b5c717092024d607a426b2040b625267dadc190e90c4b'
)

_archive="$_name-$pkgver"

prepare() {
  cd "$_archive"

  patch --forward --strip=1 --input="$srcdir/remove-build-dependencies-cmake-ninja.patch"
}

build() {
  cd "$_archive"

  export CMAKE_ARGS=-Wno-dev
  python -m build --wheel --no-isolation
}

check() {
  cd "$_archive"

  rm -rf tmp_install
  python -m installer --destdir=tmp_install dist/*.whl

  _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  export PYTHONPATH="$PWD/tmp_install/$_site_packages:$PYTHONPATH"
  # Deselected test fails with MEMORY PROBLEMS in a chroot.
  pytest \
    --deselect tests/unit/test_logger.py::test_nested_frame_stack
}

package() {
  cd "$_archive"

  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}