summaryrefslogtreecommitdiff
path: root/python-pyshortcuts/PKGBUILD
blob: 745f07a0c40aa660a77e32360561d266aca4f37b (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
# Maintainer: Erich Eckner <arch at eckner dot net>

pkgbase=python-pyshortcuts
pkgname=('python-pyshortcuts' 'python2-pyshortcuts')
_pkgname='pyshortcuts'
pkgver=1.4
pkgrel=1
pkgdesc='create desktop shortcuts to python scripts on Windows, Mac, or Linux'
arch=('any')
url='https://github.com/newville/pyshortcuts'
license=('MIT')
_deppy2=(
  'python2>=2.7'
  'python2<2.8'
)
_deppy=(
  'python>=3.7'
  'python<3.8'
)
_depends=(
  'python-six')
_makedepends=(
  'python-setuptools')
makedepends=(
  "${_deppy[@]}"
  "${_deppy2[@]}"
  "${_depends[@]}"
  "${_depends[@]/python/python2}"
  "${_makedepends[@]}"
  "${_makedepends[@]/python/python2}"
)
source=("${_pkgname}-${pkgver}.tar.gz::https://github.com/newville/${_pkgname}/archive/${pkgver}.tar.gz")
sha512sums=('430fb023e9e87359050f1362acc04000d0062a5b57e6f556f6bdaee2439cf1692fb3a5cbc8a4d0de008fd9f839b7078673d6271630af13ce87b30d43b4c54d63')

prepare() {
  cd "${srcdir}"

  cp -a "${_pkgname}-${pkgver}" "${pkgname[0]}"
  mv "${_pkgname}-${pkgver}" "${pkgname[1]}"
}

build() {
  cd "${srcdir}/${pkgname[0]}"
  python setup.py build

  cd "${srcdir}/${pkgname[1]}"
  python2 setup.py build
}

package_python-pyshortcuts() {
  depends=(
    "${_deppy[@]}"
    "${_depends[@]}"
  )

  cd "${srcdir}/${pkgname[0]}"
  python setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1
  errors=$(
    find "${pkgdir}/usr/lib"/python*/site-packages/pyshortcuts-*.egg-info -name 'requires.txt' -execdir cat {} \; \
      | sed 's/^/python-/' \
      | grep -vxF "$(printf '%s\n' "${depends[@]}")"
  ) || true
  if [ -n "${errors}" ]; then
    echo 'missing dependencies:'
    printf '%s\n' "${errors}"
    return 1
  fi
  rm -rf --one-file-system "${pkgdir}/usr/lib"/python*/site-packages/pyshortcuts-*.egg-info "${pkgdir}/usr/bin"
}

package_python2-pyshortcuts() {
  depends=(
    "${_deppy2[@]}"
    "${_depends[@]/python/python2}"
  )

  cd "${srcdir}/${pkgname[1]}"
  python2 setup.py install --prefix=/usr --root="${pkgdir}" --optimize=1
  errors=$(
    find "${pkgdir}/usr/lib"/python*/site-packages/pyshortcuts-*.egg-info -name 'requires.txt' -execdir cat {} \; \
      | sed 's/^/python2-/' \
      | grep -vxF "$(printf '%s\n' "${depends[@]}")"
  ) || true
  if [ -n "${errors}" ]; then
    echo 'missing dependencies:'
    printf '%s\n' "${errors}"
    return 1
  fi
  rm -rf --one-file-system "${pkgdir}/usr/lib"/python*/site-packages/pyshortcuts-*.egg-info "${pkgdir}/usr/bin"
}