summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: bff4a3372a93272a251218100a75810b55c932c3 (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
81
82
83
84
85
86
87
88
89
90
91
# SPDX-License-Identifier: AGPL-3.0
#
# Contributor: Marcell Meszaros < marcell.meszaros AT runbox.eu >
# Contributor: Jelle van der Waa <jelle@vdwaa.nl>
# Maintainer:  Pellegrino Prevete <cGVsbGVncmlub3ByZXZldGVAZ21haWwuY29tCg== | base -d>
# Maintainer:  Truocolo <truocolo@aol.com>

_py="python2"
_pkg="singledispatch"
pkgname="${_py}-${_pkg}"
_name="${_pkg}"
pkgver=3.7.0
pkgrel=3
pkgdesc='Backport of functools.singledispatch from Python 3.4'
arch=(
  'any'
)
url="https://pypi.org/project/${_name}/${pkgver}/"
license=(
  'MIT'
)
depends=(
  "${_py}"
  "${_py}-six"
)
makedepends=(
  "${_py}-setuptools"
)
_tarname="${_name}-${pkgver}"
_ns="jaraco"
_http="https://github.com"
_url="${_http}/${_ns}/${_pkg}"
source=(
  "${_tarname}.tar.gz::${_url}/archive/refs/tags/v${pkgver}.tar.gz"
)
b2sums=(
  'b488ebea8aeb1055fd91422d0ce7a91f321e3a0b9b99387f936fd1fd95a1016492baeabecfc0fd7ad8988a93c1054ff7681b8c4d0affa2d6114b90b6c8c58bdd'
)

# setuptools-scm won't find version
# from git tag when source is a tarball
export \
  SETUPTOOLS_SCM_PRETEND_VERSION="${pkgver}"

prepare() {
  cd \
    "${_tarname}"
  echo \
    'Changing hashbangs in *.py files to refer to python2'
  sed \
    -e \
      '1s|#![ ]*/usr/bin/python[^2]\?|#!/usr/bin/python2|' \
    -e \
      '1s|#![ ]*/usr/bin/env python[^2]\?|#!/usr/bin/env python2|' \
    -e \
      '1s|#![ ]*/bin/env python[^2]\?|#!/usr/bin/env python2|' \
    -i \
    $( \
      find \
        . \
	-name \
	  '*.py')
}

build() {
  cd \
    "${_tarname}"
  "${_py}" \
    setup.py \
    build
}

package() {
  cd \
    "${_tarname}"
  "${_py}" \
    setup.py \
      install \
        --prefix='/usr' \
	--root "${pkgdir}" \
	--optimize=1 \
	--skip-build

  install \
    -Dm 644 \
    'LICENSE' \
    -t \
    "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim:set sw=2 sts=-1 et: