1 |
On Wed, Nov 14, 2012 at 2:54 PM, Michał Górny <mgorny@g.o> wrote: |
2 |
> --- |
3 |
> gx86/eclass/python-r1.eclass | 66 ++++++++++++++++++++++++++++++++++++++++++++ |
4 |
> 1 file changed, 66 insertions(+) |
5 |
> |
6 |
> diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass |
7 |
> index 6d4eb33..44103a8 100644 |
8 |
> --- a/gx86/eclass/python-r1.eclass |
9 |
> +++ b/gx86/eclass/python-r1.eclass |
10 |
> @@ -611,3 +611,69 @@ python_replicate_script() { |
11 |
> _python_ln_rel "${ED}"/usr/bin/python-exec "${f}" || die |
12 |
> done |
13 |
> } |
14 |
> + |
15 |
> +# @ECLASS-VARIABLE: python_scriptroot |
16 |
> +# @DEFAULT_UNSET |
17 |
> +# @DESCRIPTION: |
18 |
> +# The current script destination for python_doscript(). The path |
19 |
> +# is relative to the installation root (${ED}). |
20 |
> +# |
21 |
> +# When unset, ${DESTTREE}/bin (/usr/bin by default) will be used. |
22 |
> +# |
23 |
> +# Can be set indirectly through the python_scriptinto() function. |
24 |
> +# |
25 |
> +# Example: |
26 |
> +# @CODE |
27 |
> +# src_install() { |
28 |
> +# local python_scriptroot=${GAMES_BINDIR} |
29 |
> +# python_foreach_impl python_doscript foo |
30 |
> +# } |
31 |
> +# @CODE |
32 |
> + |
33 |
> +# @FUNCTION: python_scriptinto |
34 |
> +# @USAGE: <new-path> |
35 |
> +# @DESCRIPTION: |
36 |
> +# Set the current scriptroot. The new value will be stored |
37 |
> +# in the 'python_scriptroot' environment variable. The new value need |
38 |
> +# be relative to the installation root (${ED}). |
39 |
> +# |
40 |
> +# Alternatively, you can set the variable directly. |
41 |
> +python_scriptinto() { |
42 |
> + debug-print-function ${FUNCNAME} "${@}" |
43 |
> + |
44 |
> + python_scriptroot=${1} |
45 |
> +} |
46 |
> + |
47 |
> +# @FUNCTION: python_doscript |
48 |
> +# @USAGE: <files>... |
49 |
> +# @DESCRIPTION: |
50 |
> +# Install the given scripts into current python_scriptroot, |
51 |
> +# for the current Python implementation (${EPYTHON}). |
52 |
> +# |
53 |
> +# All specified files must start with a 'python' shebang. The shebang |
54 |
> +# will be converted, the file will be renamed to be EPYTHON-suffixed |
55 |
> +# and a wrapper will be installed in place of the original name. |
56 |
> +python_doscript() { |
57 |
> + debug-print-function ${FUNCNAME} "${@}" |
58 |
> + |
59 |
> + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' |
60 |
> + |
61 |
> + local d=${python_scriptroot:-${DESTTREE}/bin} |
62 |
> + local INSDESTTREE INSOPTIONS |
63 |
> + |
64 |
> + insinto "${d}" |
65 |
> + insopts -m755 |
66 |
> + |
67 |
|
68 |
Could possibly use exeinto/newexe instead here. |
69 |
|
70 |
> + local f |
71 |
> + for f; do |
72 |
> + local oldfn=${f##*/} |
73 |
> + local newfn=${oldfn}-${EPYTHON} |
74 |
> + |
75 |
> + debug-print "${FUNCNAME}: ${oldfn} -> ${newfn}" |
76 |
> + newins "${f}" "${newfn}" |
77 |
> + _python_rewrite_shebang "${D}/${d}/${newfn}" |
78 |
> + |
79 |
> + # install the wrapper |
80 |
> + _python_ln_rel "${ED}"/usr/bin/python-exec "${D}/${d}/${oldfn}" || die |
81 |
> + done |
82 |
> +} |
83 |
> -- |
84 |
> 1.8.0 |
85 |
> |
86 |
|
87 |
Looks fine overall. |