summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3-pip_22.0.3.bb
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2022-03-14 14:39:23 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-16 08:48:09 +0000
commit00bc2e68f98e8a868dac26fe2f45954fbfdc2222 (patch)
treeffbfa554732b8e718fdd2728f708c19956e35b2e /meta/recipes-devtools/python/python3-pip_22.0.3.bb
parentc4cfeb96a337cd7790d18cdbb101a130845efc02 (diff)
downloadpoky-00bc2e68f98e8a868dac26fe2f45954fbfdc2222.tar.gz
python_pep517: use installer instead of pip
Instead of battling pip to install a wheel, use installer. Installer does one thing, so it's faster and easier to work with. This means setuptools, pip, and wheel are no longer part of the bootstrap phase, so they can be built normally. To avoid sysroot file conflicts these three recipes can't install .pyc files to the native sysroot. We currently patch pypa/installer to allow us to override the interpreter used, which means we can drop the interpreter seding. We don't need to recompile any Python which is found in $bindir as Python doesn't actually load those files. Across a build of oe-core, the only differences between using pip and installer are: - the .dist-info/RECORD files are ordered differently - the .dist-info/REQUESTED and INSTALLER files are not created - the hashbang in native scripts is "/usr/bin/env nativepython" instead of pointing directly at the native sysroot python3. (From OE-Core rev: f780f6d920d8bbfb674d6066a8b899417decf8d2) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python3-pip_22.0.3.bb')
-rw-r--r--meta/recipes-devtools/python/python3-pip_22.0.3.bb35
1 files changed, 5 insertions, 30 deletions
diff --git a/meta/recipes-devtools/python/python3-pip_22.0.3.bb b/meta/recipes-devtools/python/python3-pip_22.0.3.bb
index bfeeee789c..9ca8fbc1e5 100644
--- a/meta/recipes-devtools/python/python3-pip_22.0.3.bb
+++ b/meta/recipes-devtools/python/python3-pip_22.0.3.bb
@@ -6,43 +6,14 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=63ec52baf95163b597008bb46db68030"
6 6
7inherit pypi setuptools_build_meta 7inherit pypi setuptools_build_meta
8 8
9DEPENDS += "python3"
10
11# To avoid a dependency loop; we bootstrap -native
12DEPENDS:remove:class-native = "python3-pip-native"
13DEPENDS:append:class-native = " unzip-native"
14
15SRC_URI += "file://0001-change-shebang-to-python3.patch" 9SRC_URI += "file://0001-change-shebang-to-python3.patch"
16SRC_URI += "file://no_shebang_mangling.patch" 10SRC_URI += "file://no_shebang_mangling.patch"
17SRC_URI += "file://reproducible.patch" 11SRC_URI += "file://reproducible.patch"
18 12
19SRC_URI[sha256sum] = "f29d589df8c8ab99c060e68ad294c4a9ed896624f6368c5349d70aa581b333d0" 13SRC_URI[sha256sum] = "f29d589df8c8ab99c060e68ad294c4a9ed896624f6368c5349d70aa581b333d0"
20 14
21do_install:class-native() {
22 python_pep517_do_bootstrap_install
23
24 # pip install would normally generate [console_scripts] in ${bindir}
25 install -d ${D}/${bindir}
26 # We will skip the ${bindir}/pip variant as we would just remove it in the do_install:append
27 cat << EOF >> ${D}/${bindir}/pip3 | tee ${D}/${bindir}/pip${PYTHON_BASEVERSION}
28#!/bin/sh
29'''exec' ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} "\$0" "\$@"
30' '''
31# -*- coding: utf-8 -*-
32import re
33import sys
34from pip._internal.cli.main import main
35if __name__ == '__main__':
36 sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
37 sys.exit(main())
38EOF
39 chmod 0755 ${D}${bindir}/pip3 ${D}${bindir}/pip${PYTHON_BASEVERSION}
40}
41
42do_install:append() { 15do_install:append() {
43 if [ -e ${D}/${bindir}/pip ]; then 16 rm -f ${D}/${bindir}/pip
44 rm ${D}/${bindir}/pip
45 fi
46} 17}
47 18
48RDEPENDS:${PN} = "\ 19RDEPENDS:${PN} = "\
@@ -59,3 +30,7 @@ RDEPENDS:${PN} = "\
59" 30"
60 31
61BBCLASSEXTEND = "native nativesdk" 32BBCLASSEXTEND = "native nativesdk"
33
34# This used to use the bootstrap install which didn't compile. Until we bump the
35# tmpdir version we can't compile the native otherwise the sysroot unpack fails
36INSTALL_WHEEL_COMPILE_BYTECODE:class-native = "--no-compile-bytecode"