1 |
Requested by jlec, I think. |
2 |
--- |
3 |
gx86/eclass/python-utils-r1.eclass | 47 ++++++++++++++++++++++++++++++-------- |
4 |
1 file changed, 37 insertions(+), 10 deletions(-) |
5 |
|
6 |
diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass |
7 |
index b425302..c5a1f6e 100644 |
8 |
--- a/gx86/eclass/python-utils-r1.eclass |
9 |
+++ b/gx86/eclass/python-utils-r1.eclass |
10 |
@@ -521,7 +521,34 @@ python_scriptinto() { |
11 |
python_doscript() { |
12 |
debug-print-function ${FUNCNAME} "${@}" |
13 |
|
14 |
+ local f |
15 |
+ for f; do |
16 |
+ python_newscript "${f}" "${f}" |
17 |
+ done |
18 |
+} |
19 |
+ |
20 |
+# @FUNCTION: python_newscript |
21 |
+# @USAGE: <path> <new-name> |
22 |
+# @DESCRIPTION: |
23 |
+# Install the given script into current python_scriptroot |
24 |
+# for the current Python implementation (${EPYTHON}), and name it |
25 |
+# <new-name>. |
26 |
+# |
27 |
+# The file must start with a 'python' shebang. The shebang will be |
28 |
+# converted, the file will be renamed to be EPYTHON-suffixed |
29 |
+# and a wrapper will be installed in place of the <new-name>. |
30 |
+# |
31 |
+# Example: |
32 |
+# @CODE |
33 |
+# src_install() { |
34 |
+# python_foreach_impl python_newscript foo.py foo |
35 |
+# } |
36 |
+# @CODE |
37 |
+python_newscript() { |
38 |
+ debug-print-function ${FUNCNAME} "${@}" |
39 |
+ |
40 |
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' |
41 |
+ [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>" |
42 |
|
43 |
local d=${python_scriptroot:-${DESTTREE}/bin} |
44 |
local INSDESTTREE INSOPTIONS |
45 |
@@ -529,18 +556,18 @@ python_doscript() { |
46 |
insinto "${d}" |
47 |
insopts -m755 |
48 |
|
49 |
- local f |
50 |
- for f; do |
51 |
- local oldfn=${f##*/} |
52 |
- local newfn=${oldfn}-${EPYTHON} |
53 |
+ local f=${1} |
54 |
+ local barefn=${2} |
55 |
|
56 |
- debug-print "${FUNCNAME}: ${oldfn} -> ${newfn}" |
57 |
- newins "${f}" "${newfn}" || die |
58 |
- _python_rewrite_shebang "${ED}/${d}/${newfn}" |
59 |
+ local oldfn=${f##*/} |
60 |
+ local newfn=${barefn}-${EPYTHON} |
61 |
|
62 |
- # install the wrapper |
63 |
- _python_ln_rel "${ED}"/usr/bin/python-exec "${ED}/${d}/${oldfn}" || die |
64 |
- done |
65 |
+ debug-print "${FUNCNAME}: ${oldfn} -> ${newfn}" |
66 |
+ newins "${f}" "${newfn}" || die |
67 |
+ _python_rewrite_shebang "${ED}/${d}/${newfn}" |
68 |
+ |
69 |
+ # install the wrapper |
70 |
+ _python_ln_rel "${ED}"/usr/bin/python-exec "${ED}/${d}/${barefn}" || die |
71 |
} |
72 |
|
73 |
# @ECLASS-VARIABLE: python_moduleroot |
74 |
-- |
75 |
1.8.1.2 |