| 1 | # Copyright 2002 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
| 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.10 2003/04/04 01:38:10 liquidx Exp $ |
|
|
4 | # |
| 3 | # Author: Jon Nelson <jnelson@gentoo.org> |
5 | # Author: Jon Nelson <jnelson@gentoo.org> |
| 4 | # $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.4 2002/10/25 19:55:52 vapier Exp $ |
6 | # |
| 5 | # The distutils eclass is designed to allow easier installation of |
7 | # The distutils eclass is designed to allow easier installation of |
| 6 | # distutils-based python modules, and their incorporation into |
8 | # distutils-based python modules, and their incorporation into |
| 7 | # the Gentoo Linux system. |
9 | # the Gentoo Linux system. |
| 8 | |
10 | |
| 9 | ECLASS=distutils |
11 | ECLASS=distutils |
| 10 | INHERITED="$INHERITED $ECLASS" |
12 | INHERITED="$INHERITED $ECLASS" |
| 11 | |
13 | |
| 12 | EXPORT_FUNCTIONS src_compile src_install |
14 | EXPORT_FUNCTIONS src_compile src_install |
| 13 | |
15 | |
|
|
16 | # This helps make it possible to add extensions to python slots. |
|
|
17 | # Normally only a -py21- ebuild would set PYTHON_SLOT_VERSION. |
|
|
18 | if [ "${PYTHON_SLOT_VERSION}" = 2.1 ] ; then |
|
|
19 | newdepend "=dev-lang/python-2.1*" |
|
|
20 | python="python2.1" |
|
|
21 | else |
| 14 | newdepend "virtual/python" |
22 | newdepend "virtual/python" |
|
|
23 | python="python" |
|
|
24 | fi |
| 15 | |
25 | |
| 16 | distutils_src_compile() { |
26 | distutils_src_compile() { |
| 17 | python setup.py build || die "compilation failed" |
27 | ${python} setup.py build ${@} || die "compilation failed" |
| 18 | } |
28 | } |
| 19 | |
29 | |
| 20 | distutils_src_install() { |
30 | distutils_src_install() { |
| 21 | python setup.py install --root=${D} || die |
31 | ${python} setup.py install --root=${D} ${@} || die |
| 22 | dodoc CHANGELOG COPYRIGHT KNOWN_BUGS MAINTAINERS |
32 | dodoc CHANGELOG COPYRIGHT KNOWN_BUGS MAINTAINERS |
| 23 | dodoc CONTRIBUTORS LICENSE COPYING* |
33 | dodoc CONTRIBUTORS LICENSE COPYING* |
| 24 | dodoc Change* MANIFEST* README* ${mydoc} |
34 | dodoc Change* MANIFEST* README* ${mydoc} |
| 25 | } |
35 | } |
|
|
36 | |
|
|
37 | # e.g. insinto ${ROOT}/usr/include/python${PYVER} |
|
|
38 | |
|
|
39 | distutils_python_version() |
|
|
40 | { |
|
|
41 | local tmpstr="$(${python} -V 2>&1 )" |
|
|
42 | tmpstr="${tmpstr#Python }" |
|
|
43 | tmpstr=${tmpstr%.*} |
|
|
44 | |
|
|
45 | PYVER_MAJOR="${tmpstr%.[0-9]*}" |
|
|
46 | PYVER_MINOR="${tmpstr#[0-9]*.}" |
|
|
47 | PYVER="${PYVER_MAJOR}.${PYVER_MINOR}" |
|
|
48 | } |