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