1 |
commit: 469f7e8ef78f71c45cab73f2a3e5fe02025582ac |
2 |
Author: Krzysztof Pawlik <none <AT> none> |
3 |
AuthorDate: Thu Mar 1 18:39:01 2012 +0000 |
4 |
Commit: Krzysztof Pawlik <nelchael <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Mar 1 18:39:01 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=dev/nelchael.git;a=commit;h=469f7e8e |
7 |
|
8 |
Allow specifying target directory for script installation with default value of /usr/bin. |
9 |
|
10 |
--- |
11 |
eclass/python-distutils-ng.eclass | 38 +++++++++++++++++++++--------------- |
12 |
1 files changed, 22 insertions(+), 16 deletions(-) |
13 |
|
14 |
diff --git a/eclass/python-distutils-ng.eclass b/eclass/python-distutils-ng.eclass |
15 |
index 6b63b28..a001aa6 100644 |
16 |
--- a/eclass/python-distutils-ng.eclass |
17 |
+++ b/eclass/python-distutils-ng.eclass |
18 |
@@ -201,21 +201,24 @@ _python-distutils-ng_has_compileall_opt() { |
19 |
} |
20 |
|
21 |
# @FUNCTION: python-distutils-ng_doscript |
22 |
-# @USAGE: script_file_name |
23 |
+# @USAGE: script_file_name [destination_directory] |
24 |
# @DESCRIPTION: |
25 |
-# Install given script file in /usr/bin/ for all enabled implementations using |
26 |
-# original script name as a base name. |
27 |
+# Install given script file in destination directory (for default value check |
28 |
+# python-distutils-ng_newscript) for all enabled implementations using original |
29 |
+# script name as a base name. |
30 |
# |
31 |
-# See also python-distutils-ng_newscript |
32 |
+# See also python-distutils-ng_newscript for more details. |
33 |
python-distutils-ng_doscript() { |
34 |
- python-distutils-ng_newscript "${1}" "$(basename "${1}")" |
35 |
+ python-distutils-ng_newscript "${1}" "$(basename "${1}")" "${2}" |
36 |
} |
37 |
|
38 |
# @FUNCTION: python-distutils-ng_newscript |
39 |
-# @USAGE: script_file_name new_file_name |
40 |
+# @USAGE: script_file_name new_file_name [destination_directory] |
41 |
# @DESCRIPTION: |
42 |
-# Install given script file in /usr/bin/ for all enabled implementations using |
43 |
-# new_file_name as a base name. |
44 |
+# Install given script file in destination directory for all enabled |
45 |
+# implementations using new_file_name as a base name. |
46 |
+# |
47 |
+# Destination directory defaults to /usr/bin. |
48 |
# |
49 |
# If only one Python implementation is enabled the script will be installed |
50 |
# as-is. Otherwise each script copy will have the name mangled to |
51 |
@@ -235,6 +238,8 @@ python-distutils-ng_newscript() { |
52 |
local destination_file="${2}" |
53 |
local default_impl="${PYTHON_DEFAULT_IMPLEMENTATION}" |
54 |
local enabled_impls=0 |
55 |
+ local destination_directory="/usr/bin" |
56 |
+ [[ -n "${3}" ]] && destination_directory="${3}" |
57 |
|
58 |
for impl in ${PYTHON_COMPAT}; do |
59 |
use "python_targets_${impl}" || continue |
60 |
@@ -254,27 +259,28 @@ python-distutils-ng_newscript() { |
61 |
|
62 |
[[ -n "${default_impl}" ]] || die "Could not select default implementation" |
63 |
|
64 |
- insinto /usr/bin |
65 |
+ dodir "${destination_directory}" |
66 |
+ insinto "${destination_directory}" |
67 |
if [[ "${enabled_impls}" = "1" ]]; then |
68 |
- einfo "Installing ${source_file} for single implementation: ${default_impl}" |
69 |
+ einfo "Installing ${source_file} for single implementation (${default_impl}) in ${destination_directory}" |
70 |
newins "${source_file}" "${destination_file}" |
71 |
- fperms 755 "/usr/bin/${destination_file}" |
72 |
+ fperms 755 "${destination_directory}/${destination_file}" |
73 |
sed -i \ |
74 |
-e "1i#!$(_python-distutils-ng_get_binary_for_implementation "${impl}")" \ |
75 |
- "${D}/usr/bin/${destination_file}" || die |
76 |
+ "${D}${destination_directory}/${destination_file}" || die |
77 |
else |
78 |
- einfo "Installing ${source_file} for multiple implementations (default: ${default_impl})" |
79 |
+ einfo "Installing ${source_file} for multiple implementations (default: ${default_impl}) in ${destination_directory}" |
80 |
for impl in ${PYTHON_COMPAT}; do |
81 |
use "python_targets_${impl}" ${PYTHON_COMPAT} || continue |
82 |
|
83 |
newins "${source_file}" "${destination_file}-${impl}" |
84 |
- fperms 755 "/usr/bin/${destination_file}-${impl}" |
85 |
+ fperms 755 "${destination_directory}/${destination_file}-${impl}" |
86 |
sed -i \ |
87 |
-e "1i#!$(_python-distutils-ng_get_binary_for_implementation "${impl}")" \ |
88 |
- "${D}/usr/bin/${destination_file}-${impl}" || die |
89 |
+ "${D}${destination_directory}/${destination_file}-${impl}" || die |
90 |
done |
91 |
|
92 |
- dosym "${destination_file}-${default_impl}" "/usr/bin/${destination_file}" |
93 |
+ dosym "${destination_file}-${default_impl}" "${destination_directory}/${destination_file}" |
94 |
fi |
95 |
} |