This patch notices if there are any capital letters in the DISTNAME and
if so, it adds the :L to convert to lowercase.

I couldn't test the python- part because I didn't find any modules like
that, but I think it should work.

I noticed this missing with py-pylons.

Comments, OK?

diff --git a/lib/OpenBSD/PortGen/Port/PyPI.pm b/lib/OpenBSD/PortGen/Port/PyPI.pm
index 56a63e7..6b0ff37 100644
--- a/lib/OpenBSD/PortGen/Port/PyPI.pm
+++ b/lib/OpenBSD/PortGen/Port/PyPI.pm
@@ -71,11 +71,13 @@ sub fill_in_makefile
        $self->set_other( 'MODPY_EGG_VERSION', $di->{info}{version} );
        $self->set_distname( "$di->{info}{name}" . '-${MODPY_EGG_VERSION}' );
        my $pkgname = $di->{info}->{name};
+       my $to_lower = $pkgname =~ /[[:upper:]]/ ? ':L' : '';
        if ($pkgname =~ /^python-/) {
-               $self->set_other( 'PKGNAME', '${DISTNAME:S/^python-/py-/}' );
+               $self->set_other( 'PKGNAME',
+                   "\${DISTNAME:S/^python-/py-/$to_lower}" );
        }
        elsif ($pkgname !~ /^py-/) {
-               $self->set_other( 'PKGNAME', 'py-${DISTNAME}' );
+               $self->set_other( 'PKGNAME', "py-\${DISTNAME$to_lower}" );
        }
        $self->set_modules('lang/python');
        $self->set_other( 'HOMEPAGE', $di->{info}{home_page} );

Reply via email to