Magellan Linux

Diff of /trunk/include/python.sminc

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

revision 21030 by niro, Thu Mar 6 08:44:16 2014 UTC revision 33241 by niro, Mon Oct 21 10:06:01 2019 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    # call meson include in the smage2, to prevent unnecessary dependencies
13    #sminclude meson
14    
15  # get the major.minor current installed python version  # get the major.minor current installed python version
16  # -> ex 2.4  # -> ex 2.4
17  get_python_version()  mget-python-version()
18  {  {
19   local pyver   local pyver
20  # 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)"
21   pyver=$(python -c "import sys ; print sys.version[:3]")   pyver=$(${MAGE_PYTHON_EXEC} -c "import sys ; print (sys.version[:3])")
22   [[ -z ${pyver} ]] && return 1   [[ -z ${pyver} ]] && return 1
23   echo "${pyver}"   echo "${pyver}"
24   return 0   return 0
25  }  }
26    
27  get_python_libdir()  mget-python-libdir()
28  {  {
29   local pylib   local pylib
30   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())')
31   [[ -z ${pylib} ]] && return 1   [[ -z ${pylib} ]] && return 1
32   echo "${pylib}"   echo "${pylib}"
33   return 0   return 0
34  }  }
35    
36  get_python_includedir()  mget-python-includedir()
37  {  {
38   local pyinc   local pyinc
39   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())')
40   [[ -z ${pyinc} ]] && return 1   [[ -z ${pyinc} ]] && return 1
41   echo "${pyinc}"   echo "${pyinc}"
42   return 0   return 0
43  }  }
44    
45    # fallback functions to support old smage scripts, dropped in near future
46    get_python_version()
47    {
48     echo -e "${COLYELLOW}Warning: get_python_version() is depcrecated, please use mget-python-version() instead${COLDEFAULT}" >&2
49     mget-python-version
50    }
51    get_python_libdir()
52    {
53     echo -e "${COLYELLOW}Warning: get_python_libdir() is depcrecated, please use mget-python-libdir() instead${COLDEFAULT}" >&2
54     mget-python-libdir
55    }
56    get_python_includedir()
57    {
58     echo -e "${COLYELLOW}Warning: get_python_includedir() is depcrecated, please use mget-python-includedir() instead${COLDEFAULT}" >&2
59     mget-python-includedir
60    }
61    
62  python_src_prepare()  python_src_prepare()
63  {  {
64   munpack ${SRCFILE} || die   munpack ${SRCFILE} || die
# Line 42  python_docompile() Line 68  python_docompile()
68  {  {
69   if [[ -e setup.py ]]   if [[ -e setup.py ]]
70   then   then
71   python setup.py build $@ || die   ${MAGE_PYTHON_EXEC} setup.py build $@ || die
72   elif [[ -e waf ]]   elif [[ -e waf ]]
73   then   then
74   python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die   ${MAGE_PYTHON_EXEC} waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die
75   python waf build $@ || die   ${MAGE_PYTHON_EXEC} waf build $@ || die
76     elif [[ -e meson.build ]]
77     then
78     meson_configure -D python=${MAGE_PYTHON_EXEC} || die
79     mninja || die
80   elif [[ -e configure ]]   elif [[ -e configure ]]
81   then   then
82   mconfigure $@ || die   if [[ ${MULTILIB_BUILD} = true ]] && [[ ! -z $(typeset -f oldmconfigure) ]]  && [[ ! -z $(typeset -f oldmmake) ]]
83   mmake || die   then
84     oldmconfigure $@ || die
85     oldmmake || die
86     else
87     mconfigure $@ || die
88     mmake || die
89     fi
90   elif [[ -e install.py ]]   elif [[ -e install.py ]]
91   then   then
92   echo "install.py found - nothing to compile here."   echo "install.py found - nothing to compile here."
# Line 63  python_doinstall() Line 99  python_doinstall()
99  {  {
100   if [[ -e setup.py ]]   if [[ -e setup.py ]]
101   then   then
102   python setup.py install --no-compile --root ${BINDIR} $@ || die   ${MAGE_PYTHON_EXEC} setup.py install --no-compile --root ${BINDIR} $@ || die
103   elif [[ -e waf ]]   elif [[ -e waf ]]
104   then   then
105   python waf install --destdir=${BINDIR} $@ || die   ${MAGE_PYTHON_EXEC} waf install --destdir=${BINDIR} $@ || die
106     elif [[ -e meson.build ]]
107     then
108     DESTDIR=${BINDIR} mninja install || die
109   elif [[ -e install.py ]]   elif [[ -e install.py ]]
110   then   then
111   python install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die   ${MAGE_PYTHON_EXEC} install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die
112   else   else
113   mmake DESTDIR=${BINDIR} install || die   if [[ ${MULTILIB_BUILD} = true ]] && [[ ! -z $(typeset -f oldmconfigure) ]]  && [[ ! -z $(typeset -f oldmmake) ]]
114     then
115     oldmmake DESTDIR=${BINDIR} install || die
116     else
117     mmake DESTDIR=${BINDIR} install || die
118     fi
119   fi   fi
120  }  }
121    
122  python_src_compile()  python_src_compile()
123  {  {
124   cd ${SRCDIR}   cd ${SRCDIR}
125   python_docompile || die   python_docompile $@ || die
126  }  }
127    
128  python_multilib_src_compile()  python_multilib_src_compile()
# Line 90  python_multilib_src_compile() Line 134  python_multilib_src_compile()
134   do   do
135   SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"   SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"
136   cd ${SRCDIR}   cd ${SRCDIR}
137   abi-${abi} python_docompile || die   abi-${abi} python_docompile $@ || die
138   done   done
139   SRCDIR="${saved_SRCDIR}"   SRCDIR="${saved_SRCDIR}"
140  }  }
141    
142    python_src_check()
143    {
144     return 0
145    }
146    
147  python_src_install()  python_src_install()
148  {  {
149   cd ${SRCDIR}   cd ${SRCDIR}
150   python_doinstall || die   python_doinstall $@ || die
151    
152   local i   local i
153   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 169  python_multilib_src_install()
169   do   do
170   SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"   SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"
171   cd ${SRCDIR}   cd ${SRCDIR}
172   abi-${abi} python_doinstall || die   abi-${abi} python_doinstall $@ || die
173    
174   local i   local i
175   for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \   for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
# Line 135  python_multilib_src_install() Line 184  python_multilib_src_install()
184   SRCDIR="${saved_SRCDIR}"   SRCDIR="${saved_SRCDIR}"
185  }  }
186    
187  export_inherits python src_prepare  export_inherits python src_prepare src_check
188  if [[ ${MULTILIB_BUILD} = true ]]  if [[ ${MULTILIB_BUILD} = true ]]
189  then  then
190   export_inherits python_multilib src_compile src_install   export_inherits python_multilib src_compile src_install

Legend:
Removed from v.21030  
changed lines
  Added in v.33241