Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH 7/8] Replace _python_ln_rel() with _python_symlink_wrapper().
Date: Fri, 13 Sep 2013 18:58:40
Message-Id: 1379098729-2801-8-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-python] Clean up of python eclasses and support for python-exec:2 by "Michał Górny"
1 This will allow us to easily avoid repeating path to python-exec.
2 ---
3 gx86/eclass/distutils-r1.eclass | 3 +--
4 gx86/eclass/python-r1.eclass | 2 +-
5 gx86/eclass/python-utils-r1.eclass | 19 +++++++++----------
6 3 files changed, 11 insertions(+), 13 deletions(-)
7
8 diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
9 index 7b119bf..0517bbb 100644
10 --- a/gx86/eclass/distutils-r1.eclass
11 +++ b/gx86/eclass/distutils-r1.eclass
12 @@ -433,8 +433,7 @@ _distutils-r1_wrap_scripts() {
13 mv "${f}" "${ED%/}/usr/bin/${newfn}" || die
14
15 debug-print "${FUNCNAME}: installing wrapper at /usr/bin/${basename}"
16 - _python_ln_rel "${D}${EPREFIX}"/usr/bin/python-exec \
17 - "${ED%/}/usr/bin/${basename}" || die
18 + _python_symlink_wrapper "${ED%/}/usr/bin/${basename}"
19 else
20 debug-print "${FUNCNAME}: non-matching shebang: ${shebang}"
21
22 diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
23 index e006744..d1b2143 100644
24 --- a/gx86/eclass/python-r1.eclass
25 +++ b/gx86/eclass/python-r1.eclass
26 @@ -756,7 +756,7 @@ python_replicate_script() {
27 # install the wrappers
28 local f
29 for f; do
30 - _python_ln_rel "${ED%/}"/usr/bin/python-exec "${f}" || die
31 + _python_symlink_wrapper "${f}"
32 done
33 }
34
35 diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
36 index 6cf23f0..dd1ce0b 100644
37 --- a/gx86/eclass/python-utils-r1.eclass
38 +++ b/gx86/eclass/python-utils-r1.eclass
39 @@ -575,16 +575,16 @@ _python_rewrite_shebang() {
40 done
41 }
42
43 -# @FUNCTION: _python_ln_rel
44 -# @USAGE: <from> <to>
45 +# @FUNCTION: _python_symlink_wrapper
46 +# @USAGE: <to>
47 # @INTERNAL
48 # @DESCRIPTION:
49 -# Create a relative symlink.
50 -_python_ln_rel() {
51 +# Create a relative symlink to the proper version of python-exec.
52 +_python_symlink_wrapper() {
53 debug-print-function ${FUNCNAME} "${@}"
54
55 - local from=${1}
56 - local to=${2}
57 + local from=${ED%/}/usr/bin/python-exec
58 + local to=${1}
59
60 local frpath=${from%/*}/
61 local topath=${to%/*}/
62 @@ -607,12 +607,12 @@ _python_ln_rel() {
63 rel_path=../${rel_path}${frseg:+${frseg}/}
64 fi
65 done
66 - rel_path+=${frpath}${1##*/}
67 + rel_path+=${frpath}${from##*/}
68
69 debug-print "${FUNCNAME}: ${from} -> ${to}"
70 debug-print "${FUNCNAME}: rel_path = ${rel_path}"
71
72 - ln -fs "${rel_path}" "${to}"
73 + ln -fs "${rel_path}" "${to}" || die
74 }
75
76 # @FUNCTION: python_optimize
77 @@ -769,8 +769,7 @@ python_newscript() {
78 _python_rewrite_shebang "${ED%/}/${d}/${newfn}"
79
80 # install the wrapper
81 - _python_ln_rel "${ED%/}"/usr/bin/python-exec \
82 - "${ED%/}/${d}/${barefn}" || die
83 + _python_symlink_wrapper "${ED%/}/${d}/${barefn}"
84 }
85
86 # @ECLASS-VARIABLE: python_moduleroot
87 --
88 1.8.3.2

Replies