-
Notifications
You must be signed in to change notification settings - Fork 0
/
PKGBUILD
110 lines (95 loc) · 3.39 KB
/
PKGBUILD
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Maintainer: Jeffrey Bouter <[email protected]>
export PIP_CONFIG_FILE=/dev/null
export PIP_DISABLE_PIP_VERSION_CHECK=true
pkgname=salt-lint
epoch=
pkgver=0.9.2
pkgrel=1
pkgdesc='A command-line utility that checks for best practices in SaltStack.'
arch=(any)
url=https://github.com/warpnet/salt-lint
license=(MIT)
depends=(python python-pyaml python-pathspec)
## EXTRA_DEPENDS ##
makedepends=(python-pip python-distro python-wheel)
checkdepends=()
provides=()
conflicts=(${provides%=*}) # No quotes, to avoid an empty entry.
noextract=()
source=(https://files.pythonhosted.org/packages/ec/18/6f513afbe6b22fb1c2ab0019baeb7769b0c987cbead4b753269e5bcc8bbc/salt_lint-0.9.2-py3-none-any.whl)
sha256sums=(d9dbf137a2ef917e0a6110d50bc79b132d5a35464cea943c891a30dd4412c6b2)
noextract+=(salt_lint-0.9.2-py3-none-any.whl)
source+=(LICENSE)
sha256sums+=(0aa56ec10b6c3f24385b7c684e61520fc24b1d913c3618b54ed5eead5655e552)
_first_source() {
echo " ${source_i686[@]} ${source_x86_64[@]} ${source[@]}" |
tr ' ' '\n' | grep -Pv '^(PKGBUILD_EXTRAS)?$' | head -1
}
if [[ $(_first_source) =~ ^git+ ]]; then
provides+=("${pkgname%-git}")
conflicts+=("${pkgname%-git}")
fi
_is_wheel() {
[[ $(_first_source) =~ \.whl$ ]]
}
if [[ _is_wheel &&
$(basename "$(_first_source)" | rev | cut -d- -f1 | rev) =~ ^manylinux ]]; then
options=(!strip) # https://github.com/pypa/manylinux/issues/119
fi
_dist_name() {
find "$srcdir" -mindepth 1 -maxdepth 1 -type d -printf %f
}
if [[ $(_first_source) =~ ^git+ ]]; then
_pkgver() {
( set -o pipefail
cd "$srcdir/$(_dist_name)"
git describe --long --tags 2>/dev/null |
sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' ||
printf "r%s.%s" \
"$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
)
}
pkgver() { _pkgver; }
fi
_build() {
if _is_wheel; then return; fi
cd "$srcdir/$(_dist_name)"
# See Arch Wiki/PKGBUILD/license.
# Get the first filename that matches.
local test_name
if [[ ${license[0]} =~ ^(BSD|MIT|ZLIB|Python)$ ]]; then
for test_name in LICENSE LICENSE.txt license.txt COPYING COPYING.md COPYING.rst COPYING.txt COPYRIGHT; do
if cp "$srcdir/$(_dist_name)/$test_name" "$srcdir/LICENSE" 2>/dev/null; then
break
fi
done
fi
# Build the wheel (which we allow to fail) only after fetching the license.
/usr/bin/pip wheel -v --no-deps --wheel-dir="$srcdir" \
--global-option=--no-user-cfg \
--global-option=build --global-option=-j"$(nproc)" . ||
true
}
build() { _build; }
_check() {
# Define check(), possibly using _check as a helper, to run the tests.
# You may need to call `python setup.py build_ext -i` first.
if _is_wheel; then return; fi
cd "$srcdir/$(_dist_name)"
/usr/bin/python setup.py -q test
}
_package() {
cd "$srcdir"
# pypa/pip#3063: pip always checks for a globally installed version.
/usr/bin/pip --quiet install --root="$pkgdir" \
--no-deps --ignore-installed --no-warn-script-location \
"$(ls ./*.whl 2>/dev/null || echo ./"$(_dist_name)")"
if [[ -d "$pkgdir/usr/etc" ]]; then
mv "$pkgdir/usr/etc" "$pkgdir/etc"
fi
if [[ -f LICENSE ]]; then
install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
fi
}
package() { _package; }
. "$(dirname "$BASH_SOURCE")/PKGBUILD_EXTRAS"