1 |
# $Id$ |
# $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() |
mget-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() |
mget-python-libdir() |
19 |
{ |
{ |
20 |
local pylib |
local pylib |
21 |
pylib=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()') |
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() |
mget-python-includedir() |
28 |
{ |
{ |
29 |
local pyinc |
local pyinc |
30 |
pyinc=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()') |
pyinc=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()') |
31 |
|
[[ -z ${pyinc} ]] && return 1 |
32 |
echo "${pyinc}" |
echo "${pyinc}" |
33 |
return 0 |
return 0 |
34 |
} |
} |
35 |
|
|
36 |
|
# fallback functions to support old smage scripts, dropped in near future |
37 |
|
get_python_version() |
38 |
|
{ |
39 |
|
echo -e "${COLYELLOW}Warning: get_python_version() is depcrecated, please use mget-python-version() instead${COLDEFAULT}" >&2 |
40 |
|
mget-python-version |
41 |
|
} |
42 |
|
get_python_libdir() |
43 |
|
{ |
44 |
|
echo -e "${COLYELLOW}Warning: get_python_libdir() is depcrecated, please use mget-python-libdir() instead${COLDEFAULT}" >&2 |
45 |
|
mget-python-libdir |
46 |
|
} |
47 |
|
get_python_includedir() |
48 |
|
{ |
49 |
|
echo -e "${COLYELLOW}Warning: get_python_includedir() is depcrecated, please use mget-python-includedir() instead${COLDEFAULT}" >&2 |
50 |
|
mget-python-includedir |
51 |
|
} |
52 |
|
|
53 |
python_src_prepare() |
python_src_prepare() |
54 |
{ |
{ |
55 |
munpack ${SRCFILE} || die |
munpack ${SRCFILE} || die |
68 |
then |
then |
69 |
mconfigure $@ || die |
mconfigure $@ || die |
70 |
mmake || die |
mmake || die |
71 |
|
elif [[ -e install.py ]] |
72 |
|
then |
73 |
|
echo "install.py found - nothing to compile here." |
74 |
else |
else |
75 |
mmake || die |
mmake || die |
76 |
fi |
fi |
84 |
elif [[ -e waf ]] |
elif [[ -e waf ]] |
85 |
then |
then |
86 |
python waf install --destdir=${BINDIR} $@ || die |
python waf install --destdir=${BINDIR} $@ || die |
87 |
|
elif [[ -e install.py ]] |
88 |
|
then |
89 |
|
python install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die |
90 |
else |
else |
91 |
mmake DESTDIR=${BINDIR} install || die |
mmake DESTDIR=${BINDIR} install || die |
92 |
fi |
fi |
98 |
python_docompile || die |
python_docompile || die |
99 |
} |
} |
100 |
|
|
101 |
|
python_multilib_src_compile() |
102 |
|
{ |
103 |
|
local abi |
104 |
|
local saved_SRCDIR="${SRCDIR}" |
105 |
|
|
106 |
|
for abi in ${MULTILIB_ABIS} |
107 |
|
do |
108 |
|
SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" |
109 |
|
cd ${SRCDIR} |
110 |
|
abi-${abi} python_docompile || die |
111 |
|
done |
112 |
|
SRCDIR="${saved_SRCDIR}" |
113 |
|
} |
114 |
|
|
115 |
|
python_src_check() |
116 |
|
{ |
117 |
|
return 0 |
118 |
|
} |
119 |
|
|
120 |
python_src_install() |
python_src_install() |
121 |
{ |
{ |
122 |
cd ${SRCDIR} |
cd ${SRCDIR} |
133 |
done |
done |
134 |
} |
} |
135 |
|
|
136 |
export_inherits python src_prepare src_compile src_install |
python_multilib_src_install() |
137 |
|
{ |
138 |
|
local abi |
139 |
|
local saved_SRCDIR="${SRCDIR}" |
140 |
|
|
141 |
|
for abi in ${MULTILIB_ABIS} |
142 |
|
do |
143 |
|
SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" |
144 |
|
cd ${SRCDIR} |
145 |
|
abi-${abi} python_doinstall || die |
146 |
|
|
147 |
|
local i |
148 |
|
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
149 |
|
FAQ LICENSE NEWS README TODO |
150 |
|
do |
151 |
|
if [ -f ${SRCDIR}/${i} ] |
152 |
|
then |
153 |
|
oldminstalldocs ${i} || die |
154 |
|
fi |
155 |
|
done |
156 |
|
done |
157 |
|
SRCDIR="${saved_SRCDIR}" |
158 |
|
} |
159 |
|
|
160 |
|
export_inherits python src_prepare src_check |
161 |
|
if [[ ${MULTILIB_BUILD} = true ]] |
162 |
|
then |
163 |
|
export_inherits python_multilib src_compile src_install |
164 |
|
else |
165 |
|
export_inherits python src_compile src_install |
166 |
|
fi |