Annotation of /branches/magellan-next/include/python.sminc
Parent Directory | Revision Log
Revision 8643 -
(hide annotations)
(download)
Wed Jul 27 11:10:28 2011 UTC (13 years, 2 months ago) by niro
File size: 1363 byte(s)
Wed Jul 27 11:10:28 2011 UTC (13 years, 2 months ago) by niro
File size: 1363 byte(s)
-use mbindir() function to be split_package friendly -fixed get_python_libdir function
1 | niro | 8643 | # $Id$ |
2 | niro | 2 | |
3 | niro | 8643 | # needed for mbindir() |
4 | sminclude mtools | ||
5 | |||
6 | niro | 2 | # get the major.minor current installed python version |
7 | # -> ex 2.4 | ||
8 | get_python_version() | ||
9 | { | ||
10 | # PYVER="$(python -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)" | ||
11 | PYVER=$(python -c "import sys ; print sys.version[:3]") | ||
12 | [[ -z ${PYVER} ]] && return 1 | ||
13 | echo "${PYVER}" | ||
14 | return 0 | ||
15 | } | ||
16 | |||
17 | get_python_libdir() | ||
18 | { | ||
19 | local pylib | ||
20 | niro | 8643 | pylib=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()') |
21 | niro | 2 | echo "${pylib}" |
22 | return 0 | ||
23 | } | ||
24 | |||
25 | python_src_prepare() | ||
26 | { | ||
27 | munpack ${SRCFILE} || die | ||
28 | } | ||
29 | |||
30 | python_src_compile() | ||
31 | { | ||
32 | cd ${SRCDIR} | ||
33 | niro | 6882 | |
34 | if [[ -e setup.py ]] | ||
35 | then | ||
36 | python setup.py build "$@" || die | ||
37 | niro | 8121 | elif [[ -e waf ]] |
38 | then | ||
39 | niro | 8123 | python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) "$@" || die |
40 | niro | 8121 | python waf build "$@" || die |
41 | niro | 6882 | elif [[ -e configure ]] |
42 | then | ||
43 | mconfigure "$@" || die | ||
44 | mmake || die | ||
45 | else | ||
46 | mmake || die | ||
47 | fi | ||
48 | niro | 2 | } |
49 | |||
50 | python_src_install() | ||
51 | { | ||
52 | cd ${SRCDIR} | ||
53 | |||
54 | niro | 6882 | if [[ -e setup.py ]] |
55 | then | ||
56 | niro | 8643 | python setup.py install --no-compile --root $(mbindir) "$@" || die |
57 | niro | 8121 | elif [[ -e waf ]] |
58 | then | ||
59 | niro | 8643 | python waf install --destdir="$(mbindir)" "$@" || die |
60 | niro | 6882 | else |
61 | niro | 8643 | mmake DESTDIR=$(mbindir) install || die |
62 | niro | 6882 | fi |
63 | |||
64 | niro | 2 | local i |
65 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ | ||
66 | FAQ LICENSE NEWS README TODO | ||
67 | do | ||
68 | if [ -f ${SRCDIR}/${i} ] | ||
69 | then | ||
70 | minstalldocs ${i} || die | ||
71 | fi | ||
72 | done | ||
73 | } | ||
74 | |||
75 | export_inherits python src_prepare src_compile src_install |