Magellan Linux

Diff of /trunk/include/python.sminc

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

branches/magellan-next/include/python.sminc revision 8643 by niro, Wed Jul 27 11:10:28 2011 UTC trunk/include/python.sminc revision 33281 by niro, Wed Oct 23 11:27:48 2019 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3  # needed for mbindir()  # simulate the old behavior
4  sminclude mtools  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  # PYVER="$(python -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)"   local pyver
20   PYVER=$(python -c "import sys ; print sys.version[:3]")  # pyver="$(${MAGE_PYTHON_EXEC} -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)"
21   [[ -z ${PYVER} ]] && return 1   pyver=$(${MAGE_PYTHON_EXEC} -c "import sys ; print (sys.version[:3])")
22   echo "${PYVER}"   [[ -z ${pyver} ]] && return 1
23     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
32   echo "${pylib}"   echo "${pylib}"
33   return 0   return 0
34  }  }
35    
36    mget-python-includedir()
37    {
38     local pyinc
39     pyinc=$(${MAGE_PYTHON_EXEC} -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())')
40     [[ -z ${pyinc} ]] && return 1
41     echo "${pyinc}"
42     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
65  }  }
66    
67  python_src_compile()  python_docompile()
68  {  {
  cd ${SRCDIR}  
   
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     # never run multilib builds here, multilib will be enabled by python_multilib_src_compile
79     # this honors the logic of other build methods (python, waf, autotools)
80     MULTILIB_BUILD=false meson_configure -D python=${MAGE_PYTHON_EXEC} || die
81     MULTILIB_BUILD=false mninja || die
82   elif [[ -e configure ]]   elif [[ -e configure ]]
83   then   then
84   mconfigure "$@" || die   if [[ ${MULTILIB_BUILD} = true ]] && [[ ! -z $(typeset -f oldmconfigure) ]]  && [[ ! -z $(typeset -f oldmmake) ]]
85   mmake || die   then
86     oldmconfigure $@ || die
87     oldmmake || die
88     else
89     mconfigure $@ || die
90     mmake || die
91     fi
92     elif [[ -e install.py ]]
93     then
94     echo "install.py found - nothing to compile here."
95   else   else
96   mmake || die   mmake || die
97   fi   fi
98  }  }
99    
100  python_src_install()  python_doinstall()
101  {  {
  cd ${SRCDIR}  
   
102   if [[ -e setup.py ]]   if [[ -e setup.py ]]
103   then   then
104   python setup.py install --no-compile --root $(mbindir) "$@" || die   ${MAGE_PYTHON_EXEC} setup.py install --no-compile --root ${BINDIR} $@ || die
105   elif [[ -e waf ]]   elif [[ -e waf ]]
106   then   then
107   python waf install --destdir="$(mbindir)" "$@" || die   ${MAGE_PYTHON_EXEC} waf install --destdir=${BINDIR} $@ || die
108     elif [[ -e meson.build ]]
109     then
110     # never run multilib builds here, multilib will be enabled by python_multilib_src_compile
111     # this honors the logic of other build methods (python, waf, autotools)
112     MULTILIB=false DESTDIR=${BINDIR} mninja install || die
113     elif [[ -e install.py ]]
114     then
115     ${MAGE_PYTHON_EXEC} install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die
116   else   else
117   mmake DESTDIR=$(mbindir) install || die   if [[ ${MULTILIB_BUILD} = true ]] && [[ ! -z $(typeset -f oldmconfigure) ]]  && [[ ! -z $(typeset -f oldmmake) ]]
118     then
119     oldmmake DESTDIR=${BINDIR} install || die
120     else
121     mmake DESTDIR=${BINDIR} install || die
122     fi
123   fi   fi
124    }
125    
126    python_src_compile()
127    {
128     cd ${SRCDIR}
129     python_docompile $@ || die
130    }
131    
132    python_multilib_src_compile()
133    {
134     local abi
135     local saved_SRCDIR="${SRCDIR}"
136    
137     for abi in ${MULTILIB_ABIS}
138     do
139     SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"
140     cd ${SRCDIR}
141     abi-${abi} python_docompile $@ || die
142     done
143     SRCDIR="${saved_SRCDIR}"
144    }
145    
146    python_src_check()
147    {
148     return 0
149    }
150    
151    python_src_install()
152    {
153     cd ${SRCDIR}
154     python_doinstall $@ || die
155    
156   local i   local i
157   for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \   for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
# Line 72  python_src_install() Line 164  python_src_install()
164   done   done
165  }  }
166    
167  export_inherits python src_prepare src_compile src_install  python_multilib_src_install()
168    {
169     local abi
170     local saved_SRCDIR="${SRCDIR}"
171    
172     for abi in ${MULTILIB_ABIS}
173     do
174     SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}"
175     cd ${SRCDIR}
176     abi-${abi} python_doinstall $@ || die
177    
178     local i
179     for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
180     FAQ LICENSE NEWS README TODO
181     do
182     if [ -f ${SRCDIR}/${i} ]
183     then
184     oldminstalldocs ${i} || die
185     fi
186     done
187     done
188     SRCDIR="${saved_SRCDIR}"
189    }
190    
191    export_inherits python src_prepare src_check
192    if [[ ${MULTILIB_BUILD} = true ]]
193    then
194     export_inherits python_multilib src_compile src_install
195    else
196     export_inherits python src_compile src_install
197    fi

Legend:
Removed from v.8643  
changed lines
  Added in v.33281