summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ebe821e2f7740e7f7c9c3df5a8794321dba26c51 (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
# Maintainer: gilcu3
# Contributor: xginn8 <mamcgi@gmail.com>
# Contributor: Caltlgin Stsodaat <contact@fossdaily.xyz>
# Contributor: Dan Beste <Dan.Ray.Beste@gmail.com>
# Contributor: Daniel M. Capella <polyzen@archlinux.org>

_pkgname='python-black'
pkgname="${_pkgname}-git"
pkgver=24.4.2.r3.g0c033f3e
pkgrel=1
pkgdesc='Uncompromising Python code formatter'
arch=('any')
url='https://github.com/psf/black'
license=('MIT')
depends=('python' 'python-click' 'python-mypy_extensions' 'python-packaging'
         'python-pathspec' 'python-platformdirs')
makedepends=('python-build' 'python-hatch-fancy-pypi-readme' 'python-hatch-vcs'
             'python-hatchling' 'python-installer')
checkdepends=('ipython' 'python-aiohttp' 'python-parameterized' 'python-pytest'
              'python-typed-ast' 'python-tokenize-rt')
optdepends=('ipython: for Jupyter notebook support'
            'python-tokenize-rt: for Jupyter notebook support'
            'python-aiohttp: for the blackd HTTP server'
            'python-colorama: for colored diffs')
provides=('python-black')
conflicts=('python-black')
source=("${_pkgname}::git+${url}.git")
sha256sums=('SKIP')

pkgver() {
  git -C "${_pkgname}" describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
  cd "${_pkgname}"
  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "${_pkgname}"
  python -m installer --destdir="$pkgdir" dist/*.whl

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/black-$pkgver.dist-info/licenses/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE

  # Vim plugin
  install -Dm644 -t "$pkgdir/usr/share/vim/vimfiles/plugin" plugin/black.vim
  install -Dm644 -t "$pkgdir/usr/share/vim/vimfiles/autoload" autoload/black.vim
}

# vim: ts=2 sw=2 et: