summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2015-11-12 18:06:32 +0100
committerMichał Górny <mgorny@gentoo.org>2015-11-12 18:06:32 +0100
commitcf186abf6240fc116f4a38d74cf8d627de57da6d (patch)
tree31236ead171c6f4d22eff45fa8b83370ea40ace0
parentStore selected python[23] version in a file (diff)
downloadeselect-python-cf186abf6240fc116f4a38d74cf8d627de57da6d.tar.gz
eselect-python-cf186abf6240fc116f4a38d74cf8d627de57da6d.tar.bz2
eselect-python-cf186abf6240fc116f4a38d74cf8d627de57da6d.zip
Stop creating symlinks to interpreters and the wrapper
-rw-r--r--python.eselect.in60
1 files changed, 11 insertions, 49 deletions
diff --git a/python.eselect.in b/python.eselect.in
index 32d9cbf..3d9b4bc 100644
--- a/python.eselect.in
+++ b/python.eselect.in
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
# $Id: $
-DESCRIPTION="Manage Python symlinks"
+DESCRIPTION="Manage active Python interpreter"
MAINTAINER="python@gentoo.org"
SVN_DATE='$Date$'
VERSION=$(svn_date_to_version "${SVN_DATE}" )
@@ -41,44 +41,18 @@ set_python_subver() {
}
set_python() {
- local symlink="${INTERPRETER_PATH}python" target="${1}"
- ln -s python-wrapper "${symlink}"
+ local target="${1}"
mkdir -p "${ENV_D_PATH}/python"
echo "${target}" > "${ENV_D_PATH}/python/config"
}
-set_python_config() {
- local script="${INTERPRETER_PATH}python-config" target="${1}"
- cat << EOF > "${script}"
-#!/usr/bin/env bash
-# Gentoo python-config wrapper script
-
-[[ "\${EPYTHON}" =~ (/|^python\$) ]] && EPYTHON="${target/-config-/}"
-python_config="\${EPYTHON/python/python-config-}"
-"\${0%/*}/\${python_config:-${target}}" "\$@"
-EOF
- chmod a+rx "${script}"
-}
-
# Try to remove python and python.1 symlinks
remove_symlinks() {
local symlink symlink_target symlink_target_found
if [[ "${SET_MAIN_ACTIVE_PYTHON_INTERPRETER}" == "1" ]]; then
- rm -f "${INTERPRETER_PATH}"{idle,pydoc,python,python-config,pythonw} &> /dev/null || return 1
rm -f "${MAN_PATH}"python.1{,.gz,.bz2,.lzma,.xz,.lz} &> /dev/null || return 1
fi
- for symlink in "${INTERPRETER_PATH}python"?; do
- [[ ! -L "${symlink}" ]] && continue
- symlink_target_found=0
- for symlink_target in "${symlink}".?; do
- [[ -f "${symlink_target}" ]] && symlink_target_found=1
- done
- if [[ "${symlink_target_found}" -eq 0 ]]; then
- rm -f "${symlink}"
- fi
- done
-
# Files of Mac OS X framework
rm -f "${INTERPRETER_PATH%/bin/}/lib/Python.framework}"/{Headers,Python,Resources}
}
@@ -125,25 +99,9 @@ set_scripts_and_symlinks() {
pushd "${INTERPRETER_PATH}" 1> /dev/null
- ln -nfs "${target}" "${target%.*}"
set_python_subver "${target}"
if [[ "${SET_MAIN_ACTIVE_PYTHON_INTERPRETER}" == "1" ]]; then
set_python "${target}"
- set_python_config "${target/python/python-config-}"
- ln -nfs "${target/python/pydoc}" pydoc
- # idle is optionally installed
- if [[ -f "${target/python/idle}" ]]; then
- ln -nfs "${target/python/idle}" idle
- fi
- # 2to3 for >=2.6
- if [[ -f "${target/python/2to3-}" ]]; then
- ln -nfs "${target/python/2to3-}" 2to3
- fi
-
- # Wrapper for graphical applications on Mac OS X
- if [[ -f "${target/python/pythonw}" ]] ; then
- ln -nfs "${target/python/pythonw}" pythonw
- fi
# Files of Mac OS X framework
local framework_dir="${INTERPRETER_PATH%/bin/}/lib/Python.framework"
@@ -213,9 +171,13 @@ do_show() {
fi
if [[ "${python2}" == "1" ]]; then
- interpreter="$(<"${ENV_D_PATH}/python/python2")"
+ if [[ -f ${ENV_D_PATH}/python/python2 ]]; then
+ interpreter="$(<"${ENV_D_PATH}/python/python2")"
+ fi
elif [[ "${python3}" == "1" ]]; then
- interpreter="$(<"${ENV_D_PATH}/python/python3")"
+ if [[ -f ${ENV_D_PATH}/python/python3 ]]; then
+ interpreter="$(<"${ENV_D_PATH}/python/python3")"
+ fi
elif [[ -f "${ENV_D_PATH}/python/config" ]]; then
interpreter="$(<"${ENV_D_PATH}/python/config")"
fi
@@ -385,10 +347,10 @@ do_update() {
die -q "'--python2' and '--python3' options cannot be specified simultaneously"
fi
- if [[ "${if_unset}" == "1" && -f "${INTERPRETER_PATH}python" && -f "${ENV_D_PATH}/python/config" ]]; then
- if [[ "${python2}" == "1" && -f "${INTERPRETER_PATH}python2" ]]; then
+ if [[ "${if_unset}" == "1" && -f "${ENV_D_PATH}/python/config" ]]; then
+ if [[ "${python2}" == "1" && -f "${ENV_D_PATH}/python/python2" ]]; then
return
- elif [[ "${python3}" == "1" && -f "${INTERPRETER_PATH}python3" ]]; then
+ elif [[ "${python3}" == "1" && -f "${ENV_D_PATH}/python/python3" ]]; then
return
elif [[ "${python2}" == "0" && "${python3}" == "0" ]]; then
return