Bug 14737

Summary: recipetool/devtool: add support for Python PEP-517 (pyproject.toml and setup.cfg) packages
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Tim Orling <tim.orling>
Component: devtools / tool chainAssignee: Ross Burton <ross.burton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: jstephan, meta.mr.watcher, meta.watcher, randy.macleod, ross.burton, sgw, tvgamblin
Version: 4.0   
Target Milestone: 5.0 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)

Description Tim Orling 2022-02-22 23:03:39 UTC
The current recipetool code only understands 'distutils' and legacy 'setuptools' (setup.py) invocations. We need to check for presence of pyproject.toml and then _if_ it supports proper PEP-517 backend, make a stab at DEPENDS and RDEPENDS.

While we are at it, we should probably remove 'distutils' support completely?
Comment 1 Randy MacLeod 2022-02-24 15:44:26 UTC
Backport to 3.5 if not too invasive.
Comment 2 Tim Orling 2022-02-24 16:38:09 UTC
The first thing that must be changed is the logic at:
https://git.yoctoproject.org/poky/tree/scripts/lib/recipetool/create_buildsys_python.py#n158

        # Check for non-zero size setup.py files
        setupfiles = RecipeHandler.checkfiles(srctree, ['setup.py'])
        for fn in setupfiles:
            if os.path.getsize(fn):
                break
        else:
            return False

This also needs to look for pyproject.toml and setup.cfg files. Based on what files are found, make a decision of how to proceed.

For instance, if a pyproject.toml is present, has a [build-system] section and a build-backend that we know about (have a bbclass for) then the recipe should inherit e.g. flit_core, setuptools_build_meta or poetry_core (WIP).

Looking for dependencies will also need more than one way to handle it, as recipes without setup.py might include such info in setup.cfg or in pyproject.toml.
Comment 3 Julien Stephan 2023-11-22 15:28:00 UTC
merged on https://git.yoctoproject.org/poky/commit/?id=d4debbf5b7ff9e0f489530aa748c559d631eeb57 so closing
Comment 4 Tim Orling 2023-11-22 16:45:10 UTC
ACCEPTED means you have accepted the bug and are working on it. The way to mark a bug as closed is RESOLVED FIXED.
Comment 5 Julien Stephan 2023-11-23 08:06:49 UTC
(In reply to Tim Orling from comment #4)
> ACCEPTED means you have accepted the bug and are working on it. The way to
> mark a bug as closed is RESOLVED FIXED.

got it thank you!
Comment 6 Randy MacLeod 2025-02-14 16:46:24 UTC
bulk change to add Saul's non-WR address.
Comment 7 Randy MacLeod 2025-02-14 16:48:19 UTC
Bulk change: Remove Saul's old WR address.