aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlessio Sergi <al3hex@gmail.com>2016-11-17 16:37:37 +0000
committerAlessio Sergi <al3hex@gmail.com>2016-11-17 16:42:54 +0000
commit29c37543cf75436b4c602fd1a0f16a11b3c05539 (patch)
tree655720a3cd89de39c558d7ed77bbe55decfb3283 /common
parenta28fd5497d1da29770ed1ae191835364bbc50d79 (diff)
downloadvoid-packages-29c37543cf75436b4c602fd1a0f16a11b3c05539.tar
void-packages-29c37543cf75436b4c602fd1a0f16a11b3c05539.tar.gz
void-packages-29c37543cf75436b4c602fd1a0f16a11b3c05539.tar.bz2
void-packages-29c37543cf75436b4c602fd1a0f16a11b3c05539.tar.lz
void-packages-29c37543cf75436b4c602fd1a0f16a11b3c05539.tar.xz
void-packages-29c37543cf75436b4c602fd1a0f16a11b3c05539.tar.zst
void-packages-29c37543cf75436b4c602fd1a0f16a11b3c05539.zip
xbps-src: introduce python_version
Diffstat (limited to 'common')
-rw-r--r--common/environment/setup/python.sh3
-rw-r--r--common/environment/setup/sourcepkg.sh2
-rw-r--r--common/hooks/pre-pkg/03-rewrite-python-shebang.sh4
3 files changed, 8 insertions, 1 deletions
diff --git a/common/environment/setup/python.sh b/common/environment/setup/python.sh
index 5f3209aa0c4..9b712a7baed 100644
--- a/common/environment/setup/python.sh
+++ b/common/environment/setup/python.sh
@@ -4,6 +4,9 @@
__python2="/usr/bin/python2"
__python3="/usr/bin/python3"
+# set version 2 as the default Python
+python_version="2"
+
if [ -x ${__python2} ]; then
py2_ver="$(${__python2} -c 'import sys; print(sys.version[:3])')"
py2_lib="$(${__python2} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib(0, 1))')"
diff --git a/common/environment/setup/sourcepkg.sh b/common/environment/setup/sourcepkg.sh
index 435e1438c6a..ab57f0fd208 100644
--- a/common/environment/setup/sourcepkg.sh
+++ b/common/environment/setup/sourcepkg.sh
@@ -5,7 +5,7 @@
unset -v pkgname version revision short_desc homepage license maintainer
unset -v only_for_archs distfiles checksum build_style nocross broken
unset -v configure_script configure_args wrksrc build_wrksrc create_wrksrc
-unset -v make_cmd make_build_args make_install_args make_build_target make_install_target stackage
+unset -v make_cmd make_build_args make_install_args make_build_target make_install_target python_version stackage
unset -v patch_args disable_parallel_build keep_libtool_archives
unset -v reverts subpackages makedepends hostmakedepends depends restricted
unset -v nopie build_options build_options_default bootstrap repository reverts
diff --git a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
index ebd8d55db97..40487d73a7c 100644
--- a/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
+++ b/common/hooks/pre-pkg/03-rewrite-python-shebang.sh
@@ -14,6 +14,10 @@ hook() {
pyver="$pycompile_version"
fi
+ if [ "$python_version" = "3" ]; then
+ pyver="$python_version"
+ fi
+
shebang="#!/usr/bin/python${pyver%.*}"
find ${PKGDESTDIR} -type f -print0 | \
xargs -0 grep -H -b -m 1 "^#!.*\([[:space:]]\|/\)python\([[:space:]]*\|$\)" -- | while IFS=: read -r f off _; do