Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified)) by mollari.NetBSD.org (Postfix) with ESMTPS id 166121A923C for ; Sat, 1 Jan 2022 15:29:17 +0000 (UTC) Received: by mail.netbsd.org (Postfix, from userid 605) id 2225F84D53; Sat, 1 Jan 2022 15:29:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 5615B84D50 for ; Sat, 1 Jan 2022 15:29:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([IPv6:::1]) by localhost (mail.netbsd.org [IPv6:::1]) (amavisd-new, port 10025) with ESMTP id LW1uBlX8Xn0R for ; Sat, 1 Jan 2022 15:29:14 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.netbsd.org [199.233.217.197]) by mail.netbsd.org (Postfix) with ESMTP id 7898E84D22 for ; Sat, 1 Jan 2022 15:29:14 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id 6B4D7FAEC; Sat, 1 Jan 2022 15:29:14 +0000 (UTC) Content-Transfer-Encoding: 7bit Content-Type: multipart/mixed; boundary="_----------=_1641050954136830" MIME-Version: 1.0 Date: Sat, 1 Jan 2022 15:29:14 +0000 From: "Roland Illig" Subject: CVS commit: pkgsrc/pkgtools/url2pkg To: pkgsrc-changes@NetBSD.org Reply-To: rillig@netbsd.org X-Mailer: log_accum Message-Id: <20220101152914.6B4D7FAEC@cvs.NetBSD.org> Sender: pkgsrc-changes-owner@NetBSD.org List-Id: Precedence: bulk List-Unsubscribe: This is a multi-part message in MIME format. --_----------=_1641050954136830 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Module Name: pkgsrc Committed By: rillig Date: Sat Jan 1 15:29:14 UTC 2022 Modified Files: pkgsrc/pkgtools/url2pkg: Makefile pkgsrc/pkgtools/url2pkg/files: url2pkg.8 url2pkg.py url2pkg_test.py Log Message: url2pkg: improve MASTER_SITES and HOMEPAGE for PyPI packages https://mail-index.netbsd.org/tech-pkg/2021/12/31/msg025908.html Bump version. To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 pkgsrc/pkgtools/url2pkg/Makefile cvs rdiff -u -r1.15 -r1.16 pkgsrc/pkgtools/url2pkg/files/url2pkg.8 cvs rdiff -u -r1.34 -r1.35 pkgsrc/pkgtools/url2pkg/files/url2pkg.py cvs rdiff -u -r1.35 -r1.36 pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. --_----------=_1641050954136830 Content-Disposition: inline Content-Length: 4551 Content-Transfer-Encoding: binary Content-Type: text/x-diff; charset=us-ascii Modified files: Index: pkgsrc/pkgtools/url2pkg/Makefile diff -u pkgsrc/pkgtools/url2pkg/Makefile:1.122 pkgsrc/pkgtools/url2pkg/Makefile:1.123 --- pkgsrc/pkgtools/url2pkg/Makefile:1.122 Sat Jan 1 14:04:11 2022 +++ pkgsrc/pkgtools/url2pkg/Makefile Sat Jan 1 15:29:14 2022 @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.122 2022/01/01 14:04:11 rillig Exp $ +# $NetBSD: Makefile,v 1.123 2022/01/01 15:29:14 rillig Exp $ -PKGNAME= url2pkg-21.4.0 +PKGNAME= url2pkg-21.4.1 CATEGORIES= pkgtools MAINTAINER= rillig@NetBSD.org Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.8 diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.8:1.15 pkgsrc/pkgtools/url2pkg/files/url2pkg.8:1.16 --- pkgsrc/pkgtools/url2pkg/files/url2pkg.8:1.15 Sat Jan 1 14:04:11 2022 +++ pkgsrc/pkgtools/url2pkg/files/url2pkg.8 Sat Jan 1 15:29:14 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: url2pkg.8,v 1.15 2022/01/01 14:04:11 rillig Exp $ +.\" $NetBSD: url2pkg.8,v 1.16 2022/01/01 15:29:14 rillig Exp $ .\" .\" Copyright (c) 2001, 2019 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -36,7 +36,7 @@ .Sh SYNOPSIS .Nm .Op Fl v|--verbose -.Op Ar URL +.Ar URL .Sh DESCRIPTION .Nm takes the Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.py diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.34 pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.35 --- pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.34 Sat Jan 1 14:04:11 2022 +++ pkgsrc/pkgtools/url2pkg/files/url2pkg.py Sat Jan 1 15:29:14 2022 @@ -1,5 +1,5 @@ #! @PYTHONBIN@ -# $NetBSD: url2pkg.py,v 1.34 2022/01/01 14:04:11 rillig Exp $ +# $NetBSD: url2pkg.py,v 1.35 2022/01/01 15:29:14 rillig Exp $ # Copyright (c) 2019 The NetBSD Foundation, Inc. # All rights reserved. @@ -412,6 +412,28 @@ class Generator: self.homepage = f'https://{project}.sourceforge.net/' self.distfile = filename + def adjust_site_PyPI(self): + pattern = r'''(?x) + ^ + https://files\.pythonhosted\.org/packages/ + ../../.{60}/ # hash + ( # distfile + (.*) # project + -[0-9].* # version + \.tar\.gz + ) + $ + ''' + m = re.search(pattern, self.url) + if not m: + return + + filename, project = m.groups() + self.master_sites = f'${{MASTER_SITE_PYPI:={project[0]}/{project}/}}' + self.homepage = f'https://pypi.org/project/{project}/' + self.distfile = filename + + def adjust_site_GitHub_archive(self): pattern = r'''(?x) ^ @@ -545,6 +567,7 @@ class Generator: self.adjust_site_GitHub_archive() self.adjust_site_GitHub_release() self.foreach_site_from_sites_mk(self.adjust_site_from_sites_mk) + self.adjust_site_PyPI() self.adjust_site_other() self.adjust_everything_else() return self.generate_lines() @@ -1181,7 +1204,7 @@ class Adjuster: def usage(): - sys.exit(f'usage: {sys.argv[0]} [-v|--verbose] [URL]') + sys.exit(f'usage: {sys.argv[0]} [-v|--verbose] URL') def main(argv: List[str], g: Globals): Index: pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.35 pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.36 --- pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.35 Sat Jan 1 15:04:58 2022 +++ pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py Sat Jan 1 15:29:14 2022 @@ -1,4 +1,4 @@ -# $NetBSD: url2pkg_test.py,v 1.35 2022/01/01 15:04:58 rillig Exp $ +# $NetBSD: url2pkg_test.py,v 1.36 2022/01/01 15:29:14 rillig Exp $ import pytest from url2pkg import * @@ -613,14 +613,10 @@ def test_Generator_adjust_site_from_site '', 'DISTNAME= apprise-0.9.6', 'CATEGORIES= pkgtools', - # TODO: ${MASTER_SITE_PYPI:=a/apprise/} - 'MASTER_SITES= https://files.pythonhosted.org/packages/da/8b/' - + '218264f5ce91df1ad27ce8021d51b747ef287627338fe05d170565358546/', + 'MASTER_SITES= ${MASTER_SITE_PYPI:=a/apprise/}', '', 'MAINTAINER= INSERT_YOUR_MAIL_ADDRESS_HERE # or use pkgsrc-users@NetBSD.org', - # TODO: https://pypi.org/project/apprise/ - 'HOMEPAGE= https://files.pythonhosted.org/packages/da/8b/' - + '218264f5ce91df1ad27ce8021d51b747ef287627338fe05d170565358546/', + 'HOMEPAGE= https://pypi.org/project/apprise/', 'COMMENT= TODO: Short description of the package', '#LICENSE= # TODO: (see mk/license.mk)', '', --_----------=_1641050954136830--