Annotation of /trunk/include/python.sminc
Parent Directory | Revision Log
Revision 29782 -
(hide annotations)
(download)
Wed Oct 11 11:03:03 2017 UTC (7 years, 1 month ago) by niro
File size: 3660 byte(s)
Wed Oct 11 11:03:03 2017 UTC (7 years, 1 month ago) by niro
File size: 3660 byte(s)
-pathtrough python_docompile and python_doinstall arguments
1 | niro | 8643 | # $Id$ |
2 | niro | 2 | |
3 | niro | 29773 | # simulate the old behavior |
4 | if [[ -z ${MAGE_PYTHON_EXEC} ]] | ||
5 | then | ||
6 | MAGE_PYTHON_EXEC="python" | ||
7 | niro | 21029 | |
8 | niro | 29773 | 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 | niro | 2 | # get the major.minor current installed python version |
17 | # -> ex 2.4 | ||
18 | niro | 22416 | mget-python-version() |
19 | niro | 2 | { |
20 | niro | 21029 | local pyver |
21 | niro | 29773 | # pyver="$(${MAGE_PYTHON_EXEC} -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)" |
22 | pyver=$(${MAGE_PYTHON_EXEC} -c "import sys ; (print sys.version[:3])") | ||
23 | niro | 21029 | [[ -z ${pyver} ]] && return 1 |
24 | echo "${pyver}" | ||
25 | niro | 2 | return 0 |
26 | } | ||
27 | |||
28 | niro | 22416 | mget-python-libdir() |
29 | niro | 2 | { |
30 | local pylib | ||
31 | niro | 29773 | pylib=$(${MAGE_PYTHON_EXEC} -c 'from distutils import sysconfig; print (sysconfig.get_python_lib())') |
32 | niro | 21029 | [[ -z ${pylib} ]] && return 1 |
33 | niro | 2 | echo "${pylib}" |
34 | return 0 | ||
35 | } | ||
36 | |||
37 | niro | 22416 | mget-python-includedir() |
38 | niro | 8673 | { |
39 | local pyinc | ||
40 | niro | 29773 | pyinc=$(${MAGE_PYTHON_EXEC} -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())') |
41 | niro | 21029 | [[ -z ${pyinc} ]] && return 1 |
42 | niro | 8673 | echo "${pyinc}" |
43 | return 0 | ||
44 | } | ||
45 | |||
46 | niro | 22416 | # fallback functions to support old smage scripts, dropped in near future |
47 | get_python_version() | ||
48 | { | ||
49 | echo -e "${COLYELLOW}Warning: get_python_version() is depcrecated, please use mget-python-version() instead${COLDEFAULT}" >&2 | ||
50 | mget-python-version | ||
51 | } | ||
52 | get_python_libdir() | ||
53 | { | ||
54 | echo -e "${COLYELLOW}Warning: get_python_libdir() is depcrecated, please use mget-python-libdir() instead${COLDEFAULT}" >&2 | ||
55 | mget-python-libdir | ||
56 | } | ||
57 | get_python_includedir() | ||
58 | { | ||
59 | echo -e "${COLYELLOW}Warning: get_python_includedir() is depcrecated, please use mget-python-includedir() instead${COLDEFAULT}" >&2 | ||
60 | mget-python-includedir | ||
61 | } | ||
62 | |||
63 | niro | 2 | python_src_prepare() |
64 | { | ||
65 | munpack ${SRCFILE} || die | ||
66 | } | ||
67 | |||
68 | niro | 8645 | python_docompile() |
69 | niro | 2 | { |
70 | niro | 6882 | if [[ -e setup.py ]] |
71 | then | ||
72 | niro | 29773 | ${MAGE_PYTHON_EXEC} setup.py build $@ || die |
73 | niro | 8121 | elif [[ -e waf ]] |
74 | then | ||
75 | niro | 29773 | ${MAGE_PYTHON_EXEC} waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die |
76 | ${MAGE_PYTHON_EXEC} waf build $@ || die | ||
77 | niro | 6882 | elif [[ -e configure ]] |
78 | then | ||
79 | niro | 8645 | mconfigure $@ || die |
80 | niro | 6882 | mmake || die |
81 | niro | 9471 | elif [[ -e install.py ]] |
82 | niro | 9472 | then |
83 | niro | 9471 | echo "install.py found - nothing to compile here." |
84 | niro | 6882 | else |
85 | mmake || die | ||
86 | fi | ||
87 | niro | 2 | } |
88 | |||
89 | niro | 8645 | python_doinstall() |
90 | niro | 2 | { |
91 | niro | 6882 | if [[ -e setup.py ]] |
92 | then | ||
93 | niro | 29773 | ${MAGE_PYTHON_EXEC} setup.py install --no-compile --root ${BINDIR} $@ || die |
94 | niro | 8121 | elif [[ -e waf ]] |
95 | then | ||
96 | niro | 29773 | ${MAGE_PYTHON_EXEC} waf install --destdir=${BINDIR} $@ || die |
97 | niro | 9471 | elif [[ -e install.py ]] |
98 | niro | 9472 | then |
99 | niro | 29773 | ${MAGE_PYTHON_EXEC} install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die |
100 | niro | 6882 | else |
101 | niro | 8645 | mmake DESTDIR=${BINDIR} install || die |
102 | niro | 6882 | fi |
103 | niro | 8645 | } |
104 | niro | 6882 | |
105 | niro | 8645 | python_src_compile() |
106 | { | ||
107 | cd ${SRCDIR} | ||
108 | niro | 29782 | python_docompile $@ || die |
109 | niro | 8645 | } |
110 | |||
111 | niro | 21029 | python_multilib_src_compile() |
112 | { | ||
113 | local abi | ||
114 | local saved_SRCDIR="${SRCDIR}" | ||
115 | |||
116 | for abi in ${MULTILIB_ABIS} | ||
117 | do | ||
118 | SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" | ||
119 | cd ${SRCDIR} | ||
120 | niro | 29782 | abi-${abi} python_docompile $@ || die |
121 | niro | 21029 | done |
122 | SRCDIR="${saved_SRCDIR}" | ||
123 | } | ||
124 | |||
125 | niro | 21031 | python_src_check() |
126 | { | ||
127 | return 0 | ||
128 | } | ||
129 | |||
130 | niro | 8645 | python_src_install() |
131 | { | ||
132 | cd ${SRCDIR} | ||
133 | niro | 29782 | python_doinstall $@ || die |
134 | niro | 8645 | |
135 | niro | 2 | local i |
136 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ | ||
137 | FAQ LICENSE NEWS README TODO | ||
138 | do | ||
139 | if [ -f ${SRCDIR}/${i} ] | ||
140 | then | ||
141 | minstalldocs ${i} || die | ||
142 | fi | ||
143 | done | ||
144 | } | ||
145 | |||
146 | niro | 21029 | python_multilib_src_install() |
147 | { | ||
148 | local abi | ||
149 | local saved_SRCDIR="${SRCDIR}" | ||
150 | |||
151 | for abi in ${MULTILIB_ABIS} | ||
152 | do | ||
153 | SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" | ||
154 | cd ${SRCDIR} | ||
155 | niro | 29782 | abi-${abi} python_doinstall $@ || die |
156 | niro | 21029 | |
157 | local i | ||
158 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ | ||
159 | FAQ LICENSE NEWS README TODO | ||
160 | do | ||
161 | if [ -f ${SRCDIR}/${i} ] | ||
162 | then | ||
163 | oldminstalldocs ${i} || die | ||
164 | fi | ||
165 | done | ||
166 | done | ||
167 | SRCDIR="${saved_SRCDIR}" | ||
168 | } | ||
169 | |||
170 | niro | 21031 | export_inherits python src_prepare src_check |
171 | niro | 21029 | if [[ ${MULTILIB_BUILD} = true ]] |
172 | then | ||
173 | export_inherits python_multilib src_compile src_install | ||
174 | else | ||
175 | export_inherits python src_compile src_install | ||
176 | fi |