blob: 007fa4aac7da4fba134308b62966fefed11556e1 (
plain) (
blame)
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
|
# This hook executes the following tasks:
# - checks if python requires are satisfied
hook() {
local requires= pver= req= reqname= modules= module= cmp=;
if [ -e "$wrksrc/requirements.txt" ]; then
requires=$(grep -v "^#.*" "$wrksrc/requirements.txt")
elif [ -e "$wrksrc/setup.py" ]; then
pver=${python_versions%% *}
requires=$( ( cd "$wrksrc"; python$pver -c 'import setup; print("\n".join(setup.params["install_requires"]))') )
else
return 0
fi
# reads all dependencies and creates a list of modules
modules=$(for dep in $depends; do
(
local _name=
setup_pkg "$dep" "$XBPS_CROSS_BUILD" ignore-problems
if [ -h "$XBPS_SRCPKGDIR/${pkgname}" ]; then
"${pkgname}_package"
fi
printf "%s:%s:" ${pkgname}-${version}_${revision} "$pkgname"
for _name in ${pycompile_module}; do
_name="${_name//\//.}"
printf "%s:" "${_name%.py}"
done
echo
)
done)
# checks if all requires are satisfied by the depending modules
for i in $requires; do
req=${i/;*/}
if ! reqname="$($XBPS_UHELPER_CMD getpkgdepname "${req}")"; then
reqname=$_tmpreq
fi
if ! module=$(echo "$modules" | grep ":$reqname:"); then
msg_warn "Python Dependency $req not found\n"
msg_warn " Full pattern: ${i}\n"
continue
fi
cmp=$(echo "$req" | sed "s/[^<>=]*/$($XBPS_UHELPER_CMD getpkgname "${module%%:*}")/")
if $XBPS_UHELPER_CMD pkgmatch "${module%%:*}" "$cmp"; then
msg_warn "Python Dependency version mismatch: $cmp => ${module%%:*}\n"
fi
done
}
|