Gentoo Archives: gentoo-python

From: Mike Gilbert <floppym@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-python <gentoo-python@l.g.o>, Gentoo Python Project <python@g.o>
Subject: [gentoo-python] Re: [PATCH 7/8] Replace _python_ln_rel() with _python_symlink_wrapper().
Date: Sun, 15 Sep 2013 17:27:12
Message-Id: CAJ0EP439Pz8wjBgOabeb2YT6FziqyehrWrR=K-dvJzrRzCGxtA@mail.gmail.com
In Reply to: [gentoo-python] [PATCH 7/8] Replace _python_ln_rel() with _python_symlink_wrapper(). by "Michał Górny"
1 On Fri, Sep 13, 2013 at 2:58 PM, Michał Górny <mgorny@g.o> wrote:
2 > diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
3 > index 6cf23f0..dd1ce0b 100644
4 > --- a/gx86/eclass/python-utils-r1.eclass
5 > +++ b/gx86/eclass/python-utils-r1.eclass
6 > @@ -575,16 +575,16 @@ _python_rewrite_shebang() {
7 > done
8 > }
9 >
10 > -# @FUNCTION: _python_ln_rel
11 > -# @USAGE: <from> <to>
12 > +# @FUNCTION: _python_symlink_wrapper
13 > +# @USAGE: <to>
14 > # @INTERNAL
15 > # @DESCRIPTION:
16 > -# Create a relative symlink.
17 > -_python_ln_rel() {
18 > +# Create a relative symlink to the proper version of python-exec.
19 > +_python_symlink_wrapper() {
20 > debug-print-function ${FUNCNAME} "${@}"
21 >
22 > - local from=${1}
23 > - local to=${2}
24 > + local from=${ED%/}/usr/bin/python-exec
25 > + local to=${1}
26 >
27 > local frpath=${from%/*}/
28 > local topath=${to%/*}/
29 > @@ -607,12 +607,12 @@ _python_ln_rel() {
30 > rel_path=../${rel_path}${frseg:+${frseg}/}
31 > fi
32 > done
33 > - rel_path+=${frpath}${1##*/}
34 > + rel_path+=${frpath}${from##*/}
35 >
36 > debug-print "${FUNCNAME}: ${from} -> ${to}"
37 > debug-print "${FUNCNAME}: rel_path = ${rel_path}"
38 >
39 > - ln -fs "${rel_path}" "${to}"
40 > + ln -fs "${rel_path}" "${to}" || die
41
42 It seems like "from" and "to" are backwards here; the link name should
43 be the "from" and python-exec should be the "to".
44
45 Perhaps better variable names would be "linkname" and "target", as are
46 used in the ln(1) manpage.