pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[.joined/pkgsrc/trunk]: .joined/pkgsrc/pkgtools/url2pkg url2pkg: improve MAST...
details: https://anonhg.NetBSD.org/.joined/pkgsrc/rev/8754c6994281
branches: trunk
changeset: 370885:8754c6994281
user: rillig <rillig%pkgsrc.org@localhost>
date: Sat Jan 01 15:29:14 2022 +0000
description:
url2pkg: improve MASTER_SITES and HOMEPAGE for PyPI packages
https://mail-index.netbsd.org/tech-pkg/2021/12/31/msg025908.html
Bump version.
diffstat:
pkgtools/url2pkg/Makefile | 4 ++--
pkgtools/url2pkg/files/url2pkg.8 | 4 ++--
pkgtools/url2pkg/files/url2pkg.py | 27 +++++++++++++++++++++++++--
pkgtools/url2pkg/files/url2pkg_test.py | 10 +++-------
4 files changed, 32 insertions(+), 13 deletions(-)
diffs (112 lines):
diff -r ca29e39a236c -r 8754c6994281 pkgtools/url2pkg/Makefile
--- a/pkgtools/url2pkg/Makefile Sat Jan 01 15:21:14 2022 +0000
+++ b/pkgtools/url2pkg/Makefile Sat Jan 01 15:29:14 2022 +0000
@@ -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@localhost
diff -r ca29e39a236c -r 8754c6994281 pkgtools/url2pkg/files/url2pkg.8
--- a/pkgtools/url2pkg/files/url2pkg.8 Sat Jan 01 15:21:14 2022 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.8 Sat Jan 01 15:29:14 2022 +0000
@@ -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
diff -r ca29e39a236c -r 8754c6994281 pkgtools/url2pkg/files/url2pkg.py
--- a/pkgtools/url2pkg/files/url2pkg.py Sat Jan 01 15:21:14 2022 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.py Sat Jan 01 15:29:14 2022 +0000
@@ -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 @@
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 @@
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 @@
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):
diff -r ca29e39a236c -r 8754c6994281 pkgtools/url2pkg/files/url2pkg_test.py
--- a/pkgtools/url2pkg/files/url2pkg_test.py Sat Jan 01 15:21:14 2022 +0000
+++ b/pkgtools/url2pkg/files/url2pkg_test.py Sat Jan 01 15:29:14 2022 +0000
@@ -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 @@
'',
'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@localhost',
- # 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)',
'',
Home |
Main Index |
Thread Index |
Old Index