Commit Graph

12 Commits

Author SHA1 Message Date
Ross Burton
e5ab3817aa classes/setuptools_build_meta: rename to python_setuptools_build_meta
Rename this class to be python-prefixed to match the other new Python
build system classes.

(From OE-Core rev: 25d6bf8079797906bde7c0cf63a0466c981ba5bb)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-20 00:02:22 +00:00
Ross Burton
00bc2e68f9 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>
2022-03-16 08:48:09 +00:00
Ross Burton
a50bf48f90 meta: rename pip_install_wheel.bbclass to python_pep517.bbclass
pip_install_wheel shouldn't restricted to just using Pip to install
wheels (the installer module is simplier and likely a better option),
and in the future may be extended to also provide do_compile() using
the build module.

(From OE-Core rev: 3bdf64b97facce9706cc579bdbc9a80e0d48428f)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-13 12:23:48 +00:00
Ross Burton
5331d29a89 pip_install_wheel: add a generic do_install for bootstrapping
Several recipes are duplicating the same bootstrap logic for installing
a wheel without using any tools.  Add an implementation to
pip_install_wheel to centralise the code, and remove the duplicated code
from the following recipes:

- python3-flit-core
- python3-pip
- python3-setuptools
- python3-wheel

(From OE-Core rev: d5d702a2cd06f863340f8e4cdce0904c9d86384d)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-11 06:56:01 +00:00
Ross Burton
7f1c3b4202 python3-pip: remove redundant DEPENDS on python3-setuptools-native
This recipe inherits setuptools_build_meta which already depends on
python3-setuptools-native.

(From OE-Core rev: 5d514b5dbd09ce059047d849d5b7cc2b2327564d)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-11 06:56:01 +00:00
Ross Burton
7f4c9a6343 python3-pip: clean up PYPA_WHEEL usage
There's no need to set PYPA_WHEEL as the default is sufficient.

Remove the use of PYPA_WHEEL in the native do_install() as this variable
will be disappearing shortly.

Remove the bbfatal_log in the native do_install(), if this breaks then
something has gone very wrong and the user is not expected to fix it.

(From OE-Core rev: b74d1c30d000c258c3f89ee125ae79ff07c25674)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-09 11:46:28 +00:00
Ross Burton
17b0f1ecc6 python3-pip: remove obsolete and confusing comment
This comment is very obsolete.

(From OE-Core rev: 147875f0bf7b68694c0338b6f212b03bfdca2ea8)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-08 09:44:27 +00:00
Richard Purdie
228c3b3562 python3-pip: Improve reproducibility
Pip installed wheels are not reproducible currently. The direct_url
files encode an installation path and the installed wheels compile
the python files at their location, not their final install location
which is incorrect.

To fix this, simply disable the direct_urls and pass the "root" to
the python compile function to strip that path out of the compiled
files.

(From OE-Core rev: 2c74d5346e7581949fbdebc4744c8317236221c3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-25 15:07:50 +00:00
Tim Orling
3a4f842307 python3-pip-native: install scripts in ${bindir}
The naïve approach of simply unzipping the built wheel is not
sufficient. 'pip install' would normally have created the
[console_scripts] from entry-points.txt in ${D}${bindir}.

For bootstrapping purposes, hardcode the scripts and install them into
${D}${bindir}. Skip the ${bindir}/pip variant.

[YOCTO #14739]

(From OE-Core rev: 5b58328b610273fea42c144cd590e638c0dc1e4e)

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-25 15:07:50 +00:00
Richard Purdie
d98a804617 python3-pip: Don't change shebang
Patch pip to disable shebang mangling and also force the python executable
to be python3 from the environment when building anything for the target
(or nativesdk).

(From OE-Core rev: 8ceb0bec18422818dcdb0efecec08ed155dc4715)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-25 15:07:50 +00:00
Tim Orling
5c46eeb375 python3-pip: inherit setuptools_build_meta
Upstream provides a pyproject.toml which declares setuptools.build_meta
as the backend for PEP-517 packaging.

We bootstrap the -native installation by simply unzipping the wheel to
PYTHON_SITEPACKAGES_DIR, so that all other recipes can use pip to
install wheels (as intended by upstream).

Check for presence of ${D}${bindir}/pip and remove if found (this was
originally to make sure Python2 pip was the default).

[YOCTO #14638]

(From OE-Core rev: 082fb72ed1683a699ef4bc2c92aa987ce9c46509)

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-25 15:07:50 +00:00
wangmy
3978b4f519 python3-pip: upgrade 22.0.2 -> 22.0.3
Changelog:
=========
Features
-------
Print the exception via rich.traceback, when running with --debug. (#10791)

Bug Fixes
---------
Only calculate topological installation order, for packages that are going to
be installed/upgraded.

This fixes an AssertionError that occured when determining installation order,
for a very specific combination of upgrading-already-installed-package + change
of dependencies + fetching some packages from a package index. This combination
was especially common in Read the Docs' builds. (#10851)

Use html.parser by default, instead of falling back to html5lib when
--use-deprecated=html5lib is not passed. (#10869)

Improved Documentation
----------------------
Clarify that using per-requirement overrides disables the usage of wheels. (#9674)

(From OE-Core rev: 72874df0a76869c21a28908597a6ea04213d1aeb)

Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-10 10:32:08 +00:00