1 |
First of all: please wrap lines at 72 or 80 chars (even if the original |
2 |
eclass didn't do that). |
3 |
|
4 |
> if [[ "${CATEGORY}/${PN}" == "dev-python/twisted"* ]]; then |
5 |
|
6 |
I know you're not responsible for this but it seems wrong to have two |
7 |
different behaviors depending on PN. Is this used somewhere actually? |
8 |
|
9 |
> MY_PV="${MY_PV:-${PV}}" |
10 |
> MY_P="Twisted${MY_PACKAGE}-${MY_PV}" |
11 |
> |
12 |
> HOMEPAGE="http://www.twistedmatrix.com/" |
13 |
> #SRC_URI="http://tmrc.mit.edu/mirror/twisted/${MY_PACKAGE}/$(get_version_component_range 1-2 ${MY_PV})/${MY_P}.tar.bz2" |
14 |
> SRC_URI="http://twistedmatrix.com/Releases/${MY_PACKAGE}/$(get_version_component_range 1-2 ${MY_PV})/${MY_P}.tar.bz2" |
15 |
> |
16 |
> LICENSE="MIT" |
17 |
> SLOT="0" |
18 |
> IUSE="" |
19 |
> |
20 |
> S="${WORKDIR}/${MY_P}" |
21 |
> |
22 |
> TWISTED_PLUGINS="${TWISTED_PLUGINS:-twisted.plugins}" |
23 |
> fi |
24 |
> |
25 |
> # @ECLASS-VARIABLE: TWISTED_PLUGINS |
26 |
> # @DESCRIPTION: |
27 |
> # Twisted plugins, whose cache is regenerated in pkg_postinst() and pkg_postrm() phases. |
28 |
> |
29 |
> python_test() { |
30 |
> # TODO: this seems to be used only in dev-python/twisted-* packages as |
31 |
> # dev-python/twisted-13.0.0 have it's own src_test |
32 |
> if [[ "${CATEGORY}/${PN}" != "dev-python/twisted"* ]]; then |
33 |
> die "${FUNCNAME}() can be used only in dev-python/twisted* packages" |
34 |
> fi |
35 |
> |
36 |
> local sitedir="${EPREFIX}$(python_get_sitedir)" |
37 |
> |
38 |
> # Copy modules of other Twisted packages from site-packages directory to temporary directory. |
39 |
> mkdir -p "${T}/${sitedir}" |
40 |
> cp -R "${ROOT}${sitedir}/twisted" "${T}/${sitedir}" || die "Copying of modules of other Twisted packages failed with $(python_get_implementation) $(python_get_version)" |
41 |
> rm -fr "${T}/${sitedir}/${PN/-//}" |
42 |
|
43 |
Awful and ugly. Try to find a way to run the tests without this hackery. |
44 |
|
45 |
> # Install modules of current package to temporary directory. |
46 |
> "${PYTHON}" setup.py build -b "build-${EPYTHON}" install --force --no-compile --root="${T}" || die "Installation into temporary directory failed with $(python_get_implementation) $(python_get_version)" |
47 |
|
48 |
This is likely a candidate for 'distutils_install_for_testing'. |
49 |
Or 'esetup.py' at least. Inlining build-dir is simply wrong. |
50 |
|
51 |
> pushd "${T}/${sitedir}" > /dev/null || return 1 |
52 |
> PATH="${T}${EPREFIX}/usr/bin:${PATH}" PYTHONPATH="${T}/${sitedir}" trial ${PN/-/.} || return 1 |
53 |
> popd > /dev/null || return 1 |
54 |
> |
55 |
> rm -fr "${T}/${sitedir}" |
56 |
> } |
57 |
> |
58 |
> twisted-r1_src_install() { |
59 |
> distutils-r1_src_install |
60 |
> |
61 |
> if [[ -d doc/man ]]; then |
62 |
> doman doc/man/*.[[:digit:]] |
63 |
> fi |
64 |
> |
65 |
> if [[ -d doc ]]; then |
66 |
> insinto /usr/share/doc/${PF} |
67 |
> doins -r $(find doc -mindepth 1 -maxdepth 1 -not -name man) |
68 |
> fi |
69 |
> } |
70 |
> |
71 |
> _twisted-r1_update_plugin_cache() { |
72 |
> local dir exit_status="0" module |
73 |
> |
74 |
> for module in ${TWISTED_PLUGINS}; do |
75 |
> if [[ -d "${EROOT}$(python_get_sitedir)/${module//.//}" ]]; then |
76 |
> find "${EROOT}$(python_get_sitedir)/${module//.//}" -name dropin.cache -print0 | xargs -0 rm -f |
77 |
> fi |
78 |
> done |
79 |
> |
80 |
> for module in ${TWISTED_PLUGINS}; do |
81 |
> # http://twistedmatrix.com/documents/current/core/howto/plugin.html |
82 |
> "${PYTHON}" -c \ |
83 |
> "import sys |
84 |
> sys.path.insert(0, '${EROOT}$(python_get_sitedir)') |
85 |
> |
86 |
> try: |
87 |
> import twisted.plugin |
88 |
> import ${module} |
89 |
> except ImportError: |
90 |
> if '${EBUILD_PHASE}' == 'postinst': |
91 |
> raise |
92 |
> else: |
93 |
> # Twisted, zope.interface or given plugins might have been uninstalled. |
94 |
> sys.exit(0) |
95 |
> |
96 |
> list(twisted.plugin.getPlugins(twisted.plugin.IPlugin, ${module}))" || exit_status="1" |
97 |
> done |
98 |
> |
99 |
> for module in ${TWISTED_PLUGINS}; do |
100 |
> # Delete empty parent directories. |
101 |
> local dir="${EROOT}$(python_get_sitedir)/${module//.//}" |
102 |
> while [[ "${dir}" != "${EROOT%/}" ]]; do |
103 |
> rmdir "${dir}" 2> /dev/null || break |
104 |
> dir="${dir%/*}" |
105 |
> done |
106 |
> done |
107 |
> |
108 |
> return "${exit_status}" |
109 |
> } |
110 |
> |
111 |
> twisted-r1_pkg_postinst() { |
112 |
> _distutils-r1_run_foreach_impl _twisted-r1_update_plugin_cache |
113 |
> } |
114 |
> |
115 |
> twisted-r1_pkg_postrm() { |
116 |
> _distutils-r1_run_foreach_impl _twisted-r1_update_plugin_cache |
117 |
> } |
118 |
|
119 |
-- |
120 |
Best regards, |
121 |
Michał Górny |