summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python_2.7.17.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python_2.7.17.bb')
-rw-r--r--meta/recipes-devtools/python/python_2.7.17.bb260
1 files changed, 0 insertions, 260 deletions
diff --git a/meta/recipes-devtools/python/python_2.7.17.bb b/meta/recipes-devtools/python/python_2.7.17.bb
deleted file mode 100644
index be7c6d2d2b..0000000000
--- a/meta/recipes-devtools/python/python_2.7.17.bb
+++ /dev/null
@@ -1,260 +0,0 @@
1require python.inc
2
3DEPENDS = "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"
34
35S = "${WORKDIR}/Python-${PV}"
36
37inherit autotools multilib_header python-dir pythonnative ptest
38
39EXTRA_OECONF += "--with-system-ffi"
40
41CACHED_CONFIGUREVARS = "ac_cv_file__dev_ptmx=yes \
42 ac_cv_file__dev_ptc=no \
43 ac_cv_working_tzset=yes"
44
45PACKAGECONFIG ??= "bdb"
46PACKAGECONFIG[bdb] = ",,db"
47PACKAGECONFIG[tk] = ",,tk"
48
49# pgen isn't needed in the current build, but use the binary from python-native just in case.
50EXTRA_OEMAKE = "PGEN=${STAGING_BINDIR_NATIVE}/python-native/pgen \
51 CROSSPYTHONPATH=${STAGING_LIBDIR_NATIVE}/python${PYTHON_MAJMIN}/lib-dynload/ \
52 STAGING_LIBDIR=${STAGING_LIBDIR} \
53 STAGING_INCDIR=${STAGING_INCDIR} \
54 STAGING_BASELIBDIR=${STAGING_BASELIBDIR} \
55 "
56
57do_configure_append() {
58 rm -f ${S}/Makefile.orig
59 autoreconf -Wcross --verbose --install --force --exclude=autopoint ../Python-${PV}/Modules/_ctypes/libffi
60}
61
62do_compile() {
63 # regenerate platform specific files, because they depend on system headers
64 cd ${S}/Lib/plat-linux2
65 include=${STAGING_INCDIR} ${STAGING_BINDIR_NATIVE}/python-native/python \
66 ${S}/Tools/scripts/h2py.py -i '(u_long)' \
67 ${STAGING_INCDIR}/dlfcn.h \
68 ${STAGING_INCDIR}/linux/cdrom.h \
69 ${STAGING_INCDIR}/netinet/in.h \
70 ${STAGING_INCDIR}/sys/types.h
71 sed -e 's,${STAGING_DIR_HOST},,g' -i *.py
72 cd -
73
74 # remove any bogus LD_LIBRARY_PATH
75 sed -i -e s,RUNSHARED=.*,RUNSHARED=, Makefile
76
77 if [ ! -f Makefile.orig ]; then
78 install -m 0644 Makefile Makefile.orig
79 fi
80 sed -i -e 's#^LDFLAGS=.*#LDFLAGS=${LDFLAGS} -L. -L${STAGING_LIBDIR}#g' \
81 -e 's,libdir=${libdir},libdir=${STAGING_LIBDIR},g' \
82 -e 's,libexecdir=${libexecdir},libexecdir=${STAGING_DIR_HOST}${libexecdir},g' \
83 -e 's,^LIBDIR=.*,LIBDIR=${STAGING_LIBDIR},g' \
84 -e 's,includedir=${includedir},includedir=${STAGING_INCDIR},g' \
85 -e 's,^INCLUDEDIR=.*,INCLUDE=${STAGING_INCDIR},g' \
86 -e 's,^CONFINCLUDEDIR=.*,CONFINCLUDE=${STAGING_INCDIR},g' \
87 Makefile
88 # save copy of it now, because if we do it in do_install and
89 # then call do_install twice we get Makefile.orig == Makefile.sysroot
90 install -m 0644 Makefile Makefile.sysroot
91
92 export CROSS_COMPILE="${TARGET_PREFIX}"
93 export PYTHONBUILDDIR="${B}"
94
95 oe_runmake OPT="${CFLAGS}"
96}
97
98do_install() {
99 # make install needs the original Makefile, or otherwise the inclues would
100 # go to ${D}${STAGING...}/...
101 install -m 0644 Makefile.orig Makefile
102
103 export CROSS_COMPILE="${TARGET_PREFIX}"
104 export PYTHONBUILDDIR="${B}"
105
106 # After swizzling the makefile, we need to run the build again.
107 # install can race with the build so we have to run this first, then install
108 oe_runmake DESTDIR=${D} LIBDIR=${libdir}
109
110 oe_runmake DESTDIR=${D} LIBDIR=${libdir} install
111
112 install -m 0644 Makefile.sysroot ${D}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
113
114 if [ -e ${WORKDIR}/sitecustomize.py ]; then
115 install -m 0644 ${WORKDIR}/sitecustomize.py ${D}/${libdir}/python${PYTHON_MAJMIN}
116 fi
117
118 oe_multilib_header python${PYTHON_MAJMIN}/pyconfig.h
119
120 if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'bdb', d)}" ]; then
121 rm -rf ${D}/${libdir}/python${PYTHON_MAJMIN}/bsddb
122 fi
123
124 # Python 3.x version of 2to3 is now the default
125 mv ${D}/${bindir}/2to3 ${D}/${bindir}/2to3-${PYTHON_MAJMIN}
126}
127
128do_install_append_class-nativesdk () {
129 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'
130}
131
132SSTATE_SCAN_FILES += "Makefile"
133PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
134
135py_package_preprocess () {
136 # copy back the old Makefile to fix target package
137 install -m 0644 ${B}/Makefile.orig ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile
138
139 # Remove references to buildmachine paths in target Makefile and _sysconfigdata
140 sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
141 -e 's|${DEBUG_PREFIX_MAP}||g' \
142 -e 's:${HOSTTOOLS_DIR}/::g' \
143 -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
144 -e 's:${RECIPE_SYSROOT}::g' \
145 -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \
146 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/config/Makefile \
147 ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py
148 (cd ${PKGD}; python -m py_compile ./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py)
149}
150
151PACKAGES_remove = "${PN}"
152
153# manual dependency additions
154RPROVIDES_${PN}-modules = "${PN}"
155RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python-modules"
156RRECOMMENDS_${PN}-crypt = "openssl"
157
158# package libpython2
159PACKAGES =+ "lib${BPN}2"
160FILES_lib${BPN}2 = "${libdir}/libpython*.so.*"
161
162# catch all the rest (unsorted)
163PACKAGES += "${PN}-misc"
164FILES_${PN}-misc = "${libdir}/python${PYTHON_MAJMIN}"
165RDEPENDS_${PN}-modules += "${PN}-misc"
166
167# ptest
168RDEPENDS_${PN}-ptest = "${PN}-modules ${PN}-tests unzip tzdata-europe coreutils sed"
169RDEPENDS_${PN}-tkinter += "${@bb.utils.contains('PACKAGECONFIG', 'tk', 'tk tk-lib', '', d)}"
170# catch manpage
171PACKAGES += "${PN}-man"
172FILES_${PN}-man = "${datadir}/man"
173
174# Nasty but if bdb isn't enabled the package won't be generated
175RDEPENDS_${PN}-modules_remove = "${@bb.utils.contains('PACKAGECONFIG', 'bdb', '', '${PN}-bsddb', d)}"
176
177RDEPENDS_${PN}-dev = ""
178
179BBCLASSEXTEND = "nativesdk"
180
181# We want bytecode precompiled .py files (.pyc's) by default
182# but the user may set it on their own conf
183
184INCLUDE_PYCS ?= "1"
185
186python(){
187 import collections, json
188
189 filename = os.path.join(d.getVar('THISDIR'), 'python', 'python2-manifest.json')
190 # This python changes the datastore based on the contents of a file, so mark
191 # that dependency.
192 bb.parse.mark_dependency(d, filename)
193
194 with open(filename) as manifest_file:
195 manifest_str = manifest_file.read()
196 json_start = manifest_str.find('# EOC') + 6
197 manifest_file.seek(json_start)
198 manifest_str = manifest_file.read()
199 python_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict)
200
201 include_pycs = d.getVar('INCLUDE_PYCS')
202
203 packages = d.getVar('PACKAGES').split()
204 pn = d.getVar('PN')
205
206 newpackages=[]
207
208 for key in python_manifest:
209 pypackage= pn + '-' + key
210
211 if pypackage not in packages:
212 # We need to prepend, otherwise python-misc gets everything
213 # so we use a new variable
214 newpackages.append(pypackage)
215
216 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
217 d.setVar('FILES_' + pypackage, '')
218 for value in python_manifest[key]['files']:
219 d.appendVar('FILES_' + pypackage, ' ' + value)
220 if include_pycs == '1':
221 if value.endswith('.py'):
222 d.appendVar('FILES_' + pypackage, ' ' + value + '?')
223
224 for value in python_manifest[key]['rdepends']:
225 # Make it work with or without $PN
226 if '${PN}' in value:
227 value=value.split('-')[1]
228 d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
229 d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary'])
230
231 # Prepending so to avoid python-misc getting everything
232 packages = newpackages + packages
233 d.setVar('PACKAGES', ' '.join(packages))
234 d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
235}
236
237# Files needed to create a new manifest
238SRC_URI += "file://create_manifest2.py file://get_module_deps2.py file://python2-manifest.json"
239
240do_create_manifest() {
241 # This task should be run with every new release of Python.
242 # We must ensure that PACKAGECONFIG enables everything when creating
243 # a new manifest, this is to base our new manifest on a complete
244 # native python build, containing all dependencies, otherwise the task
245 # wont be able to find the required files.
246 # e.g. BerkeleyDB is an optional build dependency so it may or may not
247 # be present, we must ensure it is.
248
249 cd ${WORKDIR}
250 # This needs to be executed by python-native and NOT by HOST's python
251 nativepython create_manifest2.py
252 cp python2-manifest.json.new ${THISDIR}/python/python2-manifest.json
253}
254
255# bitbake python -c create_manifest
256addtask do_create_manifest
257
258# Make sure we have native python ready when we create a new manifest
259do_create_manifest[depends] += "python:do_prepare_recipe_sysroot"
260do_create_manifest[depends] += "python:do_patch"