From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect-python:pyexec-2.3 commit in: /
Date: Thu, 4 Feb 2016 21:53:44 +0000 (UTC) [thread overview]
Message-ID: <1454622771.e244f5dc8742446047c0292fe224c422577a8afa.mgorny@gentoo> (raw)
commit: e244f5dc8742446047c0292fe224c422577a8afa
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 4 21:52:51 2016 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Feb 4 21:52:51 2016 +0000
URL: https://gitweb.gentoo.org/proj/eselect-python.git/commit/?id=e244f5dc
big cleanup
python.eselect.in | 96 +++++++++++++++++++++++++++----------------------------
1 file changed, 48 insertions(+), 48 deletions(-)
diff --git a/python.eselect.in b/python.eselect.in
index d1e2836..2680d69 100644
--- a/python.eselect.in
+++ b/python.eselect.in
@@ -9,7 +9,7 @@ VERSION=20160202
CONFIG_PATH="${EROOT%/}/etc/python-exec/python-exec.conf"
ENV_D_PATH="${EROOT%/}/etc/env.d"
INTERPRETER_DIR="${EROOT%/}/usr/bin"
-MAN_PATH="${EROOT%/}/usr/share/man/man1/"
+MAN_PATH="${EROOT%/}/usr/share/man/man1"
# Get list of all installed Python interpreters, in lexical order.
# $1 can be --pyN to filter results to pythonN.?.
@@ -74,6 +74,7 @@ get_all_pythons() {
local targets=( $(get_installed_pythons "${@}") )
local preferred=( $(get_preferred_pythons "${@}") )
local disabled=( $(get_disabled_pythons "${@}") )
+ local i
# preferred first
for i in "${preferred[@]}"; do
@@ -104,25 +105,23 @@ write_preferences() {
# Set a man page symlink
set_man_symlink() {
- local target="${1}" x extension
+ local target=${1} x suffix
- rm -f "${MAN_PATH}"python.1{,.gz,.bz2,.lzma,.xz,.lz}
+ rm -f "${MAN_PATH}"/python.1{,.gz,.bz2,.lzma,.xz,.lz} || die
- for x in ".1" ".1.bz2" ".1.gz" ".1.lzma" ".1.xz" ".1.lz"; do
- if [[ -e "${MAN_PATH}${target}${x}" ]]; then
- extension="${x}"
+ for x in .1{,.gz,.bz2,.lzma,.xz,.lz}; do
+ if [[ -e "${MAN_PATH}/${target}${x}" ]]; then
+ suffix=${x}
break
fi
done
- if [[ -z "${extension}" ]]; then
+ if [[ ! ${suffix} ]]; then
echo "Couldn't find a man page for ${target}; skipping." 1>&2
return 1
fi
- pushd "${MAN_PATH}" 1> /dev/null
- ln -nfs "${target}${extension}" "python${extension}"
- popd 1> /dev/null
+ ln -nfs "${target}${extension}" "${MAN_PATH}/python${extension}" || die
}
# Set OSX framework symlinks
@@ -130,22 +129,22 @@ set_osx_framework() {
local target=${1}
# Files of Mac OS X framework
- local framework_dir="${INTERPRETER_PATH%/bin/}/lib/Python.framework"
- if [[ -d "${framework_dir}" ]]; then
- local version="${target#python}"
- pushd "${framework_dir}" 1> /dev/null
- rm -f Headers Python Resources
- ln -nfs "Versions/${version}/Headers"
- ln -nfs "Versions/${version}/Python"
- ln -nfs "Versions/${version}/Resources"
- popd 1> /dev/null
+ local framework_dir="${INTERPRETER_DIR%/bin}"/lib/Python.framework
+ if [[ -d ${framework_dir} ]]; then
+ local version=${target#python}
+ pushd "${framework_dir}" >/dev/null || die
+ rm -f Headers Python Resources || die
+ ln -nfs "Versions/${version}/Headers" || die
+ ln -nfs "Versions/${version}/Python" || die
+ ln -nfs "Versions/${version}/Resources" || die
+ popd >/dev/null || die
fi
}
# Set the content of /etc/env.d/65python-docs
set_python_docs() {
- local path target="${1#python}" variable
- rm -f "${ENV_D_PATH}/65python-docs"
+ local path target=${1#python} variable
+ rm -f "${ENV_D_PATH}/65python-docs" || die
if [[ -f ${ENV_D_PATH}/60python-docs-${target} ]]; then
variable="PYTHONDOCS_${target//./_}"
path="$(. "${ENV_D_PATH}/60python-docs-${target}"; echo "${!variable}")"
@@ -169,21 +168,21 @@ post_update() {
### show action ###
describe_show() {
- echo "Show main active Python interpreter"
+ echo "Show the most preferred Python interpreter"
}
describe_show_options() {
- echo "--ABI : Show Python ABI in format of PYTHON_ABI variable"
- echo "--python2 : Show active Python 2 interpreter"
- echo "--python3 : Show active Python 3 interpreter"
+ echo "--ABI : use PYTHON_ABI variable format (deprecated)"
+ echo "--python2 : show the preferred version of Python 2"
+ echo "--python3 : show the preferred version of Python 3"
}
do_show() {
- local ABI filter interpreter
- while [[ $# > 0 ]]; do
- case "$1" in
+ local abi filter interpreter
+ while [[ ${#} -gt 0 ]]; do
+ case ${1} in
--ABI)
- ABI=1
+ abi=1
;;
--python2|--py2)
filter=--py2
@@ -198,7 +197,8 @@ do_show() {
shift
done
- local all_interpreters=( $(get_preferred_pythons ${filter}) ) i
+ local all_interpreters=( $(get_preferred_pythons ${filter}) )
+ local i
for i in "${all_interpreters[@]}"; do
# skip if not installed
[[ -x ${INTERPRETER_DIR}/${i}@EXEEXT@ ]] || continue
@@ -206,7 +206,7 @@ do_show() {
break
done
- if [[ "${ABI}" == "1" ]]; then
+ if [[ ${abi} ]]; then
echo "${interpreter#python}"
else
echo "${interpreter}"
@@ -220,14 +220,14 @@ describe_list() {
}
describe_list_options() {
- echo "--python2 : List installed Python 2 interpreters"
- echo "--python3 : List installed Python 3 interpreters"
+ echo "--python2 : list only Python 2 interpreters"
+ echo "--python3 : list only Python 3 interpreters"
}
do_list() {
local filter
- while [[ $# > 0 ]]; do
- case "$1" in
+ while [[ ${#} -gt 0 ]]; do
+ case ${1} in
--python2|--py2)
filter=--py2
;;
@@ -260,12 +260,12 @@ do_list() {
### set action ###
describe_set() {
- echo "Set main active Python interpreter"
+ echo "Set the preferred Python interpreter"
}
describe_set_options() {
- echo "--python2 : Set active Python 2 interpreter without setting of main active Python interpreter if it is not set to Python 2"
- echo "--python3 : Set active Python 3 interpreter without setting of main active Python interpreter if it is not set to Python 3"
+ echo "--python2 : update preference for Python 2 versions only"
+ echo "--python3 : update preference for Python 3 versions only"
}
describe_set_parameters() {
@@ -274,8 +274,8 @@ describe_set_parameters() {
do_set() {
local filter
- while [[ $# > 0 ]]; do
- case "$1" in
+ while [[ ${#} -gt 0 ]]; do
+ case ${1} in
--python2|--py2)
filter=--py2
;;
@@ -289,14 +289,14 @@ do_set() {
shift
done
- [[ $# -eq 1 ]] || die "Usage: eselect python set <interpreter>"
+ [[ ${#} -eq 1 ]] || die "Usage: eselect python set <interpreter>"
local target=${1}
local targets=( $(get_all_pythons ${filter}) )
if is_number "${target}" \
&& [[ ${target} -ge 1 && ${target} -le ${#targets[@]} ]]
then
- target=${targets[$((${target} - 1))]}
+ target=${targets[target-1]}
fi
has "${target}" "${targets[@]}" || die "Invalid target: ${target}"
@@ -333,16 +333,16 @@ describe_update() {
}
describe_update_options() {
- echo "--if-unset : Do not override existing implementation"
- echo "--ignore SLOT : Ignore SLOT when setting symlinks"
- echo "--python2 : Set active Python 2 interpreter without setting of main active Python interpreter if it is not set to Python 2"
- echo "--python3 : Set active Python 3 interpreter without setting of main active Python interpreter if it is not set to Python 3"
+ echo "--if-unset : do not alter preferences unless there is no valid preference set"
+ echo "--ignore SLOT : ignore specified Python slots"
+ echo "--python2 : update only Python 2 preferences"
+ echo "--python3 : update only Python 3 preferences"
}
do_update() {
local if_unset ignored_slots=() filter
- while [[ $# > 0 ]]; do
- case "$1" in
+ while [[ ${#} -gt 0 ]]; do
+ case ${1} in
--if-unset)
if_unset=1
;;
next reply other threads:[~2016-02-04 21:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-04 21:53 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-02-04 22:02 [gentoo-commits] proj/eselect-python:pyexec-2.3 commit in: / Michał Górny
2016-02-05 19:56 Michał Górny
2016-02-05 19:56 Michał Górny
2016-02-05 20:03 Michał Górny
2016-02-05 20:36 Michał Górny
2016-02-05 20:36 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
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=1454622771.e244f5dc8742446047c0292fe224c422577a8afa.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