-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpythondeps-scl-310.sh
executable file
·50 lines (46 loc) · 1.51 KB
/
pythondeps-scl-310.sh
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
#!/bin/bash
# Altered from pythondeps.sh
# The second parameter is %{scl_prefix}, which is used to prefix python(abi).
[ $# -ge 1 ] || {
cat > /dev/null
exit 0
}
case $1 in
-P|--provides)
shift
# Match buildroot/payload paths of the form
# /PATH/OF/BUILDROOT/%{_scl_root}/usr/bin/pythonMAJOR.MINOR
# generating a line of the form
# %{scl_prefix}python(abi) = MAJOR.MINOR
# (Don't match against -config tools e.g. /usr/bin/python2.6-config)
if [ "x$1" = "x" ]; then
grep "/usr/bin/python.\..$" \
| sed -e "s|.*/usr/bin/python\(.\..\)|python(abi) = \1|"
else
grep "/opt/.*/usr/bin/python.\..$" \
| sed -e "s|.*/usr/bin/python\(.\..\)|$1python(abi) = \1|"
fi
if [ "x$1" != "x" ]; then
grep "pkgconfig(.*$" \
| sed -e "s|pkgconfig(|$1pkgconfig(|"
fi
;;
-R|--requires)
shift
# Match buildroot paths of the form
# /PATH/OF/BUILDROOT/%{scl_root}/usr/lib/pythonMAJOR.MINOR/ and
# /PATH/OF/BUILDROOT/%{scl_root}/usr/lib64/pythonMAJOR.MINOR/
# generating (uniqely) lines of the form:
# %{scl_prefix}python(abi) = MAJOR.MINOR
if [ "x$1" = "x" ]; then
grep "/usr/lib[^/]*/python.\../.*" \
| sed -e "s|.*/usr/lib[^/]*/python\(.\..\)/.*|python(abi) = \1|g" \
| sort | uniq
else
grep "/opt/.*/usr/lib[^/]*/python.\../.*" \
| sed -e "s|.*/usr/lib[^/]*/python\(.\..\)/.*|$1python(abi) = \1|g" \
| sort | uniq
fi
;;
esac
exit 0