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