xbps-src: remove default python_version
Closes: #21209 [via git-merge-pr]
This commit is contained in:
parent
b02bc96f33
commit
596250e4ea
|
@ -2,9 +2,6 @@
|
|||
# Useful variables for determining Python version and paths.
|
||||
#
|
||||
|
||||
# set version 2 as the default Python
|
||||
python_version="2"
|
||||
|
||||
py2_ver="2.7"
|
||||
py2_lib="/usr/lib/python${py2_ver}"
|
||||
py2_sitelib="${py2_lib}/site-packages"
|
||||
|
|
|
@ -4,25 +4,23 @@
|
|||
hook() {
|
||||
local pyver= shebang= off=
|
||||
|
||||
: ${pyver:=2}
|
||||
|
||||
if [ -d ${PKGDESTDIR}/usr/lib/python* ]; then
|
||||
pyver="$(find ${PKGDESTDIR}/usr/lib/python* -prune -type d | grep -o '[[:digit:]]\.[[:digit:]]$')"
|
||||
fi
|
||||
|
||||
if [ -n "$pycompile_version" ]; then
|
||||
pyver="$pycompile_version"
|
||||
fi
|
||||
|
||||
if [ "$python_version" = "3" ]; then
|
||||
if [ -n "$python_version" ]; then
|
||||
pyver="$python_version"
|
||||
fi
|
||||
|
||||
shebang="#!/usr/bin/python${pyver%.*}"
|
||||
if [ -n "$pyver" ]; then
|
||||
shebang="#!/usr/bin/python${pyver%.*}"
|
||||
fi
|
||||
|
||||
find "${PKGDESTDIR}" -type f -print0 | \
|
||||
while IFS= read -r -d '' file; do
|
||||
[ ! -s "$file" ] && continue
|
||||
[ -z "$(sed -n -E -e 2q -e '/^#!.*([[:space:]]|\/)python([0-9]\.[0-9])?([[:space:]]+|$)/p' "$file")" ] && continue
|
||||
[ -n "$shebang" ] || msg_error "cannot convert shebang, set python_version\n"
|
||||
echo " Shebang converted to '$shebang': ${file#$PKGDESTDIR}"
|
||||
sed -i "1s@.*python.*@${shebang}@" -- "$file"
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue
Block a user