common/hooks: remove pycompile_version, use python_version instead

This commit is contained in:
Piotr Wójcik 2020-04-20 19:22:10 +02:00 committed by Piotr
parent 6c6ab14604
commit 8a09d89eac
30 changed files with 41 additions and 35 deletions

View file

@ -27,7 +27,7 @@ unset -v font_dirs
unset -v xml_entries sgml_entries xml_catalogs sgml_catalogs
# xbps-triggers: pycompile
unset -v pycompile_version pycompile_dirs pycompile_module
unset -v pycompile_dirs pycompile_module
# xbps-triggers: dkms
unset -v dkms_modules

View file

@ -258,6 +258,7 @@ _EOF
#
# Handle python bytecode archives with pycompile trigger.
#
local pycompile_version
if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
pycompile_version="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]$')"
if [ -z "${pycompile_module}" ]; then
@ -265,8 +266,17 @@ _EOF
fi
fi
if [ -n "$python_version" ]; then
pycompile_version=${python_version}
fi
if [ "$pycompile_version" = 3 ]; then
pycompile_version=${py3_ver}
fi
if [ -n "${pycompile_dirs}" -o -n "${pycompile_module}" ]; then
echo "export pycompile_version=\"${pycompile_version:=2.7}\"" >>$tmpf
[ -n "$pycompile_version" ] || msg_error "$pkgver: byte-compilation is required, but python_version is not set\n"
echo "export pycompile_version=\"${pycompile_version}\"" >>$tmpf
if [ -n "${pycompile_dirs}" ]; then
echo "export pycompile_dirs=\"${pycompile_dirs}\"" >>$tmpf
fi