| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.27 2005/07/06 20:23:20 agriffis Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.28 2005/07/11 15:08:06 swegener Exp $ |
| 4 | # |
4 | # |
| 5 | # Author: Jon Nelson <jnelson@gentoo.org> |
5 | # Author: Jon Nelson <jnelson@gentoo.org> |
| 6 | # Current Maintainer: Alastair Tse <liquidx@gentoo.org> |
6 | # Current Maintainer: Alastair Tse <liquidx@gentoo.org> |
| 7 | # |
7 | # |
| 8 | # The distutils eclass is designed to allow easier installation of |
8 | # The distutils eclass is designed to allow easier installation of |
| 9 | # distutils-based python modules and their incorporation into |
9 | # distutils-based python modules and their incorporation into |
| 10 | # the Gentoo Linux system. |
10 | # the Gentoo Linux system. |
| 11 | # |
11 | # |
| 12 | # - Features: |
12 | # - Features: |
| 13 | # distutils_src_compile() - does python setup.py build |
13 | # distutils_src_compile() - does python setup.py build |
| 14 | # distutils_src_install() - does python setup.py install and install docs |
14 | # distutils_src_install() - does python setup.py install and install docs |
| … | |
… | |
| 19 | # PYTHON_SLOT_VERSION - for Zope support |
19 | # PYTHON_SLOT_VERSION - for Zope support |
| 20 | # DOCS - additional DOCS |
20 | # DOCS - additional DOCS |
| 21 | |
21 | |
| 22 | inherit python eutils |
22 | inherit python eutils |
| 23 | |
23 | |
| 24 | |
|
|
| 25 | # This helps make it possible to add extensions to python slots. |
24 | # This helps make it possible to add extensions to python slots. |
| 26 | # Normally only a -py21- ebuild would set PYTHON_SLOT_VERSION. |
25 | # Normally only a -py21- ebuild would set PYTHON_SLOT_VERSION. |
| 27 | if [ "${PYTHON_SLOT_VERSION}" = 2.1 ] ; then |
26 | if [ "${PYTHON_SLOT_VERSION}" = 2.1 ] ; then |
| 28 | DEPEND="=dev-lang/python-2.1*" |
27 | DEPEND="=dev-lang/python-2.1*" |
| 29 | python="python2.1" |
28 | python="python2.1" |
| 30 | else |
29 | else |
| 31 | DEPEND="virtual/python" |
30 | DEPEND="virtual/python" |
| 32 | python="python" |
31 | python="python" |
| … | |
… | |
| 39 | distutils_src_install() { |
38 | distutils_src_install() { |
| 40 | if has_version ">=dev-lang/python-2.3"; then |
39 | if has_version ">=dev-lang/python-2.3"; then |
| 41 | ${python} setup.py install --root=${D} --no-compile "$@" || die |
40 | ${python} setup.py install --root=${D} --no-compile "$@" || die |
| 42 | else |
41 | else |
| 43 | ${python} setup.py install --root=${D} "$@" || die |
42 | ${python} setup.py install --root=${D} "$@" || die |
| 44 | fi |
43 | fi |
| 45 | |
44 | |
| 46 | DDOCS="CHANGELOG COPYRIGHT KNOWN_BUGS MAINTAINERS PKG-INFO" |
45 | DDOCS="CHANGELOG COPYRIGHT KNOWN_BUGS MAINTAINERS PKG-INFO" |
| 47 | DDOCS="${DDOCS} CONTRIBUTORS LICENSE COPYING*" |
46 | DDOCS="${DDOCS} CONTRIBUTORS LICENSE COPYING*" |
| 48 | DDOCS="${DDOCS} Change* MANIFEST* README*" |
47 | DDOCS="${DDOCS} Change* MANIFEST* README*" |
| 49 | |
48 | |
| 50 | for doc in ${DDOCS}; do |
49 | for doc in ${DDOCS}; do |
| 51 | [ -s "$doc" ] && dodoc $doc |
50 | [ -s "$doc" ] && dodoc $doc |
| 52 | done |
51 | done |
| 53 | |
52 | |
| 54 | [ -n "${DOCS}" ] && dodoc ${DOCS} |
53 | [ -n "${DOCS}" ] && dodoc ${DOCS} |
| 55 | |
54 | |
| 56 | # deprecated! please use DOCS instead. |
55 | # deprecated! please use DOCS instead. |
| 57 | [ -n "${mydoc}" ] && dodoc ${mydoc} |
56 | [ -n "${mydoc}" ] && dodoc ${mydoc} |
| 58 | } |
57 | } |
| 59 | |
58 | |
| 60 | # generic pyc/pyo cleanup script. |
59 | # generic pyc/pyo cleanup script. |
| 61 | |
60 | |
| 62 | distutils_pkg_postrm() { |
61 | distutils_pkg_postrm() { |
| 63 | PYTHON_MODNAME=${PYTHON_MODNAME:-${PN}} |
62 | PYTHON_MODNAME=${PYTHON_MODNAME:-${PN}} |
| 64 | |
63 | |
| 65 | if has_version ">=dev-lang/python-2.3"; then |
64 | if has_version ">=dev-lang/python-2.3"; then |
| … | |
… | |
| 70 | python_mod_cleanup ${moddir} |
69 | python_mod_cleanup ${moddir} |
| 71 | done |
70 | done |
| 72 | done |
71 | done |
| 73 | else |
72 | else |
| 74 | python_mod_cleanup |
73 | python_mod_cleanup |
| 75 | fi |
74 | fi |
| 76 | eend 0 |
75 | eend 0 |
| 77 | fi |
76 | fi |
| 78 | } |
77 | } |
| 79 | |
78 | |
| 80 | # this is a generic optimization, you should override it if your package |
79 | # this is a generic optimization, you should override it if your package |
| 81 | # installs things in another directory |
80 | # installs things in another directory |
| 82 | |
81 | |
| 83 | distutils_pkg_postinst() { |
82 | distutils_pkg_postinst() { |
| 84 | PYTHON_MODNAME=${PYTHON_MODNAME:-${PN}} |
83 | PYTHON_MODNAME=${PYTHON_MODNAME:-${PN}} |
| 85 | |
84 | |
| 86 | if has_version ">=dev-lang/python-2.3"; then |
85 | if has_version ">=dev-lang/python-2.3"; then |
| 87 | python_version |
86 | python_version |
| 88 | for pymod in "${PYTHON_MODNAME}"; do |
87 | for pymod in "${PYTHON_MODNAME}"; do |
| 89 | if [ -d "${ROOT}usr/$(get_libdir)/python${PYVER}/site-packages/${pymod}" ]; then |
88 | if [ -d "${ROOT}usr/$(get_libdir)/python${PYVER}/site-packages/${pymod}" ]; then |
| 90 | python_mod_optimize ${ROOT}usr/$(get_libdir)/python${PYVER}/site-packages/${pymod} |
89 | python_mod_optimize ${ROOT}usr/$(get_libdir)/python${PYVER}/site-packages/${pymod} |
| 91 | fi |
90 | fi |
| 92 | done |
91 | done |
| 93 | fi |
92 | fi |
| 94 | } |
93 | } |
| 95 | |
94 | |
| 96 | # e.g. insinto ${ROOT}/usr/include/python${PYVER} |
95 | # e.g. insinto ${ROOT}/usr/include/python${PYVER} |
| 97 | |
96 | |
| 98 | distutils_python_version() { |
97 | distutils_python_version() { |
| … | |
… | |
| 113 | echo |
112 | echo |
| 114 | die "missing tkinter support with installed python" |
113 | die "missing tkinter support with installed python" |
| 115 | fi |
114 | fi |
| 116 | } |
115 | } |
| 117 | |
116 | |
| 118 | |
|
|
| 119 | EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm |
117 | EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm |
| 120 | |
|
|