On 21/08/14 02:05PM, Stuart Henderson wrote:
...
>
> That's not quite right, it needs to do the following:
>
> - if the port is python 2 only, set MODPY_VERSION = ${MODPY_DEFAULT_VERSION_2}
>
> - if the port is python 3 only, set FLAVOR = python3 / FLAVORS = python3
>
> - undecided about ports which support py2+3; I think at this point we should
> probably treat them the same as py3-only because we don't really want to be
> importing new py2 ports, i.e. also FLAVOR = python3 / FLAVORS = python3
Thanks for your feedback, I made a new patch aims to do the above. I
tested it on a few different PyPI packages and the output Makefile
matched my expectation. However since I'm not exactly sure how portgen
worked, it probably needs more tweaking.
> (Related issue with portgen, get_deps returns all deps, it should skip py2
> deps for a py3 port, otherwise it tries to create ports for things which
> are unused in py3-land because they're part of python itself, it would
> be nice to solve this automatically, but at least it means that when
> portgen-created ports are reviewed that should be taken into account).
>
I worked on this for a bit, but it's been quite difficult as I can't
debug portgen effectively, do you know if there is a way to trace it?
(e.g. like `bash -x`)
P.S. I left the Makefile template untouched since it seems to be for
ordering things only.
Index: PyPI.pm
===================================================================
RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port/PyPI.pm,v
retrieving revision 1.19
diff -u -r1.19 PyPI.pm
--- PyPI.pm 30 Apr 2020 23:04:48 -0000 1.19
+++ PyPI.pm 19 Aug 2021 08:44:56 -0000
@@ -114,16 +114,13 @@
@{ $di->{info}{classifiers} };
};
- if ( @versions > 1 ) {
- shift @versions; # remove default, lowest
- $self->{reset_values}{MODPY_VERSION} = 1;
+ if ( @versions > 1 ) { # support both py2/py3
+ shift @versions; # remove lowest version, use py3 only
$self->set_other( 'FLAVORS', "python$_" ) for @versions;
$self->set_other( 'FLAVOR', "python$versions[-1]" );
- } elsif ( @versions && $versions[0] != 2 ) {
- $self->{reset_values}{$_} = 1 for qw( FLAVORS FLAVOR );
+ } elsif ( @versions && $versions[0] == 2 ) { # python2 only
$self->set_other(
- MODPY_VERSION => "\${MODPY_DEFAULT_VERSION_$_}" )
- for @versions;
+ MODPY_VERSION => "\${MODPY_DEFAULT_VERSION_$versions[0]}" )
}
}