Magellan Linux

Annotation of /trunk/include/python.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 22416 - (hide annotations) (download)
Thu Apr 3 23:08:50 2014 UTC (10 years, 7 months ago) by niro
File size: 3327 byte(s)
-use mget- naming scheme for get_python_ functions
1 niro 8643 # $Id$
2 niro 2
3 niro 21029 SDEPEND="${SDEPEND}
4     >= dev-lang/python-2.7"
5    
6 niro 2 # get the major.minor current installed python version
7     # -> ex 2.4
8 niro 22416 mget-python-version()
9 niro 2 {
10 niro 21029 local pyver
11     # pyver="$(python -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)"
12     pyver=$(python -c "import sys ; print sys.version[:3]")
13     [[ -z ${pyver} ]] && return 1
14     echo "${pyver}"
15 niro 2 return 0
16     }
17    
18 niro 22416 mget-python-libdir()
19 niro 2 {
20     local pylib
21 niro 8643 pylib=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()')
22 niro 21029 [[ -z ${pylib} ]] && return 1
23 niro 2 echo "${pylib}"
24     return 0
25     }
26    
27 niro 22416 mget-python-includedir()
28 niro 8673 {
29     local pyinc
30     pyinc=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()')
31 niro 21029 [[ -z ${pyinc} ]] && return 1
32 niro 8673 echo "${pyinc}"
33     return 0
34     }
35    
36 niro 22416 # 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 niro 2 python_src_prepare()
54     {
55     munpack ${SRCFILE} || die
56     }
57    
58 niro 8645 python_docompile()
59 niro 2 {
60 niro 6882 if [[ -e setup.py ]]
61     then
62 niro 8645 python setup.py build $@ || die
63 niro 8121 elif [[ -e waf ]]
64     then
65 niro 8645 python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die
66     python waf build $@ || die
67 niro 6882 elif [[ -e configure ]]
68     then
69 niro 8645 mconfigure $@ || die
70 niro 6882 mmake || die
71 niro 9471 elif [[ -e install.py ]]
72 niro 9472 then
73 niro 9471 echo "install.py found - nothing to compile here."
74 niro 6882 else
75     mmake || die
76     fi
77 niro 2 }
78    
79 niro 8645 python_doinstall()
80 niro 2 {
81 niro 6882 if [[ -e setup.py ]]
82     then
83 niro 8645 python setup.py install --no-compile --root ${BINDIR} $@ || die
84 niro 8121 elif [[ -e waf ]]
85     then
86 niro 8645 python waf install --destdir=${BINDIR} $@ || die
87 niro 9471 elif [[ -e install.py ]]
88 niro 9472 then
89 niro 9471 python install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die
90 niro 6882 else
91 niro 8645 mmake DESTDIR=${BINDIR} install || die
92 niro 6882 fi
93 niro 8645 }
94 niro 6882
95 niro 8645 python_src_compile()
96     {
97     cd ${SRCDIR}
98     python_docompile || die
99     }
100    
101 niro 21029 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 niro 21031 python_src_check()
116     {
117     return 0
118     }
119    
120 niro 8645 python_src_install()
121     {
122     cd ${SRCDIR}
123     python_doinstall || die
124    
125 niro 2 local i
126     for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \
127     FAQ LICENSE NEWS README TODO
128     do
129     if [ -f ${SRCDIR}/${i} ]
130     then
131     minstalldocs ${i} || die
132     fi
133     done
134     }
135    
136 niro 21029 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 niro 21031 export_inherits python src_prepare src_check
161 niro 21029 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