summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python_2.7.13.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python_2.7.13.bb')
-rw-r--r--meta/recipes-devtools/python/python_2.7.13.bb88
1 files changed, 86 insertions, 2 deletions
diff --git a/meta/recipes-devtools/python/python_2.7.13.bb b/meta/recipes-devtools/python/python_2.7.13.bb
index 754c029097..dbafb955f9 100644
--- a/meta/recipes-devtools/python/python_2.7.13.bb
+++ b/meta/recipes-devtools/python/python_2.7.13.bb
@@ -1,5 +1,7 @@
1require python.inc 1require python.inc
2
2DEPENDS = "python-native libffi bzip2 gdbm openssl readline sqlite3 zlib" 3DEPENDS = "python-native libffi bzip2 gdbm openssl readline sqlite3 zlib"
4
3PR = "${INC_PR}" 5PR = "${INC_PR}"
4 6
5DISTRO_SRC_URI ?= "file://sitecustomize.py" 7DISTRO_SRC_URI ?= "file://sitecustomize.py"
@@ -145,11 +147,9 @@ py_package_preprocess () {
145 python -m py_compile ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py 147 python -m py_compile ${PKGD}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py
146} 148}
147 149
148require python-${PYTHON_MAJMIN}-manifest.inc
149 150
150# manual dependency additions 151# manual dependency additions
151RPROVIDES_${PN}-core = "${PN}" 152RPROVIDES_${PN}-core = "${PN}"
152RRECOMMENDS_${PN}-core = "${PN}-readline"
153RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python-modules" 153RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python-modules"
154RRECOMMENDS_${PN}-crypt = "openssl" 154RRECOMMENDS_${PN}-crypt = "openssl"
155 155
@@ -193,3 +193,87 @@ FILES_${PN}-man = "${datadir}/man"
193RDEPENDS_${PN}-modules_remove = "${@bb.utils.contains('PACKAGECONFIG', 'bdb', '', '${PN}-bsddb', d)}" 193RDEPENDS_${PN}-modules_remove = "${@bb.utils.contains('PACKAGECONFIG', 'bdb', '', '${PN}-bsddb', d)}"
194 194
195BBCLASSEXTEND = "nativesdk" 195BBCLASSEXTEND = "nativesdk"
196
197RPROVIDES_${PN} += "${PN}-modules"
198
199# We want bytecode precompiled .py files (.pyc's) by default
200# but the user may set it on their own conf
201
202INCLUDE_PYCS ?= "1"
203
204python(){
205
206 pythondir = d.getVar('THISDIR',True)
207
208 # Read JSON manifest
209 import json
210 with open(pythondir+'/python/python2-manifest.json') as manifest_file:
211 python_manifest=json.load(manifest_file)
212
213 include_pycs = d.getVar('INCLUDE_PYCS')
214
215 packages = d.getVar('PACKAGES').split()
216 pn = d.getVar('PN')
217
218
219 newpackages=[]
220
221 for key in python_manifest:
222 pypackage= pn + '-' + key
223
224 if pypackage not in packages:
225 # We need to prepend, otherwise python-misc gets everything
226 # so we use a new variable
227 newpackages.append(pypackage)
228
229 # "Build" python's manifest FILES, RDEPENDS and SUMMARY
230 d.setVar('FILES_' + pypackage, '')
231 for value in python_manifest[key]['files']:
232 d.appendVar('FILES_' + pypackage, ' ' + value)
233 if include_pycs == '1':
234 if value.endswith('.py'):
235 d.appendVar('FILES_' + pypackage, ' ' + value + 'c')
236
237 d.setVar('RDEPENDS_' + pypackage, '')
238 for value in python_manifest[key]['rdepends']:
239 # Make it work with or without $PN
240 if '${PN}' in value:
241 value=value.split('-')[1]
242 d.appendVar('RDEPENDS_' + pypackage, ' ' + pn + '-' + value)
243 d.setVar('SUMMARY_' + pypackage, python_manifest[key]['summary'])
244
245 # We need to ensure staticdev packages match for files first so we sort in reverse
246 newpackages.sort(reverse=True)
247 # Prepending so to avoid python-misc getting everything
248 packages = newpackages + packages
249 d.setVar('PACKAGES', ' '.join(packages))
250 d.setVar('ALLOW_EMPTY_${PN}-modules', '1')
251}
252
253do_split_packages[file-checksums] += "${THISDIR}/python/python2-manifest.json:True"
254
255# Files needed to create a new manifest
256SRC_URI += "file://create_manifest2.py file://get_module_deps2.py file://python2-manifest.json"
257
258do_create_manifest() {
259
260# This task should be run with every new release of Python.
261# We must ensure that PACKAGECONFIG enables everything when creating
262# a new manifest, this is to base our new manifest on a complete
263# native python build, containing all dependencies, otherwise the task
264# wont be able to find the required files.
265# e.g. BerkeleyDB is an optional build dependency so it may or may not
266# be present, we must ensure it is.
267
268cd ${WORKDIR}
269# This needs to be executed by python-native and NOT by HOST's python
270nativepython create_manifest2.py
271cp python2-manifest.json.new ${THISDIR}/python/python2-manifest.json
272}
273
274# bitbake python -c create_manifest
275addtask do_create_manifest
276
277# Make sure we have native python ready when we create a new manifest
278do_create_manifest[depends] += "python:do_prepare_recipe_sysroot"
279do_create_manifest[depends] += "python:do_patch"