1 |
commit: 75ef5702ff1f8ff55ae3b4e17ff6ff041cb076bf |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 23 08:55:05 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 23 08:56:09 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75ef5702 |
7 |
|
8 |
twisted-r1.eclass: Remove |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
eclass/twisted-r1.eclass | 238 ----------------------------------------------- |
13 |
1 file changed, 238 deletions(-) |
14 |
|
15 |
diff --git a/eclass/twisted-r1.eclass b/eclass/twisted-r1.eclass |
16 |
deleted file mode 100644 |
17 |
index 16faf25866c..00000000000 |
18 |
--- a/eclass/twisted-r1.eclass |
19 |
+++ /dev/null |
20 |
@@ -1,238 +0,0 @@ |
21 |
-# Copyright 1999-2020 Gentoo Authors |
22 |
-# Distributed under the terms of the GNU General Public License v2 |
23 |
- |
24 |
-# @DEAD |
25 |
-# @ECLASS: twisted-r1.eclass |
26 |
-# @MAINTAINER: |
27 |
-# Gentoo Python Project <python@g.o> |
28 |
-# @AUTHOR: |
29 |
-# Author: Michał Górny <mgorny@g.o> |
30 |
-# Author: Jan Matejka <yac@g.o> |
31 |
-# @SUPPORTED_EAPIS: 4 5 |
32 |
-# @BLURB: Eclass for Twisted packages |
33 |
-# @DESCRIPTION: |
34 |
-# The twisted eclass defines phase functions for Twisted packages. |
35 |
- |
36 |
-case "${EAPI:-0}" in |
37 |
- 0|1|2|3) |
38 |
- die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" |
39 |
- ;; |
40 |
- 4|5) |
41 |
- ;; |
42 |
- *) |
43 |
- die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" |
44 |
- ;; |
45 |
-esac |
46 |
- |
47 |
-if [[ ! ${_TWISTED_R1} ]]; then |
48 |
- |
49 |
-inherit distutils-r1 versionator |
50 |
- |
51 |
-fi # ! ${_TWISTED_R1} |
52 |
- |
53 |
-EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm |
54 |
- |
55 |
-if [[ ! ${_TWISTED_R1} ]]; then |
56 |
- |
57 |
-# @FUNCTION: _twisted-r1_camelcase |
58 |
-# @USAGE: <pn> |
59 |
-# @DESCRIPTION: |
60 |
-# Convert dash-separated <pn> to CamelCase name suitable for Twisted. |
61 |
-# In pure bash, therefore safe for global scope execution. |
62 |
-_twisted-r1_camelcase() { |
63 |
- local IFS=- |
64 |
- |
65 |
- # IFS=- splits words by -. |
66 |
- local words=( ${1} ) |
67 |
- |
68 |
- # we can't keep '-' as it collides with [a-z] check |
69 |
- # and '' is used by bash-4 words[*], so let's just set globally |
70 |
- IFS= |
71 |
- |
72 |
- if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then |
73 |
- echo "${words[*]^}" |
74 |
- return |
75 |
- fi |
76 |
- |
77 |
- local w LC_COLLATE=C uc='ABCDEFGHIJKLMNOPQRSTUVWXYZ' |
78 |
- |
79 |
- local out |
80 |
- for w in "${words[@]}"; do |
81 |
- local fl=${w:0:1} |
82 |
- |
83 |
- # Danger: magic starts here. Please close your eyes. |
84 |
- # In base 36, a..z represents digits 10..35. We substract 10 |
85 |
- # and get array subscripts for uc. |
86 |
- |
87 |
- [[ ${fl} == [a-z] ]] && fl=${uc:36#${fl} - 10:1} |
88 |
- |
89 |
- out+=${fl}${w:1} |
90 |
- done |
91 |
- |
92 |
- echo "${out}" |
93 |
-} |
94 |
- |
95 |
-# @ECLASS-VARIABLE: TWISTED_PN |
96 |
-# @DESCRIPTION: |
97 |
-# The real package name. Default to camel-case conversion of ${PN}. |
98 |
-# |
99 |
-# Example: TwistedCore |
100 |
-: ${TWISTED_PN:=$(_twisted-r1_camelcase ${PN})} |
101 |
- |
102 |
-# @ECLASS-VARIABLE: TWISTED_P |
103 |
-# @DESCRIPTION: |
104 |
-# The real package name with version appended. |
105 |
-# |
106 |
-# It is used to build the default SRC_URI and S values. |
107 |
-# |
108 |
-# Example: TwistedCore-1.2.3 |
109 |
-: ${TWISTED_P:=${TWISTED_PN}-${PV}} |
110 |
- |
111 |
-# @ECLASS-VARIABLE: TWISTED_RELEASE |
112 |
-# @DESCRIPTION: |
113 |
-# The 'release' of Twisted. Defaults to the major & minor version |
114 |
-# number from ${PV}. |
115 |
-# |
116 |
-# It is used to build the default SRC_URI. It may be also used |
117 |
-# in dependencies against other Twisted packages. |
118 |
-# |
119 |
-# Example: 1.2 |
120 |
-: ${TWISTED_RELEASE:=$(get_version_component_range 1-2 ${PV})} |
121 |
- |
122 |
-HOMEPAGE="https://www.twistedmatrix.com/trac/" |
123 |
-SRC_URI="https://twistedmatrix.com/Releases/${TWISTED_PN#Twisted}" |
124 |
-SRC_URI="${SRC_URI}/${TWISTED_RELEASE}/${TWISTED_P}.tar.bz2" |
125 |
- |
126 |
-LICENSE="MIT" |
127 |
-SLOT="0" |
128 |
-IUSE="" |
129 |
- |
130 |
-S=${WORKDIR}/${TWISTED_P} |
131 |
- |
132 |
-# @ECLASS-VARIABLE: TWISTED_PLUGINS |
133 |
-# @DESCRIPTION: |
134 |
-# An array of Twisted plugins, whose cache is regenerated |
135 |
-# in pkg_postinst() and pkg_postrm() phases. |
136 |
-# |
137 |
-# If no plugins are installed, set to empty array. |
138 |
-declare -p TWISTED_PLUGINS &>/dev/null || TWISTED_PLUGINS=( twisted.plugins ) |
139 |
- |
140 |
-# @FUNCTION: twisted-r1_python_test |
141 |
-# @DESCRIPTION: |
142 |
-# The common python_test() implementation that suffices for Twisted |
143 |
-# packages. |
144 |
-twisted-r1_python_test() { |
145 |
- local sitedir=$(python_get_sitedir) |
146 |
- |
147 |
- # Copy modules of other Twisted packages from site-packages |
148 |
- # directory to the temporary directory. |
149 |
- local libdir=${BUILD_DIR}/test/lib |
150 |
- mkdir -p "${libdir}" || die |
151 |
- cp -r "${ROOT}${sitedir}"/twisted "${libdir}" || die |
152 |
- # Drop the installed module in case previous version conflicts with |
153 |
- # the new one somehow. |
154 |
- rm -fr "${libdir}/${PN/-//}" || die |
155 |
- |
156 |
- distutils_install_for_testing || die |
157 |
- |
158 |
- if [[ ${TEST_DIR} != ${BUILD_DIR}/test ]]; then |
159 |
- eerror "twisted-r1 integrity check failed." |
160 |
- eerror "TEST_DIR: ${TEST_DIR}" |
161 |
- eerror "expected: ${BUILD_DIR}/test" |
162 |
- die "TEST_DIR integrity check failed" |
163 |
- fi |
164 |
- |
165 |
- cd "${TEST_DIR}"/lib || die |
166 |
- trial ${PN/-/.} || die "Tests fail with ${EPYTHON}" |
167 |
-} |
168 |
- |
169 |
-# @FUNCTION: python_test |
170 |
-# @DESCRIPTION: |
171 |
-# Default python_test() for Twisted packages. If you need to override |
172 |
-# it, you can access the original implementation |
173 |
-# via twisted-r1_python_test. |
174 |
-python_test() { |
175 |
- twisted-r1_python_test |
176 |
-} |
177 |
- |
178 |
-# @FUNCTION: twisted-r1_src_install |
179 |
-# @DESCRIPTION: |
180 |
-# Default src_install() for Twisted packages. Automatically handles HTML |
181 |
-# docs (unless HTML_DOCS is set explicitly) and manpages in Twisted |
182 |
-# packages. |
183 |
-twisted-r1_src_install() { |
184 |
- [[ -d doc ]] && local HTML_DOCS=( "${HTML_DOCS[@]:-doc/.}" ) |
185 |
- [[ -d doc/man ]] && doman doc/man/*.[[:digit:]] |
186 |
- |
187 |
- distutils-r1_src_install |
188 |
-} |
189 |
- |
190 |
-# @FUNCTION: _twisted-r1_create_caches |
191 |
-# @USAGE: <packages>... |
192 |
-# @DESCRIPTION: |
193 |
-# Create dropin.cache for plugins in specified packages. The packages |
194 |
-# are to be listed in standard dotted Python syntax. |
195 |
-_twisted-r1_create_caches() { |
196 |
- # http://twistedmatrix.com/documents/current/core/howto/plugin.html |
197 |
- "${PYTHON}" -c \ |
198 |
-"import sys |
199 |
-sys.path.insert(0, '${ROOT}$(python_get_sitedir)') |
200 |
- |
201 |
-fail = False |
202 |
- |
203 |
-try: |
204 |
- from twisted.plugin import getPlugins, IPlugin |
205 |
-except ImportError as e: |
206 |
- if '${EBUILD_PHASE}' == 'postinst': |
207 |
- raise |
208 |
-else: |
209 |
- for module in sys.argv[1:]: |
210 |
- try: |
211 |
- __import__(module, globals()) |
212 |
- except ImportError as e: |
213 |
- if '${EBUILD_PHASE}' == 'postinst': |
214 |
- raise |
215 |
- else: |
216 |
- list(getPlugins(IPlugin, sys.modules[module])) |
217 |
-" \ |
218 |
- "${@}" || die "twisted plugin cache update failed" |
219 |
-} |
220 |
- |
221 |
-# @FUNCTION: twisted-r1_update_plugin_cache |
222 |
-# @DESCRIPTION: |
223 |
-# Update and clean up plugin caches for packages listed |
224 |
-# in TWISTED_PLUGINS. |
225 |
-twisted-r1_update_plugin_cache() { |
226 |
- [[ ${TWISTED_PLUGINS[@]} ]] || return |
227 |
- |
228 |
- local subdirs=( "${TWISTED_PLUGINS[@]//.//}" ) |
229 |
- local paths=( "${subdirs[@]/#/${ROOT}$(python_get_sitedir)/}" ) |
230 |
- local caches=( "${paths[@]/%//dropin.cache}" ) |
231 |
- |
232 |
- # First, delete existing (possibly stray) caches. |
233 |
- rm -f "${caches[@]}" || die |
234 |
- |
235 |
- # Now, let's see which ones we can regenerate. |
236 |
- _twisted-r1_create_caches "${TWISTED_PLUGINS[@]}" |
237 |
- |
238 |
- # Finally, drop empty parent directories. |
239 |
- rmdir -p "${paths[@]}" 2>/dev/null |
240 |
-} |
241 |
- |
242 |
-# @FUNCTION: twisted-r1_pkg_postinst |
243 |
-# @DESCRIPTION: |
244 |
-# Post-installation hook for twisted-r1. Updates plugin caches. |
245 |
-twisted-r1_pkg_postinst() { |
246 |
- _distutils-r1_run_foreach_impl twisted-r1_update_plugin_cache |
247 |
-} |
248 |
- |
249 |
-# @FUNCTION: twisted-r1_pkg_postrm |
250 |
-# @DESCRIPTION: |
251 |
-# Post-removal hook for twisted-r1. Updates plugin caches. |
252 |
-twisted-r1_pkg_postrm() { |
253 |
- _distutils-r1_run_foreach_impl twisted-r1_update_plugin_cache |
254 |
-} |
255 |
- |
256 |
-_TWISTED_R1=1 |
257 |
- |
258 |
-fi # ! ${_TWISTED_R1} |