diff mbox series

[1/4] scripts:recipetool:create_buildsys_python: fix license note

Message ID 20231018120114.1222475-1-jstephan@baylibre.com
State New
Headers show
Series [1/4] scripts:recipetool:create_buildsys_python: fix license note | expand

Commit Message

Julien Stephan Oct. 18, 2023, 12:01 p.m. UTC
License field of setup is not always standardized, so we usually use the
classifier to determine the correct license format to use in the recipe.

A warning note is added above the LICENSE field of the create recipe
in case a license is provided in setup. But when the plugin is called,
"LICENSE =" is not yet present so we can never display this note.
Replace the "LICENSE =" condition with "##LICENSE_PLACEHOLDER##"
to actually be able to display the note message

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
---
 scripts/lib/recipetool/create_buildsys_python.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexandre Belloni Oct. 18, 2023, 7:58 p.m. UTC | #1
Hello,

On 18/10/2023 14:01:11+0200, Julien Stephan wrote:
> License field of setup is not always standardized, so we usually use the
> classifier to determine the correct license format to use in the recipe.
> 
> A warning note is added above the LICENSE field of the create recipe
> in case a license is provided in setup. But when the plugin is called,
> "LICENSE =" is not yet present so we can never display this note.
> Replace the "LICENSE =" condition with "##LICENSE_PLACEHOLDER##"
> to actually be able to display the note message
> 
> Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> ---
>  scripts/lib/recipetool/create_buildsys_python.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py
> index 92468b22546..d2c7e251bf7 100644
> --- a/scripts/lib/recipetool/create_buildsys_python.py
> +++ b/scripts/lib/recipetool/create_buildsys_python.py
> @@ -254,7 +254,7 @@ class PythonRecipeHandler(RecipeHandler):
>  
>          if license_str:
>              for i, line in enumerate(lines_before):
> -                if line.startswith('LICENSE = '):
> +                if ine.startswith('##LICENSE_PLACEHOLDER##'):

I doubt this parses at all, ine is not declared ;)

>                      lines_before.insert(i, '# NOTE: License in setup.py/PKGINFO is: %s' % license_str)
>                      break
>  
> -- 
> 2.41.0
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#189385): https://lists.openembedded.org/g/openembedded-core/message/189385
> Mute This Topic: https://lists.openembedded.org/mt/102037342/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Julien Stephan Oct. 19, 2023, 7:38 a.m. UTC | #2
Le mer. 18 oct. 2023 à 21:58, Alexandre Belloni
<alexandre.belloni@bootlin.com> a écrit :
>
> Hello,
>
> On 18/10/2023 14:01:11+0200, Julien Stephan wrote:
> > License field of setup is not always standardized, so we usually use the
> > classifier to determine the correct license format to use in the recipe.
> >
> > A warning note is added above the LICENSE field of the create recipe
> > in case a license is provided in setup. But when the plugin is called,
> > "LICENSE =" is not yet present so we can never display this note.
> > Replace the "LICENSE =" condition with "##LICENSE_PLACEHOLDER##"
> > to actually be able to display the note message
> >
> > Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> > ---
> >  scripts/lib/recipetool/create_buildsys_python.py | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py
> > index 92468b22546..d2c7e251bf7 100644
> > --- a/scripts/lib/recipetool/create_buildsys_python.py
> > +++ b/scripts/lib/recipetool/create_buildsys_python.py
> > @@ -254,7 +254,7 @@ class PythonRecipeHandler(RecipeHandler):
> >
> >          if license_str:
> >              for i, line in enumerate(lines_before):
> > -                if line.startswith('LICENSE = '):
> > +                if ine.startswith('##LICENSE_PLACEHOLDER##'):
>
> I doubt this parses at all, ine is not declared ;)

Hello,

:O I completely messed up my rebase, good catch! Fixed in v2.

Thank you alexandre

Cheers
Julien

>
> >                      lines_before.insert(i, '# NOTE: License in setup.py/PKGINFO is: %s' % license_str)
> >                      break
> >
> > --
> > 2.41.0
> >
>
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#189385): https://lists.openembedded.org/g/openembedded-core/message/189385
> > Mute This Topic: https://lists.openembedded.org/mt/102037342/3617179
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
diff mbox series

Patch

diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py
index 92468b22546..d2c7e251bf7 100644
--- a/scripts/lib/recipetool/create_buildsys_python.py
+++ b/scripts/lib/recipetool/create_buildsys_python.py
@@ -254,7 +254,7 @@  class PythonRecipeHandler(RecipeHandler):
 
         if license_str:
             for i, line in enumerate(lines_before):
-                if line.startswith('LICENSE = '):
+                if ine.startswith('##LICENSE_PLACEHOLDER##'):
                     lines_before.insert(i, '# NOTE: License in setup.py/PKGINFO is: %s' % license_str)
                     break