pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/url2pkg



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sun Aug 13 21:19:02 UTC 2023

Modified Files:
        pkgsrc/pkgtools/url2pkg: Makefile
        pkgsrc/pkgtools/url2pkg/files: url2pkg.py url2pkg_test.py

Log Message:
url2pkg: update to 23.2.0

Changes since 23.1.1:

Resolve dependencies from Python modules in more cases.  Suggested by
Greg Troxel for py-slixmpp.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 pkgsrc/pkgtools/url2pkg/Makefile
cvs rdiff -u -r1.48 -r1.49 pkgsrc/pkgtools/url2pkg/files/url2pkg.py
cvs rdiff -u -r1.44 -r1.45 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.

Modified files:

Index: pkgsrc/pkgtools/url2pkg/Makefile
diff -u pkgsrc/pkgtools/url2pkg/Makefile:1.132 pkgsrc/pkgtools/url2pkg/Makefile:1.133
--- pkgsrc/pkgtools/url2pkg/Makefile:1.132      Sun Jun 11 07:42:16 2023
+++ pkgsrc/pkgtools/url2pkg/Makefile    Sun Aug 13 21:19:01 2023
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.132 2023/06/11 07:42:16 wiz Exp $
+# $NetBSD: Makefile,v 1.133 2023/08/13 21:19:01 rillig Exp $
 
-PKGNAME=       url2pkg-23.1.1
+PKGNAME=       url2pkg-23.2.0
 CATEGORIES=    pkgtools
 
 MAINTAINER=    rillig%NetBSD.org@localhost

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.48 pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.49
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.48       Sun Jun 11 07:42:16 2023
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.py    Sun Aug 13 21:19:02 2023
@@ -1,5 +1,5 @@
 #! @PYTHONBIN@
-# $NetBSD: url2pkg.py,v 1.48 2023/06/11 07:42:16 wiz Exp $
+# $NetBSD: url2pkg.py,v 1.49 2023/08/13 21:19:02 rillig Exp $
 
 # Copyright (c) 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -789,8 +789,7 @@ class Adjuster:
             self.todos.append(f'dependency {kind} {value}')
 
     def read_dependencies(self, cmd: str, env: Dict[str, str],
-                          cwd: Union[Path, Any], pkgdir_prefix: str,
-                          pkgname_prefix: str) -> None:
+                          cwd: Union[Path, Any], python: bool = False) -> None:
         effective_env = dict(os.environ)
         effective_env.update(env)
 
@@ -832,19 +831,26 @@ class Adjuster:
                 self.g.debug('unknown dependency line: {0}', line)
 
         self.set_license(license_name, license_default)
-        self.add_dependencies(pkgdir_prefix, pkgname_prefix, dep_lines)
+        self.add_dependencies(dep_lines, python)
 
-    def add_dependencies(self, pkgdir_prefix: str, pkgname_prefix: str,
-                         dep_lines: List[Tuple[str, str, str, str]]):
+    def add_dependencies(self, dep_lines: List[Tuple[str, str, str, str]],
+                         python: bool):
         for dep_line in dep_lines:
             kind, pkgbase, constraint, dep_dir = dep_line
 
-            if dep_dir == '' and pkgdir_prefix != '':
-                dep_dir = self.g.find_package(pkgdir_prefix + pkgbase)
-                if dep_dir != '':
-                    pkgbase = pkgname_prefix + pkgbase
             if dep_dir == '':
                 dep_dir = self.g.find_package(pkgbase)
+            if dep_dir == '' and python:
+                for candidate in list(dict.fromkeys((
+                        pkgbase,
+                        pkgbase.replace('_', '-'),
+                        re.sub('^py', '', pkgbase),
+                        re.sub('^py', '', pkgbase).replace('_', '-')
+                ))):
+                    dep_dir = self.g.find_package('py-' + candidate)
+                    if dep_dir != '':
+                        pkgbase = '${PYPKGPREFIX}-' + candidate
+                        break
 
             self.add_dependency(kind, pkgbase, constraint, dep_dir)
 
@@ -959,7 +965,7 @@ class Adjuster:
         # devel/p5-Algorithm-CheckDigits
 
         cmd = f'{self.g.perl5} -I{self.g.libdir} -I. Build.PL'
-        self.read_dependencies(cmd, {}, self.abs_wrksrc, '', '')
+        self.read_dependencies(cmd, {}, self.abs_wrksrc)
         self.build_vars.append(Var('PERL5_MODULE_TYPE', '=', 'Module::Build'))
 
     def adjust_perl_module_Makefile_PL(self):
@@ -974,7 +980,7 @@ class Adjuster:
         subprocess.call(cmd1, shell=True, cwd=self.abs_wrksrc)
 
         cmd2 = f'{self.g.perl5} -I{self.g.libdir} -I. Makefile.PL'
-        self.read_dependencies(cmd2, {}, self.abs_wrksrc, '', '')
+        self.read_dependencies(cmd2, {}, self.abs_wrksrc)
 
     def adjust_perl_module_homepage(self):
         if '${MASTER_SITE_PERL_CPAN:' \
@@ -1027,7 +1033,7 @@ class Adjuster:
             'PYTHONDONTWRITEBYTECODE': 'x',
             'PYTHONPATH': f'{self.g.libdir}/python'
         }
-        self.read_dependencies(cmd, env, self.abs_wrksrc, 'py-', '${PYPKGPREFIX}-')
+        self.read_dependencies(cmd, env, self.abs_wrksrc, python=True)
 
         self.pkgname_prefix = '${PYPKGPREFIX}-'
         self.categories.append('python')

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.44 pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.45
--- pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.44  Sun Aug 13 21:11:31 2023
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py       Sun Aug 13 21:19:02 2023
@@ -1,4 +1,4 @@
-# $NetBSD: url2pkg_test.py,v 1.44 2023/08/13 21:11:31 rillig Exp $
+# $NetBSD: url2pkg_test.py,v 1.45 2023/08/13 21:19:02 rillig Exp $
 
 # URLs for manual testing:
 #
@@ -788,7 +788,7 @@ def test_Adjuster_read_dependencies():
 
     adjuster = Adjuster(g, '', Lines())
     adjuster.makefile_lines.add('# url2pkg-marker')
-    adjuster.read_dependencies(cmd, env, '.', '', '')
+    adjuster.read_dependencies(cmd, env, '.')
 
     assert os.getenv('URL2PKG_DEPENDENCIES') is None
     assert adjuster.depends == ['package>=112.0:../../pkgtools/pkglint']
@@ -815,7 +815,7 @@ def test_Adjuster_read_dependencies():
     ]
 
 
-def test_Adjuster_read_dependencies__lookup_with_prefix():
+def test_Adjuster_read_dependencies__lookup_python():
     child_process_output = [
         'DEPENDS\tpyobjc-framework-Quartz>=0',
         # begin from py-slixmpp
@@ -829,12 +829,12 @@ def test_Adjuster_read_dependencies__loo
     cmd = "printf '%s\n' \"$URL2PKG_DEPENDENCIES\""
 
     adjuster = Adjuster(g, '', Lines())
-    adjuster.read_dependencies(cmd, env, '.', 'py-', '${PYPKGPREFIX}-')
+    adjuster.read_dependencies(cmd, env, '.', python=True)
 
     assert adjuster.depends == [
         '${PYPKGPREFIX}-pyobjc-framework-Quartz>=0:../../devel/py-pyobjc-framework-Quartz',
-        '# TODO: pyasn1>=0',
-        '# TODO: pyasn1_modules>=0',
+        '${PYPKGPREFIX}-asn1>=0:../../security/py-asn1',
+        '${PYPKGPREFIX}-asn1-modules>=0:../../security/py-asn1-modules',
         '# TODO: typing_extensions;python_version<"3.8.0">=0',
     ]
 



Home | Main Index | Thread Index | Old Index