public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect-python:mgornys-hackery commit in: /
Date: Thu, 12 Nov 2015 17:07:44 +0000 (UTC)	[thread overview]
Message-ID: <1447347992.cf186abf6240fc116f4a38d74cf8d627de57da6d.mgorny@gentoo> (raw)
Message-ID: <20151112170744.-v_pOSgWE5r4wSRqyjEmKIR4Q9CpnkSJ-nKFwzt7_lM@z> (raw)

commit:     cf186abf6240fc116f4a38d74cf8d627de57da6d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 12 17:06:32 2015 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Nov 12 17:06:32 2015 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-python.git/commit/?id=cf186abf

Stop creating symlinks to interpreters and the wrapper

 python.eselect.in | 60 ++++++++++---------------------------------------------
 1 file 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


             reply	other threads:[~2015-11-12 17:07 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 18:36 Michał Górny [this message]
2015-11-12 17:07 ` [gentoo-commits] proj/eselect-python:mgornys-hackery commit in: / Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2020-07-19 20:20 [gentoo-commits] proj/eselect-python:master " Patrick McLean
2020-07-19 20:20 Patrick McLean
2019-04-17 12:26 Michał Górny
2019-04-17 10:47 Michał Górny
2017-12-04 17:32 Michał Górny
2017-12-03 13:24 Michał Górny
2017-12-03 13:23 Michał Górny
2017-12-03 12:20 Michał Górny
2016-08-03 15:44 Mike Gilbert
2016-05-16 18:04 Michał Górny
2016-05-16 16:47 Michał Górny
2016-05-16 16:38 Michał Górny
2016-05-16 16:38 Michał Górny
2016-02-28 17:03 Michał Górny
2016-02-28 17:03 Michał Górny
2016-02-23 22:16 Michał Górny
2016-02-22 21:41 Michał Górny
2016-02-22 21:41 Michał Górny
2016-02-22 21:41 Michał Górny
2016-02-06 21:30 Michał Górny
2016-02-06 21:30 Michał Górny
2016-02-06 21:30 Michał Górny
2016-02-06 21:30 Michał Górny
2016-02-06  9:50 Michał Górny
2016-02-06  9:49 Michał Górny
2016-02-06  9:29 Michał Górny
2016-02-06  9:00 Michał Górny
2016-02-05 20:36 [gentoo-commits] proj/eselect-python:pyexec-2.3 " Michał Górny
2016-02-06  9:00 ` [gentoo-commits] proj/eselect-python:master " Michał Górny
2016-02-05 20:36 [gentoo-commits] proj/eselect-python:pyexec-2.3 " Michał Górny
2016-02-06  9:00 ` [gentoo-commits] proj/eselect-python:master " Michał Górny
2015-11-17 18:43 Michał Górny
2015-11-17 18:36 Michał Górny
2015-11-17 18:36 Michał Górny
2015-11-12 16:53 [gentoo-commits] proj/eselect-python:mgornys-hackery " Michał Górny
2015-11-17 18:36 ` [gentoo-commits] proj/eselect-python:master " Michał Górny
2014-01-25 17:04 Mike Gilbert
2014-01-19  8:33 Mike Gilbert
2014-01-19  1:57 Mike Gilbert
2014-01-19  1:57 Mike Gilbert
2013-12-09 18:52 Mike Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447347992.cf186abf6240fc116f4a38d74cf8d627de57da6d.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox