1 |
# $Header: /alx-cvs/smage/include/python.sminc,v 1.1 2005/08/27 14:29:31 niro Exp $ |
# $Header: /magellan-cvs/smage/include/python.sminc,v 1.4 2007/01/23 20:46:41 niro Exp $ |
2 |
|
|
3 |
# get the major.minor current installed python version |
# get the major.minor current installed python version |
4 |
# -> ex 2.4 |
# -> ex 2.4 |
5 |
get_python_version() |
get_python_version() |
6 |
{ |
{ |
7 |
PYVER="$(python -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)" |
# 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 |
[[ -z ${PYVER} ]] && return 1 |
10 |
echo "${PYVER}" |
echo "${PYVER}" |
11 |
return 0 |
return 0 |
12 |
} |
} |
13 |
|
|
14 |
|
get_python_libdir() |
15 |
|
{ |
16 |
|
local pylib |
17 |
|
pylib=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_version()') |
18 |
|
echo "${pylib}" |
19 |
|
return 0 |
20 |
|
} |
21 |
|
|
22 |
|
python_src_prepare() |
23 |
|
{ |
24 |
|
munpack ${SRCFILE} || die |
25 |
|
} |
26 |
|
|
27 |
|
python_src_compile() |
28 |
|
{ |
29 |
|
cd ${SRCDIR} |
30 |
|
|
31 |
|
if [[ -e setup.py ]] |
32 |
|
then |
33 |
|
python setup.py build "$@" || die |
34 |
|
elif [[ -e configure ]] |
35 |
|
then |
36 |
|
mconfigure "$@" || die |
37 |
|
mmake || die |
38 |
|
else |
39 |
|
mmake || die |
40 |
|
fi |
41 |
|
} |
42 |
|
|
43 |
|
python_src_install() |
44 |
|
{ |
45 |
|
cd ${SRCDIR} |
46 |
|
|
47 |
|
if [[ -e setup.py ]] |
48 |
|
then |
49 |
|
python setup.py install --no-compile --root ${BINDIR} "$@" || die |
50 |
|
else |
51 |
|
mmake DESTDIR=${BINDIR} install || die |
52 |
|
fi |
53 |
|
|
54 |
|
local i |
55 |
|
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
56 |
|
FAQ LICENSE NEWS README TODO |
57 |
|
do |
58 |
|
if [ -f ${SRCDIR}/${i} ] |
59 |
|
then |
60 |
|
minstalldocs ${i} || die |
61 |
|
fi |
62 |
|
done |
63 |
|
} |
64 |
|
|
65 |
|
export_inherits python src_prepare src_compile src_install |