Commit Graph

7 Commits

Author SHA1 Message Date
Ross Burton
c4b75fe913 python_pep517: use picobuild instead of manually calling the API
Calling the PEP-517 API directly mostly works, but sometimes doesn't.
For example we don't verify build dependencies, which led to the cbor2
ugprade silently failing to actually package anything.

The standard frontend is pypa/build, but for source-based distributions
that can be annoying to build as it depends on the following packages:

- tomli
- pep517
- packaging
- pyparsing

Manually bootstrapping those recipes is possible, but tedious.

Picobuild is another frontend (written by myself) which is designed
explicitly to be used programatically by source-based distributions: it
doesn't support builds inside virtual environments as we're building
distribution packages, and it vendors the dependencies for bootstrapping
if they're not available.

Over time more packages are expected to move to using Flit to build
which makes the bootstrapping process slightly easier, and tomli will be
integrated into Python 3.11, so it's possible that in the future we
drop picobuild and switch to build.

This change means the PEP517_BUILD_API variable is obsolete, so remove
it.

(From OE-Core rev: 35104958181d18fd67b73943b9310c813d62b14d)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-07-14 23:22:10 +01:00
Ross Burton
7fee41dcef classes/python_pep517: consolidate stub do_configure
As PEP517 doesn't have an explicit configure step, we can stub out the
do_configure task once instead of the calling classes doing it.

(From OE-Core rev: fd17edbd00f1583eb9e1912ab269dd4dc2631a6f)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-17 16:44:33 +00:00
Ross Burton
0f31b46827 classes/python_pep517: add more comments
Remove mention of prebuilt wheels, this is for the full PEP517 build
process and recipes that want to install prebuilt wheels can use
pypa/installer directly.

(From OE-Core rev: d42664a5b5fb460185be996428dbaba6bb81ec3f)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-17 16:44:33 +00:00
Ross Burton
4f22a746d8 classes/python_pep517: implement a standard do_compile
As all PEP517-compliant build systems have a universal API, we can ask
that users of this class set PEP517_BUILD_API to the class that implements
this API and call it ourselves, instead of users needing to implement
near-identical do_compile tasks themselves.

(From OE-Core rev: 862f68f3a05ce48834f4903d9f9a213684061779)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-03-17 16:44:33 +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
f2a0c52f65 python_pep517: move PEP517_SOURCE_PATH to python_pep517
Now we have the start of a PEP-517 base class, the PEP517_SOURCE_PATH
variable can be defined in there instead of the classes that use it.

(From OE-Core rev: 69944121f49f613568bf0c62ae6b3b47af195dbe)

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
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