diff options
| author | Derek Straka <derek@asterius.io> | 2018-06-30 07:37:35 -0400 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-16 16:33:09 +0000 |
| commit | 62f52fdda08e2a8fad08b94ce326cae12e4b8757 (patch) | |
| tree | 4c0d59a25c50e582dba53ee5d90b9dcab91849be /meta/recipes-devtools/python/python_2.7.15.bb | |
| parent | 28ef11425378b655e7d31826bac04adb099e944c (diff) | |
| download | poky-62f52fdda08e2a8fad08b94ce326cae12e4b8757.tar.gz | |
python: update to version 2.7.15
Update to the latest stable version
License-Update: Copyright year updated to include 2018
Remove the alignment patch that is included upstream
(From OE-Core rev: 855020053906478cea164ed254c08bedce48479d)
(From OE-Core rev: ab2dd15f72a94cce528276e6e3e38c56677e7ba4)
Signed-off-by: Derek Straka <derek@asterius.io>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
[Bug fix update only, drop patches included in update]
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.15.bb')
| -rw-r--r-- | meta/recipes-devtools/python/python_2.7.15.bb | 281 |
1 files changed, 281 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python_2.7.15.bb b/meta/recipes-devtools/python/python_2.7.15.bb new file mode 100644 index 0000000000..3044c3d363 --- /dev/null +++ b/meta/recipes-devtools/python/python_2.7.15.bb | |||
| @@ -0,0 +1,281 @@ | |||
| 1 | require python.inc | ||
| 2 | |||
| 3 | DEPENDS = "python-native libffi bzip2 gdbm openssl readline sqlite3 zlib" | ||
| 4 | |||
| 5 | PR = "${INC_PR}" | ||
| 6 | |||
| 7 | DISTRO_SRC_URI ?= "file://sitecustomize.py" | ||
| 8 | DISTRO_SRC_URI_linuxstdbase = "" | ||
| 9 | SRC_URI += "\ | ||
| 10 | file://01-use-proper-tools-for-cross-build.patch \ | ||
| 11 | file://03-fix-tkinter-detection.patch \ | ||
| 12 | file://06-avoid_usr_lib_termcap_path_in_linking.patch \ | ||
| 13 | ${DISTRO_SRC_URI} \ | ||
| 14 | file://multilib.patch \ | ||
| 15 | file://cgi_py.patch \ | ||
| 16 | file://setup_py_skip_cross_import_check.patch \ | ||
| 17 | file://add-md5module-support.patch \ | ||
| 18 | file://host_include_contamination.patch \ | ||
| 19 | file://fix_for_using_different_libdir.patch \ | ||
| 20 | file://setuptweaks.patch \ | ||
| 21 | file://check-if-target-is-64b-not-host.patch \ | ||
| 22 | file://search_db_h_in_inc_dirs_and_avoid_warning.patch \ | ||
| 23 | file://avoid_warning_about_tkinter.patch \ | ||
| 24 | file://avoid_warning_for_sunos_specific_module.patch \ | ||
| 25 | file://python-2.7.3-remove-bsdb-rpath.patch \ | ||
| 26 | file://fix-makefile-for-ptest.patch \ | ||
| 27 | file://run-ptest \ | ||
| 28 | file://parallel-makeinst-create-bindir.patch \ | ||
| 29 | file://use_sysroot_ncurses_instead_of_host.patch \ | ||
| 30 | file://add-CROSSPYTHONPATH-for-PYTHON_FOR_BUILD.patch \ | ||
| 31 | file://pass-missing-libraries-to-Extension-for-mul.patch \ | ||
| 32 | file://support_SOURCE_DATE_EPOCH_in_py_compile_2.7.patch \ | ||
| 33 | " | ||
| 34 | |||
| 35 | S = "${WORKDIR}/Python-${PV}" | ||
| 36 | |||
| 37 | inherit autotools multilib_header python-dir pythonnative | ||
| 38 | |||
| 39 | CONFIGUREOPTS += " --with-system-ffi " | ||
| 40 | |||
| 41 | EXTRA_OECONF += "ac_cv_file__dev_ptmx=yes ac_cv_file__dev_ptc=no" | ||
| 42 | |||
| 43 | PACKAGECONFIG ??= "bdb" | ||
| 44 | PACKAGECONFIG[bdb] = ",,db" | ||
| 45 | |||
| 46 | do_configure_append() { | ||
| 47 | rm -f ${S}/Makefile.orig | ||
| 48 | autoreconf -Wcross --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi | ||
| 49 | } | ||
| 50 | |||
| 51 | do_compile() { | ||
| 52 | # regenerate platform specific files, because they depend on system headers | ||
| 53 | cd ${S}/Lib/plat-linux2 | ||
| 54 | include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
| 55 | ${S}/Tools/scripts/h2py.py -i '(u_long)' \ | ||
| 56 | ${STAGING_INCDIR}/dlfcn.h \ | ||
| 57 | ${STAGING_INCDIR}/linux/cdrom.h \ | ||
| 58 | ${STAGING_INCDIR}/netinet/in.h \ | ||
| 59 | ${STAGING_INCDIR}/sys/types.h | ||
| 60 | sed -e 's,${STAGING_DIR_HOST},,g' -i *.py | ||
| 61 | cd - | ||
| 62 | |||
| 63 | # remove any bogus LD_LIBRARY_PATH | ||
| 64 | sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile | ||
| 65 | |||
| 66 | if [ ! -f Makefile.orig ]; then | ||
| 67 | install -m 0644 Makefile Makefile.orig | ||
| 68 | fi | ||
| 69 | sed -i -e 's#^LDFLAGS=.*#LDFLAGS=${LDFLAGS} -L. -L${STAGING_LIBDIR}#g' \ | ||
| 70 | -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \ | ||
| 71 | -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \ | ||
| 72 | -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \ | ||
| 73 | -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \ | ||
| 74 | -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \ | ||
| 75 | -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \ | ||
| 76 | Makefile | ||
| 77 | # save copy of it now, because if we do it in do_install and | ||
| 78 | # then call do_install twice we get Makefile.orig == Makefile.sysroot | ||
| 79 | install -m 0644 Makefile Makefile.sysroot | ||
| 80 | |||
| 81 | export CROSS_COMPILE="${TARGET_PREFIX}" | ||
| 82 | export PYTHONBUILDDIR="${B}" | ||
| 83 | |||
| 84 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
| 85 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
| 86 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
| 87 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
| 88 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
| 89 | OPT="${CFLAGS}" | ||
| 90 | } | ||
| 91 | |||
| 92 | do_install() { | ||
| 93 | # make install needs the original Makefile, or otherwise the inclues would | ||
| 94 | # go to ${D}${STAGING...}/... | ||
| 95 | install -m 0644 Makefile.orig Makefile | ||
| 96 | |||
| 97 | export CROSS_COMPILE="${TARGET_PREFIX}" | ||
| 98 | export PYTHONBUILDDIR="${B}" | ||
| 99 | |||
| 100 | # After swizzling the makefile, we need to run the build again. | ||
| 101 | # install can race with the build so we have to run this first, then install | ||
| 102 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
| 103 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
| 104 | CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \ | ||
| 105 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
| 106 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
| 107 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
| 108 | DESTDIR=${D} LIBDIR=${libdir} | ||
| 109 | |||
| 110 | oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \ | ||
| 111 | HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python-native/python \ | ||
| 112 | CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \ | ||
| 113 | STAGING_LIBDIR=${STAGING_LIBDIR} \ | ||
| 114 | STAGING_INCDIR=${STAGING_INCDIR} \ | ||
| 115 | STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \ | ||
| 116 | DESTDIR=${D} LIBDIR=${libdir} install | ||
| 117 | |||
| 118 | install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile | ||
| 119 | |||
| 120 | if [ -e ${WORKDIR}/sitecustomize.py ]; then | ||
| 121 | install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN} | ||
| 122 | fi | ||
| 123 | |||
| 124 | oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h | ||
| 125 | |||
| 126 | if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'bdb', d)}" ]; then | ||
| 127 | rm -rf ${D}/${libdir}/python${PYTHON_MAJMIN}/bsddb | ||
| 128 | fi | ||
| 129 | } | ||
| 130 | |||
| 131 | do_install_append_class-nativesdk () { | ||
| 132 | 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' | ||
| 133 | } | ||
| 134 | |||
| 135 | SSTATE_SCAN_FILES += "Makefile" | ||
| 136 | PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess" | ||
| 137 | |||
| 138 | py_package_preprocess () { | ||
| 139 | # copy back the old Makefile to fix target package | ||
| 140 | install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile | ||
| 141 | |||
| 142 | # Remove references to buildmachine paths in target Makefile and _sysconfigdata | ||
| 143 | sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ | ||
| 144 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
| 145 | -e 's:${HOSTTOOLS_DIR}/::g' \ | ||
| 146 | -e 's:${RECIPE_SYSROOT_NATIVE}::g' \ | ||
| 147 | -e 's:${RECIPE_SYSROOT}::g' \ | ||
| 148 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ | ||
| 149 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile \ | ||
| 150 | ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py | ||
| 151 | (cd ${PKGD}; python -m py_compile ./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py) | ||
| 152 | } | ||
| 153 | |||
| 154 | |||
| 155 | # manual dependency additions | ||
| 156 | RPROVIDES_${PN}-core = "${PN}" | ||
| 157 | RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python-modules" | ||
| 158 | RRECOMMENDS_${PN}-crypt = "openssl" | ||
| 159 | |||
| 160 | # package libpython2 | ||
| 161 | PACKAGES =+ "lib${BPN}2" | ||
| 162 | FILES_lib${BPN}2 = "${libdir}/libpython*.so.*" | ||
| 163 | |||
| 164 | # catch all the rest (unsorted) | ||
| 165 | PACKAGES += "${PN}-misc" | ||
| 166 | FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}" | ||
| 167 | RDEPENDS_${PN}-modules += "${PN}-misc" | ||
| 168 | |||
| 169 | # ptest | ||
| 170 | RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests" | ||
| 171 | #inherit ptest after "require python-${PYTHON_MAJMIN}-manifest.inc" so PACKAGES doesn't get overwritten | ||
| 172 | inherit ptest | ||
| 173 | |||
| 174 | # This must come after inherit ptest for the override to take effect | ||
| 175 | do_install_ptest() { | ||
| 176 | cp ${B}/Makefile ${D}${PTEST_PATH} | ||
| 177 | sed -e s:LIBDIR/python/ptest:${PTEST_PATH}:g \ | ||
| 178 | -e s:LIBDIR:${libdir}:g \ | ||
| 179 | -i ${D}${PTEST_PATH}/run-ptest | ||
| 180 | |||
| 181 | #Remove build host references | ||
| 182 | sed -i \ | ||
| 183 | -e 's:--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \ | ||
| 184 | -e 's:--sysroot=${STAGING_DIR_TARGET}::g' \ | ||
| 185 | -e 's|${DEBUG_PREFIX_MAP}||g' \ | ||
| 186 | -e 's:${HOSTTOOLS_DIR}/::g' \ | ||
| 187 | -e 's:${RECIPE_SYSROOT}::g' \ | ||
| 188 | -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ | ||
| 189 | ${D}/${PTEST_PATH}/Makefile | ||
| 190 | } | ||
| 191 | |||
| 192 | # catch manpage | ||
| 193 | PACKAGES += "${PN}-man" | ||
| 194 | FILES_${PN}-man = "${datadir}/man" | ||
| 195 | |||
| 196 | # Nasty but if bdb isn't enabled the package won't be generated | ||
| 197 | RDEPENDS_${PN}-modules_remove = "${@bb.utils.contains('PACKAGECONFIG', 'bdb', '', '${PN}-bsddb', d)}" | ||
| 198 | |||
| 199 | BBCLASSEXTEND = "nativesdk" | ||
| 200 | |||
| 201 | RPROVIDES_${PN} += "${PN}-modules" | ||
| 202 | |||
| 203 | # We want bytecode precompiled .py files (.pyc's) by default | ||
| 204 | # but the user may set it on their own conf | ||
| 205 | |||
| 206 | INCLUDE_PYCS ?= "1" | ||
| 207 | |||
| 208 | python(){ | ||
| 209 | import json | ||
| 210 | |||
| 211 | filename = os.path.join(d.getVar('THISDIR'), 'python', 'python2-manifest.json') | ||
| 212 | # This python changes the datastore based on the contents of a file, so mark | ||
| 213 | # that dependency. | ||
| 214 | bb.parse.mark_dependency(d, filename) | ||
| 215 | |||
| 216 | with open(filename) as manifest_file: | ||
| 217 | python_manifest=json.load(manifest_file) | ||
| 218 | |||
| 219 | include_pycs = d.getVar('INCLUDE_PYCS') | ||
| 220 | |||
| 221 | packages = d.getVar('PACKAGES').split() | ||
| 222 | pn = d.getVar('PN') | ||
| 223 | |||
| 224 | newpackages=[] | ||
| 225 | |||
| 226 | for key in python_manifest: | ||
| 227 | pypackage= pn + '-' + key | ||
| 228 | |||
| 229 | if pypackage not in packages: | ||
| 230 | # We need to prepend, otherwise python-misc gets everything | ||
| 231 | # so we use a new variable | ||
| 232 | newpackages.append(pypackage) | ||
| 233 | |||
| 234 | # "Build" python's manifest FILES, RDEPENDS and SUMMARY | ||
| 235 | d.setVar('FILES_' + pypackage, '') | ||
| 236 | for value in python_manifest[key]['files']: | ||
| 237 | d.appendVar('FILES_' + pypackage, ' ' + value) | ||
| 238 | if include_pycs == '1': | ||
| 239 | if value.endswith('.py'): | ||
| 240 | d.appendVar('FILES_' + pypackage, ' ' + value + 'c') | ||
| 241 | |||
| 242 | d.setVar('RDEPENDS_' + pypackage, '') | ||
| 243 | for value in python_manifest[key]['rdepends']: | ||
| 244 | # Make it work with or without $PN | ||
| 245 | if '${PN}' in value: | ||
| 246 | value=value.split('-')[1] | ||
| 247 | d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value) | ||
| 248 | d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary']) | ||
| 249 | |||
| 250 | # We need to ensure staticdev packages match for files first so we sort in reverse | ||
| 251 | newpackages.sort(reverse=True) | ||
| 252 | # Prepending so to avoid python-misc getting everything | ||
| 253 | packages = newpackages + packages | ||
| 254 | d.setVar('PACKAGES', ' '.join(packages)) | ||
| 255 | d.setVar('ALLOW_EMPTY_${PN}-modules', '1') | ||
| 256 | } | ||
| 257 | |||
| 258 | # Files needed to create a new manifest | ||
| 259 | SRC_URI += "file://create_manifest2.py file://get_module_deps2.py file://python2-manifest.json" | ||
| 260 | |||
| 261 | do_create_manifest() { | ||
| 262 | # This task should be run with every new release of Python. | ||
| 263 | # We must ensure that PACKAGECONFIG enables everything when creating | ||
| 264 | # a new manifest, this is to base our new manifest on a complete | ||
| 265 | # native python build, containing all dependencies, otherwise the task | ||
| 266 | # wont be able to find the required files. | ||
| 267 | # e.g. BerkeleyDB is an optional build dependency so it may or may not | ||
| 268 | # be present, we must ensure it is. | ||
| 269 | |||
| 270 | cd ${WORKDIR} | ||
| 271 | # This needs to be executed by python-native and NOT by HOST's python | ||
| 272 | nativepython create_manifest2.py | ||
| 273 | cp python2-manifest.json.new ${THISDIR}/python/python2-manifest.json | ||
| 274 | } | ||
| 275 | |||
| 276 | # bitbake python -c create_manifest | ||
| 277 | addtask do_create_manifest | ||
| 278 | |||
| 279 | # Make sure we have native python ready when we create a new manifest | ||
| 280 | do_create_manifest[depends] += "python:do_prepare_recipe_sysroot" | ||
| 281 | do_create_manifest[depends] += "python:do_patch" | ||
