summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: eb652568232808607f2712f1fa0e2c923727a1af (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
76
77
78
79
80
# Maintainer: Carl Smedstad <carl.smedstad at protonmail dot com>

pkgname=python-fixit
_name=Fixit
pkgver=2.1.0
pkgrel=2
pkgdesc="Advanced Python linting framework with auto-fixes and hierarchical configuration"
arch=(any)
url="https://github.com/Instagram/Fixit"
license=(
  Apache-2.0
  MIT
  PSF-2.0
)
depends=(
  python
  python-black
  python-click
  python-libcst
  python-moreorless
  python-packaging
  python-rich
  python-tomli
  python-trailrunner
  ufmt
)
makedepends=(
  python-build
  python-hatch-vcs
  python-hatchling
  python-installer
  python-wheel
)

source=(
  "$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz"
  "remove-failing-smoke-test.patch"
)
sha256sums=(
  '81a7be1d530e98da76e00c21aacdb02c6d9d45e922b4edf2f9de3c17733e029b'
  '45a32a0942d224152c4dd9190c20906ab831b776f06d4d14e27803f86fc31ca1'
)

_archive="$_name-$pkgver"

prepare() {
  cd "$_archive"

  patch --forward --strip=1 --input="$srcdir/remove-failing-smoke-test.patch"
}

build() {
  cd "$_archive"

  export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd "$_archive"

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

  # Remove failing tests
  _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  rm "tmp_install/$_site_packages/fixit/upgrade/deprecated_import.py"
  rm "tmp_install/$_site_packages/fixit/upgrade/remove_rule_suffix.py"

  export PYTHONPATH="$PWD/tmp_install/$_site_packages"
  python -m fixit.tests
}

package() {
  cd "$_archive"

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

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