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 via email to