On Sat, Apr 20, 2019 at 10:04:38PM -0700, Andrew Hewus Fresh wrote:
> On Sat, Apr 20, 2019 at 10:39:28PM -0400, Daniel Jakots wrote:
> > On Sat, 20 Apr 2019 19:22:07 -0700, Andrew Hewus Fresh
> > <[email protected]> wrote:
> >
> > > tl;dr, fixes portgen(1) for python modules that have distnames that
> > > start with py-.
> >
> > Thanks for working on that!
> >
> > One suggestion, does a DISTNAME of "python-foo" is renamed to "py-foo"
> > by portgen(1)?
> >
> > The first result (as an example) in my grep is archivers/py-lzo:
> > MODPY_EGG_VERSION = 1.08
> > DISTNAME = python-lzo-${MODPY_EGG_VERSION}
> > PKGNAME = py-lzo-${MODPY_EGG_VERSION}
> >
> > I haven't tested it but it would be great if it worked :)
>
> Here, give it a try :-) The other change is committed so you will have
> to cvs up.
I guess we should also name the port directory correctly, not just fix
the PKGNAME.
Index: infrastructure/lib/OpenBSD/PortGen//Port/PyPI.pm
===================================================================
RCS file: /cvs/ports/infrastructure/lib/OpenBSD/PortGen/Port/PyPI.pm,v
retrieving revision 1.2
diff -u -p -r1.2 PyPI.pm
--- infrastructure/lib/OpenBSD/PortGen//Port/PyPI.pm 21 Apr 2019 03:47:40
-0000 1.2
+++ infrastructure/lib/OpenBSD/PortGen//Port/PyPI.pm 21 Apr 2019 20:05:14
-0000
@@ -52,6 +52,7 @@ sub name_new_port
my ( $self, $di ) = @_;
my $name = $di->{info}{name};
+ $name =~ s/^python-/py-/;
$name = "py-$name" unless $name =~ /^py-/;
return "pypi/$name";
@@ -66,8 +67,13 @@ sub fill_in_makefile
$self->set_comment( $di->{info}{summary} );
$self->set_other( 'MODPY_EGG_VERSION', $di->{info}{version} );
$self->set_distname( "$di->{info}{name}" . '-${MODPY_EGG_VERSION}' );
- $self->set_other( 'PKGNAME', 'py-${DISTNAME}' )
- unless $di->{info}->{name} =~ /^py-/;
+ my $pkgname = $di->{info}->{name};
+ if ($pkgname =~ /^python-/) {
+ $self->set_other( 'PKGNAME', '${DISTNAME:S/^python-/py-/}' );
+ }
+ elsif ($pkgname !~ /^py-/) {
+ $self->set_other( 'PKGNAME', 'py-${DISTNAME}' );
+ }
$self->set_modules('lang/python');
$self->set_categories('pypi');
$self->set_other( 'HOMEPAGE', $di->{info}{home_page} );