1 |
# $Header: /magellan-cvs/smage/include/python.sminc,v 1.4 2007/01/23 20:46:41 niro Exp $ |
# $Id$ |
2 |
|
|
3 |
|
SDEPEND="${SDEPEND} |
4 |
|
>= dev-lang/python-2.7" |
5 |
|
|
6 |
# get the major.minor current installed python version |
# get the major.minor current installed python version |
7 |
# -> ex 2.4 |
# -> ex 2.4 |
8 |
get_python_version() |
get_python_version() |
9 |
{ |
{ |
10 |
# PYVER="$(python -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)" |
local pyver |
11 |
PYVER=$(python -c "import sys ; print sys.version[:3]") |
# pyver="$(python -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)" |
12 |
[[ -z ${PYVER} ]] && return 1 |
pyver=$(python -c "import sys ; print sys.version[:3]") |
13 |
echo "${PYVER}" |
[[ -z ${pyver} ]] && return 1 |
14 |
|
echo "${pyver}" |
15 |
return 0 |
return 0 |
16 |
} |
} |
17 |
|
|
18 |
get_python_libdir() |
get_python_libdir() |
19 |
{ |
{ |
20 |
local pylib |
local pylib |
21 |
pylib=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_version()') |
pylib=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()') |
22 |
|
[[ -z ${pylib} ]] && return 1 |
23 |
echo "${pylib}" |
echo "${pylib}" |
24 |
return 0 |
return 0 |
25 |
} |
} |
26 |
|
|
27 |
|
get_python_includedir() |
28 |
|
{ |
29 |
|
local pyinc |
30 |
|
pyinc=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()') |
31 |
|
[[ -z ${pyinc} ]] && return 1 |
32 |
|
echo "${pyinc}" |
33 |
|
return 0 |
34 |
|
} |
35 |
|
|
36 |
python_src_prepare() |
python_src_prepare() |
37 |
{ |
{ |
38 |
munpack ${SRCFILE} || die |
munpack ${SRCFILE} || die |
39 |
} |
} |
40 |
|
|
41 |
python_src_compile() |
python_docompile() |
42 |
{ |
{ |
|
cd ${SRCDIR} |
|
|
|
|
43 |
if [[ -e setup.py ]] |
if [[ -e setup.py ]] |
44 |
then |
then |
45 |
python setup.py build "$@" || die |
python setup.py build $@ || die |
46 |
|
elif [[ -e waf ]] |
47 |
|
then |
48 |
|
python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die |
49 |
|
python waf build $@ || die |
50 |
elif [[ -e configure ]] |
elif [[ -e configure ]] |
51 |
then |
then |
52 |
mconfigure "$@" || die |
mconfigure $@ || die |
53 |
mmake || die |
mmake || die |
54 |
|
elif [[ -e install.py ]] |
55 |
|
then |
56 |
|
echo "install.py found - nothing to compile here." |
57 |
else |
else |
58 |
mmake || die |
mmake || die |
59 |
fi |
fi |
60 |
} |
} |
61 |
|
|
62 |
python_src_install() |
python_doinstall() |
63 |
{ |
{ |
|
cd ${SRCDIR} |
|
|
|
|
64 |
if [[ -e setup.py ]] |
if [[ -e setup.py ]] |
65 |
then |
then |
66 |
python setup.py install --no-compile --root ${BINDIR} "$@" || die |
python setup.py install --no-compile --root ${BINDIR} $@ || die |
67 |
|
elif [[ -e waf ]] |
68 |
|
then |
69 |
|
python waf install --destdir=${BINDIR} $@ || die |
70 |
|
elif [[ -e install.py ]] |
71 |
|
then |
72 |
|
python install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die |
73 |
else |
else |
74 |
mmake DESTDIR=${BINDIR} install || die |
mmake DESTDIR=${BINDIR} install || die |
75 |
fi |
fi |
76 |
|
} |
77 |
|
|
78 |
|
python_src_compile() |
79 |
|
{ |
80 |
|
cd ${SRCDIR} |
81 |
|
python_docompile || die |
82 |
|
} |
83 |
|
|
84 |
|
python_src_install() |
85 |
|
{ |
86 |
|
cd ${SRCDIR} |
87 |
|
python_doinstall || die |
88 |
|
|
89 |
local i |
local i |
90 |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |