summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python_2.7.16.bb
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2019-11-18 15:28:40 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-16 22:38:52 +0000
commitcc7bd259519ea11b279486648a45c79e1aba35d3 (patch)
tree8d15bb332d2de43fa480d27da937af14317e285e /meta/recipes-devtools/python/python_2.7.16.bb
parentc8342197f862d71c74311a9c6c5d38fa05fef5ad (diff)
downloadpoky-cc7bd259519ea11b279486648a45c79e1aba35d3.tar.gz
python: update to 2.7.17
Drop backports, rebase a couple of patches. This is the second last release of py 2.x; upstream support ends on 1 January 2020, there will be one final 2.x afterwards. Note that the only thing that still needs python 2.x in oe-core is u-boot; when the next u-boot update arrives, we should find out where the py3 migration is for that component before merging the update. (From OE-Core rev: 184b60eb905bb75ecc7a0c29a175e624d8555fac) (From OE-Core rev: 7009d823a0799ce7132bd77329b273a476718c8c) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> [Minor fixup for warrior context] Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python_2.7.16.bb')
-rw-r--r--meta/recipes-devtools/python/python_2.7.16.bb270
1 files changed, 0 insertions, 270 deletions
diff --git a/meta/recipes-devtools/python/python_2.7.16.bb b/meta/recipes-devtools/python/python_2.7.16.bb
deleted file mode 100644
index 8cae22a1e2..0000000000
--- a/meta/recipes-devtools/python/python_2.7.16.bb
+++ /dev/null
@@ -1,270 +0,0 @@
1require python.inc
2
3DEPENDS = "python-native libffi bzip2 gdbm openssl \
4 readline sqlite3 zlib virtual/crypt"
5
6DISTRO_SRC_URI ?= "file://sitecustomize.py"
7DISTRO_SRC_URI_linuxstdbase = ""
8SRC_URI += " \
9 file://01-use-proper-tools-for-cross-build.patch \
10 file://03-fix-tkinter-detection.patch \
11 file://06-avoid_usr_lib_termcap_path_in_linking.patch \
12 ${DISTRO_SRC_URI} \
13 file://multilib.patch \
14 file://cgi_py.patch \
15 file://setup_py_skip_cross_import_check.patch \
16 file://add-md5module-support.patch \
17 file://host_include_contamination.patch \
18 file://fix_for_using_different_libdir.patch \
19 file://setuptweaks.patch \
20 file://check-if-target-is-64b-not-host.patch \
21 file://search_db_h_in_inc_dirs_and_avoid_warning.patch \
22 ${@bb.utils.contains('PACKAGECONFIG', 'tk', '', 'file://avoid_warning_about_tkinter.patch', d)} \
23 file://avoid_warning_for_sunos_specific_module.patch \
24 file://python-2.7.3-remove-bsdb-rpath.patch \
25 file://run-ptest \
26 file://parallel-makeinst-create-bindir.patch \
27 file://use_sysroot_ncurses_instead_of_host.patch \
28 file://add-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \
29 file://pass-missing-libraries-to-Extension-for-mul.patch \
30 file://support_SOURCE_DATE_EPOCH_in_py_compile_2.7.patch \
31 file://float-endian.patch \
32 file://0001-python2-use-cc_basename-to-replace-CC-for-checking-c.patch \
33 file://0001-2.7-bpo-34155-Dont-parse-domains-containing-GH-13079.patch \
34 file://bpo-36742-cve-2019-10160.patch \
35 file://0001-2.7-bpo-38243-Escape-the-server-title-of-DocXMLRPCSe.patch \
36"
37
38S = "${WORKDIR}/Python-${PV}"
39
40inherit autotools multilib_header python-dir pythonnative ptest
41
42CONFIGUREOPTS += " --with-system-ffi "
43
44EXTRA_OECONF += "ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no ac_cv_working_tzset=yes"
45
46PACKAGECONFIG ??= "bdb"
47PACKAGECONFIG[bdb] = ",,db"
48PACKAGECONFIG[tk] = ",,tk"
49
50do_configure_append() {
51 rm -f ${S}/Makefile.orig
52 autoreconf -Wcross --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi
53}
54
55do_compile() {
56 # regenerate platform specific files, because they depend on system headers
57 cd ${S}/Lib/plat-linux2
58 include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python-native/python \
59 ${S}/Tools/scripts/h2py.py -i '(u_long)' \
60 ${STAGING_INCDIR}/dlfcn.h \
61 ${STAGING_INCDIR}/linux/cdrom.h \
62 ${STAGING_INCDIR}/netinet/in.h \
63 ${STAGING_INCDIR}/sys/types.h
64 sed -e 's,${STAGING_DIR_HOST},,g' -i *.py
65 cd -
66
67 # remove any bogus LD_LIBRARY_PATH
68 sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
69
70 if [ ! -f Makefile.orig ]; then
71 install -m 0644 Makefile Makefile.orig
72 fi
73 sed -i -e 's#^LDFLAGS=.*#LDFLAGS=${LDFLAGS} -L. -L${STAGING_LIBDIR}#g' \
74 -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \
75 -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \
76 -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \
77 -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \
78 -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \
79 -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \
80 Makefile
81 # save copy of it now, because if we do it in do_install and
82 # then call do_install twice we get Makefile.orig == Makefile.sysroot
83 install -m 0644 Makefile Makefile.sysroot
84
85 export CROSS_COMPILE="${TARGET_PREFIX}"
86 export PYTHONBUILDDIR="${B}"
87
88 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
89 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \
90 STAGING_LIBDIR=${STAGING_LIBDIR} \
91 STAGING_INCDIR=${STAGING_INCDIR} \
92 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
93 OPT="${CFLAGS}"
94}
95
96do_install() {
97 # make install needs the original Makefile, or otherwise the inclues would
98 # go to ${D}${STAGING...}/...
99 install -m 0644 Makefile.orig Makefile
100
101 export CROSS_COMPILE="${TARGET_PREFIX}"
102 export PYTHONBUILDDIR="${B}"
103
104 # After swizzling the makefile, we need to run the build again.
105 # install can race with the build so we have to run this first, then install
106 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
107 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \
108 CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \
109 STAGING_LIBDIR=${STAGING_LIBDIR} \
110 STAGING_INCDIR=${STAGING_INCDIR} \
111 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
112 DESTDIR=${D} LIBDIR=${libdir}
113
114 oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
115 HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \
116 CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \
117 STAGING_LIBDIR=${STAGING_LIBDIR} \
118 STAGING_INCDIR=${STAGING_INCDIR} \
119 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
120 DESTDIR=${D} LIBDIR=${libdir} install
121
122 install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
123
124 if [ -e ${WORKDIR}/sitecustomize.py ]; then
125 install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
126 fi
127
128 oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
129
130 if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'bdb', d)}" ]; then
131 rm -rf ${D}/${libdir}/python${PYTHON_MAJMIN}/bsddb
132 fi
133
134 # Python 3.x version of 2to3 is now the default
135 mv ${D}/${bindir}/2to3 ${D}/${bindir}/2to3-${PYTHON_MAJMIN}
136}
137
138do_install_append_class-nativesdk () {
139 create_wrapper ${D}${bindir}/python2.7 PYTHONHOME='${prefix}' TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
140}
141
142SSTATE_SCAN_FILES += "Makefile"
143PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
144
145py_package_preprocess () {
146 # copy back the old Makefile to fix target package
147 install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
148
149 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
150 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
151 -e 's|${DEBUG_PREFIX_MAP}||g' \
152 -e 's:${HOSTTOOLS_DIR}/::g' \
153 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
154 -e 's:${RECIPE_SYSROOT}::g' \
155 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
156 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile \
157 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py
158 (cd ${PKGD}; python -m py_compile ./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py)
159}
160
161PACKAGES_remove = "${PN}"
162
163# manual dependency additions
164RPROVIDES_${PN}-core = "${PN}"
165RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python-modules"
166RRECOMMENDS_${PN}-crypt = "openssl"
167
168# package libpython2
169PACKAGES =+ "lib${BPN}2"
170FILES_lib${BPN}2 = "${libdir}/libpython*.so.*"
171
172# catch all the rest (unsorted)
173PACKAGES += "${PN}-misc"
174FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
175RDEPENDS_${PN}-modules += "${PN}-misc"
176
177# ptest
178RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests unzip tzdata-europe coreutils sed"
179RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk tk-lib', '', d)}"
180# catch manpage
181PACKAGES += "${PN}-man"
182FILES_${PN}-man = "${datadir}/man"
183
184# Nasty but if bdb isn't enabled the package won't be generated
185RDEPENDS_${PN}-modules_remove = "${@bb.utils.contains('PACKAGECONFIG', 'bdb', '', '${PN}-bsddb', d)}"
186
187RDEPENDS_${PN}-dev = ""
188
189BBCLASSEXTEND = "nativesdk"
190
191# We want bytecode precompiled .py files (.pyc's) by default
192# but the user may set it on their own conf
193
194INCLUDE_PYCS ?= "1"
195
196python(){
197 import collections, json
198
199 filename = os.path.join(d.getVar('THISDIR'), 'python', 'python2-manifest.json')
200 # This python changes the datastore based on the contents of a file, so mark
201 # that dependency.
202 bb.parse.mark_dependency(d, filename)
203
204 with open(filename) as manifest_file:
205 manifest_str = manifest_file.read()
206 json_start = manifest_str.find('# EOC') + 6
207 manifest_file.seek(json_start)
208 manifest_str = manifest_file.read()
209 python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
210
211 include_pycs = d.getVar('INCLUDE_PYCS')
212
213 packages = d.getVar('PACKAGES').split()
214 pn = d.getVar('PN')
215
216 newpackages=[]
217
218 for key in python_manifest:
219 pypackage= pn + '-' + key
220
221 if pypackage not in packages:
222 # We need to prepend, otherwise python-misc gets everything
223 # so we use a new variable
224 newpackages.append(pypackage)
225
226 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
227 d.setVar('FILES_' + pypackage, '')
228 for value in python_manifest[key]['files']:
229 d.appendVar('FILES_' + pypackage, ' ' + value)
230 if include_pycs == '1':
231 if value.endswith('.py'):
232 d.appendVar('FILES_' + pypackage, ' ' + value + 'c')
233
234 for value in python_manifest[key]['rdepends']:
235 # Make it work with or without $PN
236 if '${PN}' in value:
237 value=value.split('-')[1]
238 d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
239 d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary'])
240
241 # Prepending so to avoid python-misc getting everything
242 packages = newpackages + packages
243 d.setVar('PACKAGES', ' '.join(packages))
244 d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
245}
246
247# Files needed to create a new manifest
248SRC_URI += "file://create_manifest2.py file://get_module_deps2.py file://python2-manifest.json"
249
250do_create_manifest() {
251 # This task should be run with every new release of Python.
252 # We must ensure that PACKAGECONFIG enables everything when creating
253 # a new manifest, this is to base our new manifest on a complete
254 # native python build, containing all dependencies, otherwise the task
255 # wont be able to find the required files.
256 # e.g. BerkeleyDB is an optional build dependency so it may or may not
257 # be present, we must ensure it is.
258
259 cd ${WORKDIR}
260 # This needs to be executed by python-native and NOT by HOST's python
261 nativepython create_manifest2.py
262 cp python2-manifest.json.new ${THISDIR}/python/python2-manifest.json
263}
264
265# bitbake python -c create_manifest
266addtask do_create_manifest
267
268# Make sure we have native python ready when we create a new manifest
269do_create_manifest[depends] += "python:do_prepare_recipe_sysroot"
270do_create_manifest[depends] += "python:do_patch"