Magellan Linux

Contents of /trunk/include/python.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8645 - (show annotations) (download)
Wed Jul 27 11:23:46 2011 UTC (12 years, 9 months ago) by niro
Original Path: branches/magellan-next/include/python.sminc
File size: 1401 byte(s)
-split of install and compile functions to python_docompile() python_doinstall() functions to support current dir as SRCDIR
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 python_src_prepare()
23 {
24 munpack ${SRCFILE} || die
25 }
26
27 python_docompile()
28 {
29 if [[ -e setup.py ]]
30 then
31 python setup.py build $@ || die
32 elif [[ -e waf ]]
33 then
34 python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die
35 python waf build $@ || die
36 elif [[ -e configure ]]
37 then
38 mconfigure $@ || die
39 mmake || die
40 else
41 mmake || die
42 fi
43 }
44
45 python_doinstall()
46 {
47 if [[ -e setup.py ]]
48 then
49 python setup.py install --no-compile --root ${BINDIR} $@ || die
50 elif [[ -e waf ]]
51 then
52 python waf install --destdir=${BINDIR} $@ || die
53 else
54 mmake DESTDIR=${BINDIR} install || die
55 fi
56 }
57
58 python_src_compile()
59 {
60 cd ${SRCDIR}
61 python_docompile || die
62 }
63
64 python_src_install()
65 {
66 cd ${SRCDIR}
67 python_doinstall || die
68
69 local i
70 for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
71 FAQ LICENSE NEWS README TODO
72 do
73 if [ -f ${SRCDIR}/${i} ]
74 then
75 minstalldocs ${i} || die
76 fi
77 done
78 }
79
80 export_inherits python src_prepare src_compile src_install