Magellan Linux

Diff of /trunk/include/python.sminc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 21029 by niro, Thu Mar 6 08:40:01 2014 UTC revision 29819 by niro, Fri Oct 13 08:33:10 2017 UTC
# Line 1  Line 1 
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    
12  # get the major.minor current installed python version  # get the major.minor current installed python version
13  # -> ex 2.4  # -> ex 2.4
14  get_python_version()  mget-python-version()
15  {  {
16   local pyver   local pyver
17  # 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)"
18   pyver=$(python -c "import sys ; print sys.version[:3]")   pyver=$(${MAGE_PYTHON_EXEC} -c "import sys ; print (sys.version[:3])")
19   [[ -z ${pyver} ]] && return 1   [[ -z ${pyver} ]] && return 1
20   echo "${pyver}"   echo "${pyver}"
21   return 0   return 0
22  }  }
23    
24  get_python_libdir()  mget-python-libdir()
25  {  {
26   local pylib   local pylib
27   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())')
28   [[ -z ${pylib} ]] && return 1   [[ -z ${pylib} ]] && return 1
29   echo "${pylib}"   echo "${pylib}"
30   return 0   return 0
31  }  }
32    
33  get_python_includedir()  mget-python-includedir()
34  {  {
35   local pyinc   local pyinc
36   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())')
37   [[ -z ${pyinc} ]] && return 1   [[ -z ${pyinc} ]] && return 1
38   echo "${pyinc}"   echo "${pyinc}"
39   return 0   return 0
40  }  }
41    
42    # fallback functions to support old smage scripts, dropped in near future
43    get_python_version()
44    {
45     echo -e "${COLYELLOW}Warning: get_python_version() is depcrecated, please use mget-python-version() instead${COLDEFAULT}" >&2
46     mget-python-version
47    }
48    get_python_libdir()
49    {
50     echo -e "${COLYELLOW}Warning: get_python_libdir() is depcrecated, please use mget-python-libdir() instead${COLDEFAULT}" >&2
51     mget-python-libdir
52    }
53    get_python_includedir()
54    {
55     echo -e "${COLYELLOW}Warning: get_python_includedir() is depcrecated, please use mget-python-includedir() instead${COLDEFAULT}" >&2
56     mget-python-includedir
57    }
58    
59  python_src_prepare()  python_src_prepare()
60  {  {
61   munpack ${SRCFILE} || die   munpack ${SRCFILE} || die
# Line 42  python_docompile() Line 65  python_docompile()
65  {  {
66   if [[ -e setup.py ]]   if [[ -e setup.py ]]
67   then   then
68   python setup.py build $@ || die   ${MAGE_PYTHON_EXEC} setup.py build $@ || die
69   elif [[ -e waf ]]   elif [[ -e waf ]]
70   then   then
71   python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die   ${MAGE_PYTHON_EXEC} waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die
72   python waf build $@ || die   ${MAGE_PYTHON_EXEC} waf build $@ || die
73   elif [[ -e configure ]]   elif [[ -e configure ]]
74   then   then
75   mconfigure $@ || die   if [[ ${MULTILIB_BUILD} = true ]] && [[ ! -z $(typeset -f oldmconfigure) ]]  && [[ ! -z $(typeset -f oldmmake) ]]
76   mmake || die   then
77     oldmconfigure $@ || die
78     oldmmake || die
79     else
80     mconfigure $@ || die
81     mmake || die
82     fi
83   elif [[ -e install.py ]]   elif [[ -e install.py ]]
84   then   then
85   echo "install.py found - nothing to compile here."   echo "install.py found - nothing to compile here."
# Line 63  python_doinstall() Line 92  python_doinstall()
92  {  {
93   if [[ -e setup.py ]]   if [[ -e setup.py ]]
94   then   then
95   python setup.py install --no-compile --root ${BINDIR} $@ || die   ${MAGE_PYTHON_EXEC} setup.py install --no-compile --root ${BINDIR} $@ || die
96   elif [[ -e waf ]]   elif [[ -e waf ]]
97   then   then
98   python waf install --destdir=${BINDIR} $@ || die   ${MAGE_PYTHON_EXEC} waf install --destdir=${BINDIR} $@ || die
99   elif [[ -e install.py ]]   elif [[ -e install.py ]]
100   then   then
101   python install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die   ${MAGE_PYTHON_EXEC} install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die
102   else   else
103   mmake DESTDIR=${BINDIR} install || die   if [[ ${MULTILIB_BUILD} = true ]] && [[ ! -z $(typeset -f oldmconfigure) ]]  && [[ ! -z $(typeset -f oldmmake) ]]
104     then
105     oldmmake DESTDIR=${BINDIR} install || die
106     else
107     mmake DESTDIR=${BINDIR} install || die
108     fi
109   fi   fi
110  }  }
111    
112  python_src_compile()  python_src_compile()
113  {  {
114   cd ${SRCDIR}   cd ${SRCDIR}
115   python_docompile || die   python_docompile $@ || die
116  }  }
117    
118  python_multilib_src_compile()  python_multilib_src_compile()
# Line 90  python_multilib_src_compile() Line 124  python_multilib_src_compile()
124   do   do
125   SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"   SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"
126   cd ${SRCDIR}   cd ${SRCDIR}
127   abi-${abi} python_docompile || die   abi-${abi} python_docompile $@ || die
128   done   done
129   SRCDIR="${saved_SRCDIR}"   SRCDIR="${saved_SRCDIR}"
130  }  }
131    
132    python_src_check()
133    {
134     return 0
135    }
136    
137  python_src_install()  python_src_install()
138  {  {
139   cd ${SRCDIR}   cd ${SRCDIR}
140   python_doinstall || die   python_doinstall $@ || die
141    
142   local i   local i
143   for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \   for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
# Line 120  python_multilib_src_install() Line 159  python_multilib_src_install()
159   do   do
160   SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"   SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"
161   cd ${SRCDIR}   cd ${SRCDIR}
162   abi-${abi} python_doinstall || die   abi-${abi} python_doinstall $@ || die
163    
164   local i   local i
165   for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \   for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \

Legend:
Removed from v.21029  
changed lines
  Added in v.29819