portgen following MODPY_VERSION flip

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

portgen following MODPY_VERSION flip

Stuart Henderson
Here's a first cut at fixing python version handling in portgen
now the default has changed to MODPY_DEFAULT_VERSION_3.

For a port with just a py3 version it currently uses

FLAVORS = python3
FLAVOR ?= python3

It ought to use

FLAVORS = python3
FLAVOR = python3

but I can't figure out where it's deciding to use ?= instead of =.
Does anyone see where that's coming from?


Index: infrastructure/lib/OpenBSD/PortGen/Port/PyPI.pm
===================================================================
RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port/PyPI.pm,v
retrieving revision 1.19
diff -u -p -r1.19 PyPI.pm
--- infrastructure/lib/OpenBSD/PortGen//Port/PyPI.pm 30 Apr 2020 23:04:48 -0000 1.19
+++ infrastructure/lib/OpenBSD/PortGen//Port/PyPI.pm 23 Feb 2021 19:54:18 -0000
@@ -115,15 +115,20 @@ sub fill_in_makefile
  };
 
  if ( @versions > 1 ) {
+ # XXX needs more when there's something other than just 2+3
  shift @versions;    # remove default, lowest
  $self->{reset_values}{MODPY_VERSION} = 1;
  $self->set_other( 'FLAVORS', "python$_" ) for @versions;
  $self->set_other( 'FLAVOR', "python$versions[-1]" );
- } elsif ( @versions && $versions[0] != 2 ) {
+ } elsif ( @versions && $versions[0] == 2 ) {
  $self->{reset_values}{$_} = 1 for qw( FLAVORS FLAVOR );
  $self->set_other(
  MODPY_VERSION => "\${MODPY_DEFAULT_VERSION_$_}" )
     for @versions;
+ } else {
+ $self->{reset_values}{MODPY_VERSION} = 1;
+ $self->set_other( 'FLAVORS', "python$_" ) for @versions;
+ $self->set_other( 'FLAVOR', "python$versions[-1]" );
  }
 }
 

Reply | Threaded
Open this post in threaded view
|

Re: portgen following MODPY_VERSION flip

Kurt Mosiejczuk-9
On Tue, Feb 23, 2021 at 07:59:34PM +0000, Stuart Henderson wrote:
> Here's a first cut at fixing python version handling in portgen
> now the default has changed to MODPY_DEFAULT_VERSION_3.

> For a port with just a py3 version it currently uses

> FLAVORS = python3
> FLAVOR ?= python3

> It ought to use

> FLAVORS = python3
> FLAVOR = python3

> but I can't figure out where it's deciding to use ?= instead of =.
> Does anyone see where that's coming from?

I have a vague recollection that the "=" versus "?=" thing is handled in
some of the support libraries above the language-specific stuff.

--Kurt

>
> Index: infrastructure/lib/OpenBSD/PortGen/Port/PyPI.pm
> ===================================================================
> RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port/PyPI.pm,v
> retrieving revision 1.19
> diff -u -p -r1.19 PyPI.pm
> --- infrastructure/lib/OpenBSD/PortGen//Port/PyPI.pm 30 Apr 2020 23:04:48 -0000 1.19
> +++ infrastructure/lib/OpenBSD/PortGen//Port/PyPI.pm 23 Feb 2021 19:54:18 -0000
> @@ -115,15 +115,20 @@ sub fill_in_makefile
>   };
>  
>   if ( @versions > 1 ) {
> + # XXX needs more when there's something other than just 2+3
>   shift @versions;    # remove default, lowest
>   $self->{reset_values}{MODPY_VERSION} = 1;
>   $self->set_other( 'FLAVORS', "python$_" ) for @versions;
>   $self->set_other( 'FLAVOR', "python$versions[-1]" );
> - } elsif ( @versions && $versions[0] != 2 ) {
> + } elsif ( @versions && $versions[0] == 2 ) {
>   $self->{reset_values}{$_} = 1 for qw( FLAVORS FLAVOR );
>   $self->set_other(
>   MODPY_VERSION => "\${MODPY_DEFAULT_VERSION_$_}" )
>      for @versions;
> + } else {
> + $self->{reset_values}{MODPY_VERSION} = 1;
> + $self->set_other( 'FLAVORS', "python$_" ) for @versions;
> + $self->set_other( 'FLAVOR', "python$versions[-1]" );
>   }
>  }
>  
>

Reply | Threaded
Open this post in threaded view
|

Re: portgen following MODPY_VERSION flip

Stuart Henderson
On 2021/02/23 15:32, Kurt Mosiejczuk wrote:

> On Tue, Feb 23, 2021 at 07:59:34PM +0000, Stuart Henderson wrote:
> > Here's a first cut at fixing python version handling in portgen
> > now the default has changed to MODPY_DEFAULT_VERSION_3.
>
> > For a port with just a py3 version it currently uses
>
> > FLAVORS = python3
> > FLAVOR ?= python3
>
> > It ought to use
>
> > FLAVORS = python3
> > FLAVOR = python3
>
> > but I can't figure out where it's deciding to use ?= instead of =.
> > Does anyone see where that's coming from?
>
> I have a vague recollection that the "=" versus "?=" thing is handled in
> some of the support libraries above the language-specific stuff.

Oh...it copies it from /usr/ports/infrastructure/templates/Makefile.template

Hmmmmm