pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/url2pkg/files url2pkg: generate proper packag...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9934ff29aa43
branches:  trunk
changeset: 453248:9934ff29aa43
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue May 25 17:44:08 2021 +0000

description:
url2pkg: generate proper package name for Python dependencies

Reported by Brook Milligan via private mail.

diffstat:

 pkgtools/url2pkg/files/url2pkg.py      |  19 ++++++++++---------
 pkgtools/url2pkg/files/url2pkg_test.py |   8 ++++----
 2 files changed, 14 insertions(+), 13 deletions(-)

diffs (98 lines):

diff -r 681fbf8c57e8 -r 9934ff29aa43 pkgtools/url2pkg/files/url2pkg.py
--- a/pkgtools/url2pkg/files/url2pkg.py Tue May 25 17:31:08 2021 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.py Tue May 25 17:44:08 2021 +0000
@@ -1,5 +1,5 @@
 #! @PYTHONBIN@
-# $NetBSD: url2pkg.py,v 1.30 2021/05/25 17:14:44 rillig Exp $
+# $NetBSD: url2pkg.py,v 1.31 2021/05/25 17:44:08 rillig Exp $
 
 # Copyright (c) 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -712,7 +712,8 @@
             self.todos.append(f'dependency {kind} {value}')
 
     def read_dependencies(self, cmd: str, env: Dict[str, str],
-                          cwd: Union[Path, Any], pkgname_prefix: str) -> None:
+                          cwd: Union[Path, Any], pkgdir_prefix: str,
+                          pkgname_prefix: str) -> None:
         effective_env = dict(os.environ)
         effective_env.update(env)
 
@@ -754,15 +755,15 @@
                 self.g.debug('unknown dependency line: {0}', line)
 
         self.set_license(license_name, license_default)
-        self.add_dependencies(pkgname_prefix, dep_lines)
+        self.add_dependencies(pkgdir_prefix, pkgname_prefix, dep_lines)
 
-    def add_dependencies(self, pkgname_prefix: str,
+    def add_dependencies(self, pkgdir_prefix: str, pkgname_prefix: str,
                          dep_lines: List[Tuple[str, str, str, str]]):
         for dep_line in dep_lines:
             kind, pkgbase, constraint, dep_dir = dep_line
 
-            if dep_dir == '' and pkgname_prefix != '':
-                dep_dir = self.g.find_package(pkgname_prefix + pkgbase)
+            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 == '':
@@ -881,7 +882,7 @@
         # 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):
@@ -896,7 +897,7 @@
         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:' \
@@ -949,7 +950,7 @@
             'PYTHONDONTWRITEBYTECODE': 'x',
             'PYTHONPATH': self.g.libdir
         }
-        self.read_dependencies(cmd, env, self.abs_wrksrc, 'py-')
+        self.read_dependencies(cmd, env, self.abs_wrksrc, 'py-', '${PYPKGPREFIX}-')
 
         self.pkgname_prefix = '${PYPKGPREFIX}-'
         self.categories.append('python')
diff -r 681fbf8c57e8 -r 9934ff29aa43 pkgtools/url2pkg/files/url2pkg_test.py
--- a/pkgtools/url2pkg/files/url2pkg_test.py    Tue May 25 17:31:08 2021 +0000
+++ b/pkgtools/url2pkg/files/url2pkg_test.py    Tue May 25 17:44:08 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: url2pkg_test.py,v 1.29 2021/05/23 16:27:39 rillig Exp $
+# $NetBSD: url2pkg_test.py,v 1.30 2021/05/25 17:44:08 rillig Exp $
 
 import pytest
 from url2pkg import *
@@ -710,7 +710,7 @@
 
     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']
@@ -746,10 +746,10 @@
     cmd = "printf '%s\n' \"$URL2PKG_DEPENDENCIES\""
 
     adjuster = Adjuster(g, '', Lines())
-    adjuster.read_dependencies(cmd, env, '.', 'py-')
+    adjuster.read_dependencies(cmd, env, '.', 'py-', '${PYPKGPREFIX}-')
 
     assert adjuster.depends == [
-        'py-pyobjc-framework-Quartz>=0:../../devel/py-pyobjc-framework-Quartz',
+        '${PYPKGPREFIX}-pyobjc-framework-Quartz>=0:../../devel/py-pyobjc-framework-Quartz',
     ]
 
 



Home | Main Index | Thread Index | Old Index