diff options
author | Andrew J. Hesford <ajh@sideband.org> | 2020-04-21 18:55:14 +0000 |
---|---|---|
committer | Toyam Cox <Vaelatern@voidlinux.org> | 2020-04-21 22:45:25 +0000 |
commit | 596250e4ea9b50881e249518e02bd2b7a5aee7c8 (patch) | |
tree | 31a034516f0a37099e1effaae7446d7737057d54 | |
parent | b02bc96f33ada8cebd524204e283c1e49ccc2208 (diff) | |
download | void-packages-596250e4ea9b50881e249518e02bd2b7a5aee7c8.tar void-packages-596250e4ea9b50881e249518e02bd2b7a5aee7c8.tar.gz void-packages-596250e4ea9b50881e249518e02bd2b7a5aee7c8.tar.bz2 void-packages-596250e4ea9b50881e249518e02bd2b7a5aee7c8.tar.lz void-packages-596250e4ea9b50881e249518e02bd2b7a5aee7c8.tar.xz void-packages-596250e4ea9b50881e249518e02bd2b7a5aee7c8.tar.zst void-packages-596250e4ea9b50881e249518e02bd2b7a5aee7c8.zip |
xbps-src: remove default python_version
Closes: #21209 [via git-merge-pr]
-rw-r--r-- | common/environment/setup/python.sh | 3 | ||||
-rw-r--r-- | common/hooks/pre-pkg/03-rewrite-python-shebang.sh | 12 |
2 files changed, 5 insertions, 10 deletions
diff --git a/common/environment/setup/python.sh b/common/environment/setup/python.sh index ba181d45361..eca368dbf0d 100644 --- a/common/environment/setup/python.sh +++ b/common/environment/setup/python.sh @@ -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" diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh index 4de75da2a76..3450c3a3a8f 100644 --- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh +++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh @@ -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" + if [ -n "$python_version" ]; then + pyver="$python_version" fi - if [ "$python_version" = "3" ]; then - pyver="$python_version" + if [ -n "$pyver" ]; then + shebang="#!/usr/bin/python${pyver%.*}" fi - shebang="#!/usr/bin/python${pyver%.*}" 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 |