diff mbox series

[1/1] tools: patman: fix `pip install` with Python 3.12

Message ID 20240604163134.1149752-1-brandon.maier@collins.com
State Changes Requested
Delegated to: Simon Glass
Headers show
Series [1/1] tools: patman: fix `pip install` with Python 3.12 | expand

Commit Message

Brandon Maier June 4, 2024, 4:31 p.m. UTC
Installing patman with `cd ./tools/patman && pip install -e .` fails
with the error below.

As described in the error output, the license line is not allowed to be
only defined in the setup.py.

> $ cd ./tools/patman && pip install -e .
> Obtaining file:///.../u-boot/tools/patman
>   Installing build dependencies ... done
>   Checking if build backend supports build_editable ... done
>   Getting requirements to build editable ... error
>   error: subprocess-exited-with-error
>
>   × Getting requirements to build editable did not run successfully.
>   │ exit code: 1
>   ╰─> [61 lines of output]
>       /tmp/pip-build-env-mqjvnmz8/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:76:
>           _MissingDynamic: `license` defined outside of `pyproject.toml` is ignored.
>       !!
>
>       ********************************************************************************
>       The following seems to be defined outside of `pyproject.toml`:
>
>       `license = 'GPL-2.0+'`
>
>       According to the spec (see the link below), however, setuptools CANNOT
>       consider this value unless `license` is listed as `dynamic`.
>
>       https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table
>
>       To prevent this problem, you can list `license` under `dynamic` or alternatively
>       remove the `[project]` table from your file and rely entirely on other means of
>       configuration.
>       ********************************************************************************
>
>       !!

Signed-off-by: Brandon Maier <brandon.maier@collins.com>
CC: Simon Glass <sjg@chromium.org>
---
 tools/patman/pyproject.toml | 1 +
 1 file changed, 1 insertion(+)

Comments

Simon Glass June 5, 2024, 2:13 a.m. UTC | #1
On Tue, 4 Jun 2024 at 10:31, Brandon Maier <brandon.maier@collins.com> wrote:
>
> Installing patman with `cd ./tools/patman && pip install -e .` fails
> with the error below.
>
> As described in the error output, the license line is not allowed to be
> only defined in the setup.py.
>
> > $ cd ./tools/patman && pip install -e .
> > Obtaining file:///.../u-boot/tools/patman
> >   Installing build dependencies ... done
> >   Checking if build backend supports build_editable ... done
> >   Getting requirements to build editable ... error
> >   error: subprocess-exited-with-error
> >
> >   × Getting requirements to build editable did not run successfully.
> >   │ exit code: 1
> >   ╰─> [61 lines of output]
> >       /tmp/pip-build-env-mqjvnmz8/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:76:
> >           _MissingDynamic: `license` defined outside of `pyproject.toml` is ignored.
> >       !!
> >
> >       ********************************************************************************
> >       The following seems to be defined outside of `pyproject.toml`:
> >
> >       `license = 'GPL-2.0+'`
> >
> >       According to the spec (see the link below), however, setuptools CANNOT
> >       consider this value unless `license` is listed as `dynamic`.
> >
> >       https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table
> >
> >       To prevent this problem, you can list `license` under `dynamic` or alternatively
> >       remove the `[project]` table from your file and rely entirely on other means of
> >       configuration.
> >       ********************************************************************************
> >
> >       !!
>
> Signed-off-by: Brandon Maier <brandon.maier@collins.com>
> CC: Simon Glass <sjg@chromium.org>
> ---
>  tools/patman/pyproject.toml | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass July 1, 2024, 2:34 p.m. UTC | #2
Hi Brandon,

On Wed, 5 Jun 2024 at 03:13, Simon Glass <sjg@chromium.org> wrote:
>
> On Tue, 4 Jun 2024 at 10:31, Brandon Maier <brandon.maier@collins.com> wrote:
> >
> > Installing patman with `cd ./tools/patman && pip install -e .` fails
> > with the error below.
> >
> > As described in the error output, the license line is not allowed to be
> > only defined in the setup.py.
> >
> > > $ cd ./tools/patman && pip install -e .
> > > Obtaining file:///.../u-boot/tools/patman
> > >   Installing build dependencies ... done
> > >   Checking if build backend supports build_editable ... done
> > >   Getting requirements to build editable ... error
> > >   error: subprocess-exited-with-error
> > >
> > >   × Getting requirements to build editable did not run successfully.
> > >   │ exit code: 1
> > >   ╰─> [61 lines of output]
> > >       /tmp/pip-build-env-mqjvnmz8/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:76:
> > >           _MissingDynamic: `license` defined outside of `pyproject.toml` is ignored.
> > >       !!
> > >
> > >       ********************************************************************************
> > >       The following seems to be defined outside of `pyproject.toml`:
> > >
> > >       `license = 'GPL-2.0+'`
> > >
> > >       According to the spec (see the link below), however, setuptools CANNOT
> > >       consider this value unless `license` is listed as `dynamic`.
> > >
> > >       https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table
> > >
> > >       To prevent this problem, you can list `license` under `dynamic` or alternatively
> > >       remove the `[project]` table from your file and rely entirely on other means of
> > >       configuration.
> > >       ********************************************************************************
> > >
> > >       !!
> >
> > Signed-off-by: Brandon Maier <brandon.maier@collins.com>
> > CC: Simon Glass <sjg@chromium.org>
> > ---
> >  tools/patman/pyproject.toml | 1 +
> >  1 file changed, 1 insertion(+)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Unfortunately this causes 'make pip' to fail. Can you please take a look?

Regards,
Simon
Brandon Maier July 1, 2024, 6:06 p.m. UTC | #3
Hi Simon,

On Mon Jul 1, 2024 at 2:34 PM UTC, Simon Glass wrote:
> Hi Brandon,
>
> On Wed, 5 Jun 2024 at 03:13, Simon Glass <sjg@chromium.org> wrote:
> >
> > On Tue, 4 Jun 2024 at 10:31, Brandon Maier <brandon.maier@collins.com> wrote:
> > >
> > > Installing patman with `cd ./tools/patman && pip install -e .` fails
> > > with the error below.
> > >
> > > As described in the error output, the license line is not allowed to be
> > > only defined in the setup.py.
> > >
> > > > $ cd ./tools/patman && pip install -e .
> > > > Obtaining file:///.../u-boot/tools/patman
> > > >   Installing build dependencies ... done
> > > >   Checking if build backend supports build_editable ... done
> > > >   Getting requirements to build editable ... error
> > > >   error: subprocess-exited-with-error
> > > >
> > > >   × Getting requirements to build editable did not run successfully.
> > > >   │ exit code: 1
> > > >   ╰─> [61 lines of output]
> > > >       /tmp/pip-build-env-mqjvnmz8/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:76:
> > > >           _MissingDynamic: `license` defined outside of `pyproject.toml` is ignored.
> > > >       !!
> > > >
> > > >       ********************************************************************************
> > > >       The following seems to be defined outside of `pyproject.toml`:
> > > >
> > > >       `license = 'GPL-2.0+'`
> > > >
> > > >       According to the spec (see the link below), however, setuptools CANNOT
> > > >       consider this value unless `license` is listed as `dynamic`.
> > > >
> > > >       https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table
> > > >
> > > >       To prevent this problem, you can list `license` under `dynamic` or alternatively
> > > >       remove the `[project]` table from your file and rely entirely on other means of
> > > >       configuration.
> > > >       ********************************************************************************
> > > >
> > > >       !!
> > >
> > > Signed-off-by: Brandon Maier <brandon.maier@collins.com>
> > > CC: Simon Glass <sjg@chromium.org>
> > > ---
> > >  tools/patman/pyproject.toml | 1 +
> > >  1 file changed, 1 insertion(+)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Unfortunately this causes 'make pip' to fail. Can you please take a look?

The `make pip` uses `python -m build` which seems to handle this
differently.

I removed the license line from setup.py entirely, as the pyproject doc
says it's not needed if a license classifier is used. That now works
with both `pip install` and `python -m build`.

Thanks,
Brandon

>
> Regards,
> Simon
diff mbox series

Patch

diff --git a/tools/patman/pyproject.toml b/tools/patman/pyproject.toml
index fcefcf66960..9e6079cb57e 100644
--- a/tools/patman/pyproject.toml
+++ b/tools/patman/pyproject.toml
@@ -17,6 +17,7 @@  classifiers = [
     "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
     "Operating System :: OS Independent",
 ]
+dynamic = ["license"]
 
 [project.urls]
 "Homepage" = "https://docs.u-boot.org/en/latest/develop/patman.html"