pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/lang/python Rewrite versioned Python dependency handli...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ac1c5006310b
branches:  trunk
changeset: 387842:ac1c5006310b
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Tue Nov 08 14:18:27 2022 +0000

description:
Rewrite versioned Python dependency handling to deal with more than just
py27 vs py3.

diffstat:

 lang/python/versioned_dependencies.mk |  162 ++++++++++++++++++++++-----------
 1 files changed, 106 insertions(+), 56 deletions(-)

diffs (185 lines):

diff -r ccdc8f6b4aa0 -r ac1c5006310b lang/python/versioned_dependencies.mk
--- a/lang/python/versioned_dependencies.mk     Tue Nov 08 13:50:21 2022 +0000
+++ b/lang/python/versioned_dependencies.mk     Tue Nov 08 14:18:27 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: versioned_dependencies.mk,v 1.89 2022/10/19 14:17:54 nia Exp $
+# $NetBSD: versioned_dependencies.mk,v 1.90 2022/11/08 14:18:27 joerg Exp $
 #
 # This file determines which separate distribution of a Python
 # package is used as dependency, depending on the Python version
@@ -15,70 +15,120 @@
 
 .include "../../lang/python/pyversion.mk"
 
-# format: short name for PYTHON_VERSIONED_DEPENDENCIES<space>Python-2.x path<space>Python-3.x path
-_SUPPORTED_PACKAGES=   # empty
-_SUPPORTED_PACKAGES+=  OpenSSL security/py27-OpenSSL security/py-OpenSSL
-_SUPPORTED_PACKAGES+=  Pillow graphics/py-Pillow6 graphics/py-Pillow
-_SUPPORTED_PACKAGES+=  X textproc/py-X2 textproc/py-X
-_SUPPORTED_PACKAGES+=  cairo graphics/py-cairo118 graphics/py-cairo
-_SUPPORTED_PACKAGES+=  chardet converters/py-chardet4 converters/py-chardet
-_SUPPORTED_PACKAGES+=  click devel/py-click7 devel/py-click
-_SUPPORTED_PACKAGES+=  coverage devel/py27-coverage devel/py-coverage
-_SUPPORTED_PACKAGES+=  cryptography security/py27-cryptography security/py-cryptography 
-_SUPPORTED_PACKAGES+=  dns net/py-dns1 net/py-dns 
-_SUPPORTED_PACKAGES+=  flake8 devel/py-flake8-3 devel/py-flake8
-_SUPPORTED_PACKAGES+=  hypothesis devel/py-hypothesis4 devel/py-hypothesis
-_SUPPORTED_PACKAGES+=  importlib-metadata devel/py-importlib-metadata2 devel/py-importlib-metadata
-_SUPPORTED_PACKAGES+=  isort devel/py-isort4 devel/py-isort
-_SUPPORTED_PACKAGES+=  jinja2 textproc/py27-jinja2 textproc/py-jinja2
-_SUPPORTED_PACKAGES+=  lama devel/py-lama7 devel/py-lama
-_SUPPORTED_PACKAGES+=  markdown textproc/py-markdown3 textproc/py-markdown
-_SUPPORTED_PACKAGES+=  mccabe devel/py-mccabe06 devel/py-mccabe
-_SUPPORTED_PACKAGES+=  more-itertools devel/py-more-itertools2 devel/py-more-itertools
-_SUPPORTED_PACKAGES+=  packaging devel/py-packaging2 devel/py-packaging
-_SUPPORTED_PACKAGES+=  pip devel/py-pip20 devel/py-pip
-_SUPPORTED_PACKAGES+=  pygments textproc/py-pygments25 textproc/py-pygments
-_SUPPORTED_PACKAGES+=  pyphen textproc/py27-pyphen textproc/py-pyphen
-_SUPPORTED_PACKAGES+=  rsa security/py-rsa40 security/py-rsa
-_SUPPORTED_PACKAGES+=  setuptools devel/py-setuptools44 devel/py-setuptools
-_SUPPORTED_PACKAGES+=  setuptools_scm devel/py-setuptools_scm5 devel/py-setuptools_scm
-_SUPPORTED_PACKAGES+=  test devel/py-test4 devel/py-test
-_SUPPORTED_PACKAGES+=  test-cov devel/py27-test-cov devel/py-test-cov
+# _PY_VERS_PKG.${PYTHON_VERSION}.${pkg} is the path used for the dependency
+# for a specific Python version. This can be "missing", if this Python
+# version is not supported for this package.
+#
+# _PY_VERS_PKG.default.${pkg} is the fallback version if a specific version
+# isn't known.
+#
+# _PY_VERS_PKG.dependency.${PKG} flags packages that need Rust-specific
+# handling.
+
+_PY_VERS_PKG.default.OpenSSL=  security/py-OpenSSL
+_PY_VERS_PKG.27.OpenSSL=       security/py27-OpenSSL
+_PY_VERS_PKG.dependency.OpenSSL=       yes
+
+_PY_VERS_PKG.default.Pillow=   graphics/py-Pillow
+_PY_VERS_PKG.27.Pillow=                graphics/py-Pillow6
+
+_PY_VERS_PKG.default.X=                textproc/py-X
+_PY_VERS_PKG.27.X=             textproc/py-X2
+
+_PY_VERS_PKG.default.cairo=    graphics/py-cairo
+_PY_VERS_PKG.27.cairo=         graphics/py-cairo118
+
+_PY_VERS_PKG.default.chardet=  converters/py-chardet
+_PY_VERS_PKG.27.chardet=       converters/py-chardet4
+
+_PY_VERS_PKG.default.click=    devel/py-click
+_PY_VERS_PKG.27.click=         devel/py-click7
+
+_PY_VERS_PKG.default.coverage= devel/py-coverage
+_PY_VERS_PKG.27.coverage=      devel/py27-coverage
+
+_PY_VERS_PKG.default.cryptography=     security/py-cryptography
+_PY_VERS_PKG.27.cryptography=          security/py27-cryptography
+_PY_VERS_PKG.dependency.cryptography=  yes
+
+_PY_VERS_PKG.default.dns=      net/py-dns
+_PY_VERS_PKG.27.dns=           net/py-dns1
+
+_PY_VERS_PKG.default.flake8=   devel/py-flake8
+_PY_VERS_PKG.27.flake8=                devel/py-flake8-3
+
+_PY_VERS_PKG.default.hypothesis=       devel/py-hypothesis
+_PY_VERS_PKG.27.hypothesis=            devel/py-hypothesis4
+
+_PY_VERS_PKG.default.importlib-metadata=       devel/py-importlib-metadata
+_PY_VERS_PKG.27.importlib-metadata=            devel/py-importlib-metadata2
+
+_PY_VERS_PKG.default.isort=    devel/py-isort
+_PY_VERS_PKG.27.isort=         devel/py-isort4
+
+_PY_VERS_PKG.default.jinja2=   textproc/py-jinja2
+_PY_VERS_PKG.27.jinja2=                textproc/py27-jinja2
+
+_PY_VERS_PKG.default.lama=     devel/py-lama
+_PY_VERS_PKG.27.lama=          devel/py-lama7
+
+_PY_VERS_PKG.default.markdown= textproc/py-markdown
+_PY_VERS_PKG.27.markdown=      textproc/py-markdown3
+
+_PY_VERS_PKG.default.mccabe=   devel/py-mccabe
+_PY_VERS_PKG.27.mccabe=                devel/py-mccabe06
+
+_PY_VERS_PKG.default.more-itertools=   devel/py-more-itertools
+_PY_VERS_PKG.27.more-itertools=                devel/py-more-itertools2
+
+_PY_VERS_PKG.default.packaging=                devel/py-packaging
+_PY_VERS_PKG.27.packaging=             devel/py-packaging2
+
+_PY_VERS_PKG.default.pip=      devel/py-pip
+_PY_VERS_PKG.27.pip=           devel/py-pip20
+
+_PY_VERS_PKG.default.pygments= textproc/py-pygments
+_PY_VERS_PKG.27.pygments=      textproc/py-pygments25
+
+_PY_VERS_PKG.default.pyphen=   textproc/py-pyphen
+_PY_VERS_PKG.27.pyphen=                textproc/py27-pyphen
+
+_PY_VERS_PKG.default.rsa=      security/py-rsa
+_PY_VERS_PKG.27.rsa=           security/py-rsa40
+
+_PY_VERS_PKG.default.setuptools=       devel/py-setuptools
+_PY_VERS_PKG.27.setuptools=            devel/py-setuptools44
+
+_PY_VERS_PKG.default.setuptools_scm=   devel/py-setuptools_scm
+_PY_VERS_PKG.27.setuptools_scm=                devel/py-setuptools_scm5
+
+_PY_VERS_PKG.default.test=     devel/py-test
+_PY_VERS_PKG.27.test=          devel/py-test4
+
+_PY_VERS_PKG.default.test-cov= devel/py-test-cov
+_PY_VERS_PKG.27.test-cov=      devel/py27-test-cov
+
 
 .for pattern in ${PYTHON_VERSIONED_DEPENDENCIES}
-_PKG_MATCHED=  no
 pkg:=  ${pattern:C/:.*//}
 type:= ${pattern:C/[^:]*//}
-.  for name py2dir py3dir in ${_SUPPORTED_PACKAGES}
-.    if "${pkg}" == "${name}" && "${pkg}" == "cryptography"
-# Special due to Rust handling.
-_PKG_MATCHED=  yes
-.      include "../../security/py-cryptography/dependency.mk"
-.    elif "${pkg}" == "${name}" && "${pkg}" == "OpenSSL"
-# Special due to Rust handling.
-_PKG_MATCHED=  yes
-.      include "../../security/py-OpenSSL/dependency.mk"
-.    elif "${pkg}" == "${name}"
-_PKG_MATCHED=  yes
-.      if ${_PYTHON_VERSION} == 27
-dir:=  ${py2dir}
-.      else
-dir:=  ${py3dir}
-.      endif
-.      if "${type}" == ":link"
+dir:=  ${_PY_VERS_PKG.${_PYTHON_VERSION}.${pkg}:U${_PY_VERS_PKG.default.${pkg}:Umissing}}
+.  if ${dir} == "missing"
+PKG_FAIL_REASON+=      "${pkg} unsupported in PYTHON_VERSIONED_DEPENDENCIES"
+.  else
+.    if ${_PY_VERS_PKG.dependency.${pkg}:Uno} == "yes"
+.      include "../../${_PY_VERS_PKG.default.${pkg}}/dependency.mk"
+.    endif
+.    if "${type}" == ":link"
 .include "../../${dir}/buildlink3.mk"
-.      elif "${type}" == ":build"
+.    elif "${type}" == ":build"
 BUILD_DEPENDS:=        ${BUILD_DEPENDS} ${PYPKGPREFIX}-${pkg}-[0-9]*:../../${dir}
-.      elif "${type}" == ":test"
+.    elif "${type}" == ":test"
 TEST_DEPENDS:= ${TEST_DEPENDS} ${PYPKGPREFIX}-${pkg}-[0-9]*:../../${dir}
-.      elif "${type}" == ":tool"
+.    elif "${type}" == ":tool"
 TOOL_DEPENDS:= ${TOOL_DEPENDS} ${PYPKGPREFIX}-${pkg}-[0-9]*:../../${dir}
-.      else
+.    else
 DEPENDS:=      ${DEPENDS} ${PYPKGPREFIX}-${pkg}-[0-9]*:../../${dir}
-.      endif
 .    endif
-.  endfor
-.  if ${_PKG_MATCHED} == "no"
-PKG_FAIL_REASON+=      "${pkg} unsupported in PYTHON_VERSIONED_DEPENDENCIES"
 .  endif
 .endfor



Home | Main Index | Thread Index | Old Index