1 |
# $Id$ |
# $Id$ |
2 |
|
|
3 |
SDEPEND="${SDEPEND} |
# simulate the old behavior |
4 |
>= dev-lang/python-2.7" |
if [[ -z ${MAGE_PYTHON_EXEC} ]] |
5 |
|
then |
6 |
|
MAGE_PYTHON_EXEC="python" |
7 |
|
|
8 |
|
SDEPEND="${SDEPEND} |
9 |
|
>= dev-lang/python-2.7" |
10 |
|
fi |
11 |
|
if [[ -z ${MAGE_PYTHON_BUILD_VERSIONS} ]] |
12 |
|
then |
13 |
|
MAGE_PYTHON_BUILD_VERSIONS="single" |
14 |
|
fi |
15 |
|
|
16 |
# get the major.minor current installed python version |
# get the major.minor current installed python version |
17 |
# -> ex 2.4 |
# -> ex 2.4 |
18 |
mget-python-version() |
mget-python-version() |
19 |
{ |
{ |
20 |
local pyver |
local pyver |
21 |
# pyver="$(python -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)" |
# pyver="$(${MAGE_PYTHON_EXEC} -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)" |
22 |
pyver=$(python -c "import sys ; print sys.version[:3]") |
pyver=$(${MAGE_PYTHON_EXEC} -c "import sys ; (print sys.version[:3])") |
23 |
[[ -z ${pyver} ]] && return 1 |
[[ -z ${pyver} ]] && return 1 |
24 |
echo "${pyver}" |
echo "${pyver}" |
25 |
return 0 |
return 0 |
28 |
mget-python-libdir() |
mget-python-libdir() |
29 |
{ |
{ |
30 |
local pylib |
local pylib |
31 |
pylib=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()') |
pylib=$(${MAGE_PYTHON_EXEC} -c 'from distutils import sysconfig; print (sysconfig.get_python_lib())') |
32 |
[[ -z ${pylib} ]] && return 1 |
[[ -z ${pylib} ]] && return 1 |
33 |
echo "${pylib}" |
echo "${pylib}" |
34 |
return 0 |
return 0 |
37 |
mget-python-includedir() |
mget-python-includedir() |
38 |
{ |
{ |
39 |
local pyinc |
local pyinc |
40 |
pyinc=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()') |
pyinc=$(${MAGE_PYTHON_EXEC} -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())') |
41 |
[[ -z ${pyinc} ]] && return 1 |
[[ -z ${pyinc} ]] && return 1 |
42 |
echo "${pyinc}" |
echo "${pyinc}" |
43 |
return 0 |
return 0 |
69 |
{ |
{ |
70 |
if [[ -e setup.py ]] |
if [[ -e setup.py ]] |
71 |
then |
then |
72 |
python setup.py build $@ || die |
${MAGE_PYTHON_EXEC} setup.py build $@ || die |
73 |
elif [[ -e waf ]] |
elif [[ -e waf ]] |
74 |
then |
then |
75 |
python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die |
${MAGE_PYTHON_EXEC} waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die |
76 |
python waf build $@ || die |
${MAGE_PYTHON_EXEC} waf build $@ || die |
77 |
elif [[ -e configure ]] |
elif [[ -e configure ]] |
78 |
then |
then |
79 |
mconfigure $@ || die |
mconfigure $@ || die |
90 |
{ |
{ |
91 |
if [[ -e setup.py ]] |
if [[ -e setup.py ]] |
92 |
then |
then |
93 |
python setup.py install --no-compile --root ${BINDIR} $@ || die |
${MAGE_PYTHON_EXEC} setup.py install --no-compile --root ${BINDIR} $@ || die |
94 |
elif [[ -e waf ]] |
elif [[ -e waf ]] |
95 |
then |
then |
96 |
python waf install --destdir=${BINDIR} $@ || die |
${MAGE_PYTHON_EXEC} waf install --destdir=${BINDIR} $@ || die |
97 |
elif [[ -e install.py ]] |
elif [[ -e install.py ]] |
98 |
then |
then |
99 |
python install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die |
${MAGE_PYTHON_EXEC} install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die |
100 |
else |
else |
101 |
mmake DESTDIR=${BINDIR} install || die |
mmake DESTDIR=${BINDIR} install || die |
102 |
fi |
fi |
105 |
python_src_compile() |
python_src_compile() |
106 |
{ |
{ |
107 |
cd ${SRCDIR} |
cd ${SRCDIR} |
108 |
python_docompile || die |
python_docompile $@ || die |
109 |
} |
} |
110 |
|
|
111 |
python_multilib_src_compile() |
python_multilib_src_compile() |
117 |
do |
do |
118 |
SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" |
SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" |
119 |
cd ${SRCDIR} |
cd ${SRCDIR} |
120 |
abi-${abi} python_docompile || die |
abi-${abi} python_docompile $@ || die |
121 |
done |
done |
122 |
SRCDIR="${saved_SRCDIR}" |
SRCDIR="${saved_SRCDIR}" |
123 |
} |
} |
130 |
python_src_install() |
python_src_install() |
131 |
{ |
{ |
132 |
cd ${SRCDIR} |
cd ${SRCDIR} |
133 |
python_doinstall || die |
python_doinstall $@ || die |
134 |
|
|
135 |
local i |
local i |
136 |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
152 |
do |
do |
153 |
SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" |
SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" |
154 |
cd ${SRCDIR} |
cd ${SRCDIR} |
155 |
abi-${abi} python_doinstall || die |
abi-${abi} python_doinstall $@ || die |
156 |
|
|
157 |
local i |
local i |
158 |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |