1 |
commit: 3210c105adb24fc4db31dbc28608f1111c46a5c8 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Dec 29 09:48:16 2019 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 29 10:14:09 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3210c105 |
7 |
|
8 |
dev-lang/python: Bump 2.7.17 to EAPI 7, unify |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-lang/python/python-2.7.17-r1.ebuild | 368 ++++++++++++++++++++++++++++++++ |
13 |
1 file changed, 368 insertions(+) |
14 |
|
15 |
diff --git a/dev-lang/python/python-2.7.17-r1.ebuild b/dev-lang/python/python-2.7.17-r1.ebuild |
16 |
new file mode 100644 |
17 |
index 00000000000..424cdec1208 |
18 |
--- /dev/null |
19 |
+++ b/dev-lang/python/python-2.7.17-r1.ebuild |
20 |
@@ -0,0 +1,368 @@ |
21 |
+# Copyright 1999-2019 Gentoo Authors |
22 |
+# Distributed under the terms of the GNU General Public License v2 |
23 |
+ |
24 |
+EAPI="7" |
25 |
+WANT_LIBTOOL="none" |
26 |
+ |
27 |
+inherit autotools flag-o-matic pax-utils python-utils-r1 toolchain-funcs |
28 |
+ |
29 |
+MY_P="Python-${PV}" |
30 |
+PYVER=$(ver_cut 1-2) |
31 |
+PATCHSET_VERSION="2.7.17" |
32 |
+ |
33 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
34 |
+HOMEPAGE="https://www.python.org/" |
35 |
+SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz |
36 |
+ https://dev.gentoo.org/~mgorny/dist/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz" |
37 |
+S="${WORKDIR}/${MY_P}" |
38 |
+ |
39 |
+LICENSE="PSF-2" |
40 |
+SLOT="${PYVER}" |
41 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" |
42 |
+IUSE="-berkdb bluetooth build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" |
43 |
+ |
44 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
45 |
+# If you need to apply a patch which requires python for bootstrapping, please |
46 |
+# run the bootstrap code on your dev box and include the results in the |
47 |
+# patchset. See bug 447752. |
48 |
+ |
49 |
+RDEPEND="app-arch/bzip2:= |
50 |
+ >=sys-libs/zlib-1.1.3:= |
51 |
+ virtual/libffi:= |
52 |
+ virtual/libintl |
53 |
+ berkdb? ( || ( |
54 |
+ sys-libs/db:5.3 |
55 |
+ sys-libs/db:5.1 |
56 |
+ sys-libs/db:4.8 |
57 |
+ sys-libs/db:4.7 |
58 |
+ sys-libs/db:4.6 |
59 |
+ sys-libs/db:4.5 |
60 |
+ sys-libs/db:4.4 |
61 |
+ sys-libs/db:4.3 |
62 |
+ sys-libs/db:4.2 |
63 |
+ ) ) |
64 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
65 |
+ ncurses? ( >=sys-libs/ncurses-5.2:= ) |
66 |
+ readline? ( >=sys-libs/readline-4.1:= ) |
67 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
68 |
+ ssl? ( |
69 |
+ !libressl? ( dev-libs/openssl:= ) |
70 |
+ libressl? ( dev-libs/libressl:= ) |
71 |
+ ) |
72 |
+ tk? ( |
73 |
+ >=dev-lang/tcl-8.0:= |
74 |
+ >=dev-lang/tk-8.0:= |
75 |
+ dev-tcltk/blt:= |
76 |
+ dev-tcltk/tix |
77 |
+ ) |
78 |
+ xml? ( >=dev-libs/expat-2.1:= )" |
79 |
+# bluetooth requires headers from bluez |
80 |
+DEPEND="${RDEPEND} |
81 |
+ bluetooth? ( net-wireless/bluez ) |
82 |
+ virtual/pkgconfig |
83 |
+ !sys-devel/gcc[libffi(-)]" |
84 |
+RDEPEND+=" !build? ( app-misc/mime-types )" |
85 |
+PDEPEND=">=app-eselect/eselect-python-20140125-r1" |
86 |
+ |
87 |
+pkg_setup() { |
88 |
+ if use berkdb; then |
89 |
+ ewarn "'bsddb' module is out-of-date and no longer maintained inside" |
90 |
+ ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally" |
91 |
+ ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module" |
92 |
+ ewarn "is provided by dev-python/bsddb3." |
93 |
+ else |
94 |
+ if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then |
95 |
+ ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]" |
96 |
+ ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]." |
97 |
+ ewarn "You might need to migrate your databases." |
98 |
+ fi |
99 |
+ fi |
100 |
+} |
101 |
+ |
102 |
+src_prepare() { |
103 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
104 |
+ rm -fr Modules/expat || die |
105 |
+ rm -fr Modules/_ctypes/libffi* || die |
106 |
+ rm -fr Modules/zlib || die |
107 |
+ |
108 |
+ local PATCHES=( |
109 |
+ "${WORKDIR}/patches" |
110 |
+ # Fix for cross-compiling. |
111 |
+ "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch" |
112 |
+ "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch" |
113 |
+ "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch" |
114 |
+ "${FILESDIR}/python-2.7.10-system-libffi.patch" |
115 |
+ ) |
116 |
+ |
117 |
+ default |
118 |
+ |
119 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
120 |
+ Lib/distutils/command/install.py \ |
121 |
+ Lib/distutils/sysconfig.py \ |
122 |
+ Lib/site.py \ |
123 |
+ Lib/sysconfig.py \ |
124 |
+ Lib/test/test_site.py \ |
125 |
+ Makefile.pre.in \ |
126 |
+ Modules/Setup.dist \ |
127 |
+ Modules/getpath.c \ |
128 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
129 |
+ |
130 |
+ eautoreconf |
131 |
+} |
132 |
+ |
133 |
+src_configure() { |
134 |
+ # dbm module can be linked against berkdb or gdbm. |
135 |
+ # Defaults to gdbm when both are enabled, #204343. |
136 |
+ local disable |
137 |
+ use berkdb || use gdbm || disable+=" dbm" |
138 |
+ use berkdb || disable+=" _bsddb" |
139 |
+ # disable automagic bluetooth headers detection |
140 |
+ use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no |
141 |
+ use gdbm || disable+=" gdbm" |
142 |
+ use ncurses || disable+=" _curses _curses_panel" |
143 |
+ use readline || disable+=" readline" |
144 |
+ use sqlite || disable+=" _sqlite3" |
145 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
146 |
+ use tk || disable+=" _tkinter" |
147 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
148 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
149 |
+ |
150 |
+ if ! use xml; then |
151 |
+ ewarn "You have configured Python without XML support." |
152 |
+ ewarn "This is NOT a recommended configuration as you" |
153 |
+ ewarn "may face problems parsing any XML documents." |
154 |
+ fi |
155 |
+ |
156 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
157 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
158 |
+ fi |
159 |
+ |
160 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
161 |
+ append-flags -fwrapv |
162 |
+ fi |
163 |
+ |
164 |
+ filter-flags -malign-double |
165 |
+ |
166 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
167 |
+ if is-flagq -O3; then |
168 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
169 |
+ use hardened && replace-flags -O3 -O2 |
170 |
+ fi |
171 |
+ |
172 |
+ if tc-is-cross-compiler; then |
173 |
+ # Force some tests that try to poke fs paths. |
174 |
+ export ac_cv_file__dev_ptc=no |
175 |
+ export ac_cv_file__dev_ptmx=yes |
176 |
+ fi |
177 |
+ |
178 |
+ # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile. |
179 |
+ tc-export CXX |
180 |
+ # The configure script fails to use pkg-config correctly. |
181 |
+ # http://bugs.python.org/issue15506 |
182 |
+ export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG) |
183 |
+ |
184 |
+ # Set LDFLAGS so we link modules with -lpython2.7 correctly. |
185 |
+ # Needed on FreeBSD unless Python 2.7 is already installed. |
186 |
+ # Please query BSD team before removing this! |
187 |
+ append-ldflags "-L." |
188 |
+ |
189 |
+ local dbmliborder |
190 |
+ if use gdbm; then |
191 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
192 |
+ fi |
193 |
+ if use berkdb; then |
194 |
+ dbmliborder+="${dbmliborder:+:}bdb" |
195 |
+ fi |
196 |
+ |
197 |
+ local myeconfargs=( |
198 |
+ # The check is broken on clang, and gives false positive: |
199 |
+ # https://bugs.gentoo.org/596798 |
200 |
+ # (upstream dropped this flag in 3.2a4 anyway) |
201 |
+ ac_cv_opt_olimit_ok=no |
202 |
+ |
203 |
+ --with-fpectl |
204 |
+ --enable-shared |
205 |
+ $(use_enable ipv6) |
206 |
+ $(use_with threads) |
207 |
+ $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") |
208 |
+ --infodir='${prefix}/share/info' |
209 |
+ --mandir='${prefix}/share/man' |
210 |
+ --with-computed-gotos |
211 |
+ --with-dbmliborder="${dbmliborder}" |
212 |
+ --with-libc= |
213 |
+ --enable-loadable-sqlite-extensions |
214 |
+ --with-system-expat |
215 |
+ --with-system-ffi |
216 |
+ --without-ensurepip |
217 |
+ ) |
218 |
+ |
219 |
+ OPT="" econf "${myeconfargs[@]}" |
220 |
+ |
221 |
+ if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
222 |
+ eerror "configure has detected that the sem_open function is broken." |
223 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
224 |
+ die "Broken sem_open function (bug 496328)" |
225 |
+ fi |
226 |
+} |
227 |
+ |
228 |
+src_compile() { |
229 |
+ # Ensure sed works as expected |
230 |
+ # https://bugs.gentoo.org/594768 |
231 |
+ local -x LC_ALL=C |
232 |
+ |
233 |
+ # Avoid invoking pgen for cross-compiles. |
234 |
+ touch Include/graminit.h Python/graminit.c |
235 |
+ |
236 |
+ emake |
237 |
+ |
238 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
239 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
240 |
+ pax-mark E python |
241 |
+ else |
242 |
+ pax-mark m python |
243 |
+ fi |
244 |
+} |
245 |
+ |
246 |
+src_test() { |
247 |
+ # Tests will not work when cross compiling. |
248 |
+ if tc-is-cross-compiler; then |
249 |
+ elog "Disabling tests due to crosscompiling." |
250 |
+ return |
251 |
+ fi |
252 |
+ |
253 |
+ # Skip failing tests. |
254 |
+ local skipped_tests="distutils gdb" |
255 |
+ |
256 |
+ for test in ${skipped_tests}; do |
257 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
258 |
+ done |
259 |
+ |
260 |
+ # bug 660358 |
261 |
+ local -x COLUMNS=80 |
262 |
+ |
263 |
+ # Daylight saving time problem |
264 |
+ # https://bugs.python.org/issue22067 |
265 |
+ # https://bugs.gentoo.org/610628 |
266 |
+ local -x TZ=UTC |
267 |
+ |
268 |
+ # Rerun failed tests in verbose mode (regrtest -w). |
269 |
+ emake test EXTRATESTOPTS="-w" < /dev/tty |
270 |
+ local result="$?" |
271 |
+ |
272 |
+ for test in ${skipped_tests}; do |
273 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
274 |
+ done |
275 |
+ |
276 |
+ elog "The following tests have been skipped:" |
277 |
+ for test in ${skipped_tests}; do |
278 |
+ elog "test_${test}.py" |
279 |
+ done |
280 |
+ |
281 |
+ elog "If you would like to run them, you may:" |
282 |
+ elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'" |
283 |
+ elog "and run the tests separately." |
284 |
+ |
285 |
+ if [[ ${result} -ne 0 ]]; then |
286 |
+ die "emake test failed" |
287 |
+ fi |
288 |
+} |
289 |
+ |
290 |
+src_install() { |
291 |
+ local libdir=${ED}/usr/$(get_libdir)/python${PYVER} |
292 |
+ |
293 |
+ emake DESTDIR="${D}" altinstall |
294 |
+ |
295 |
+ sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die |
296 |
+ |
297 |
+ # Fix collisions between different slots of Python. |
298 |
+ mv "${ED}/usr/bin/2to3" "${ED}/usr/bin/2to3-${PYVER}" || die |
299 |
+ mv "${ED}/usr/bin/pydoc" "${ED}/usr/bin/pydoc${PYVER}" || die |
300 |
+ mv "${ED}/usr/bin/idle" "${ED}/usr/bin/idle${PYVER}" || die |
301 |
+ rm "${ED}/usr/bin/smtpd.py" || die |
302 |
+ |
303 |
+ use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py*,test/test_bsddb*} || die |
304 |
+ use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
305 |
+ use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,lib-tk} || die |
306 |
+ use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test} |
307 |
+ |
308 |
+ use threads || rm -r "${libdir}/multiprocessing" || die |
309 |
+ use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die |
310 |
+ |
311 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
312 |
+ |
313 |
+ if use examples; then |
314 |
+ docinto examples |
315 |
+ dodoc -r Tools |
316 |
+ fi |
317 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
318 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
319 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
320 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
321 |
+ |
322 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
323 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
324 |
+ sed \ |
325 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
326 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
327 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
328 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
329 |
+ |
330 |
+ # for python-exec |
331 |
+ local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR ) |
332 |
+ |
333 |
+ # if not using a cross-compiler, use the fresh binary |
334 |
+ if ! tc-is-cross-compiler; then |
335 |
+ local -x PYTHON=./python |
336 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} |
337 |
+ else |
338 |
+ vars=( PYTHON "${vars[@]}" ) |
339 |
+ fi |
340 |
+ |
341 |
+ python_export "python${PYVER}" "${vars[@]}" |
342 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
343 |
+ python_domodule epython.py |
344 |
+ |
345 |
+ # python-exec wrapping support |
346 |
+ local pymajor=${PYVER%.*} |
347 |
+ mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die |
348 |
+ # python and pythonX |
349 |
+ ln -s "../../../bin/python${PYVER}" \ |
350 |
+ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die |
351 |
+ ln -s "python${pymajor}" "${D}${PYTHON_SCRIPTDIR}/python" || die |
352 |
+ # python-config and pythonX-config |
353 |
+ ln -s "../../../bin/python${PYVER}-config" \ |
354 |
+ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die |
355 |
+ ln -s "python${pymajor}-config" \ |
356 |
+ "${D}${PYTHON_SCRIPTDIR}/python-config" || die |
357 |
+ # 2to3, pydoc, pyvenv |
358 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
359 |
+ "${D}${PYTHON_SCRIPTDIR}/2to3" || die |
360 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
361 |
+ "${D}${PYTHON_SCRIPTDIR}/pydoc" || die |
362 |
+ # idle |
363 |
+ if use tk; then |
364 |
+ ln -s "../../../bin/idle${PYVER}" \ |
365 |
+ "${D}${PYTHON_SCRIPTDIR}/idle" || die |
366 |
+ fi |
367 |
+} |
368 |
+ |
369 |
+eselect_python_update() { |
370 |
+ if [[ -z "$(eselect python show)" || \ |
371 |
+ ! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then |
372 |
+ eselect python update |
373 |
+ fi |
374 |
+ |
375 |
+ if [[ -z "$(eselect python show --python${PV%%.*})" || \ |
376 |
+ ! -f "${EROOT}/usr/bin/$(eselect python show --python${PV%%.*})" ]] |
377 |
+ then |
378 |
+ eselect python update --python${PV%%.*} |
379 |
+ fi |
380 |
+} |
381 |
+ |
382 |
+pkg_postinst() { |
383 |
+ eselect_python_update |
384 |
+} |
385 |
+ |
386 |
+pkg_postrm() { |
387 |
+ eselect_python_update |
388 |
+} |