1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-22 08:58:47 +00:00

devel/py-virtualenv: Update to 20.18.0

- Use Python pep517 feature, because the upstream removed setuptools support
- Compile and install Python bytecode (pending a definitive decision regarding
 this: see: https://reviews.freebsd.org/D38429 )
- Update build/test dependencies
- Add a patch to pyproject.toml to fix the following Exception (build stage):

    from virtualenv.version import __version__
ImportError: cannot import name '__version__' from 'virtualenv.version' (/usr/local/poudriere/ports/default/devel/py-virtualenv/work-py39/virtualenv-20.18.0/dist/virtualenv-20.18.0-py3-none-any.whl/virtualenv/
version.py)

Changes: https://github.com/pypa/virtualenv/releases/tag/20.18.0
This commit is contained in:
Nicola Vitale 2023-02-09 16:14:36 +01:00
parent b0d8c29cc0
commit 0e61c307e7
No known key found for this signature in database
GPG Key ID: A51E190C4C0808D0
4 changed files with 60 additions and 23 deletions

View File

@ -1,5 +1,5 @@
PORTNAME= virtualenv
PORTVERSION= 20.17.0
PORTVERSION= 20.18.0
PORTREVISION= 0
CATEGORIES= devel python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
@ -10,14 +10,12 @@ WWW= https://virtualenv.pypa.io
LICENSE= MIT
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}distlib>=0.3.6:devel/py-distlib@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pip>=0:devel/py-pip@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}setuptools_scm>=0:devel/py-setuptools_scm@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}wheel>=0:devel/py-wheel@${PY_FLAVOR}
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}distlib>=0.3.6:devel/py-distlib@${PY_FLAVOR}
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}distlib>=0.3.6:devel/py-distlib@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}filelock>=3.4.1:sysutils/py-filelock@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}platformdirs>=2.4:devel/py-platformdirs@${PY_FLAVOR}
TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}coverage_enable_subprocess>=1.0:devel/py-coverage_enable_subprocess@${PY_FLAVOR} \
TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}covdefaults>=2.2.2:devel/py-covdefaults@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}coverage_enable_subprocess>=1.0:devel/py-coverage_enable_subprocess@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}flaky>=3.7.0:devel/py-flaky@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}packaging>=21.3:devel/py-packaging@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pytest-env>=0.6.2:devel/py-pytest-env@${PY_FLAVOR} \
@ -26,13 +24,23 @@ TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}coverage_enable_subprocess>=1.0:devel/py-co
${PYTHON_PKGNAMEPREFIX}pytest-randomly>=3.10.3:devel/py-pytest-randomly@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pytest-timeout>=2.1.0:devel/py-pytest-timeout@${PY_FLAVOR}
USES= cpe python:3.6+
USES= cpe python:3.7+
USE_GITHUB= yes
GH_ACCOUNT= pypa
USE_PYTHON= autoplist concurrent distutils pytest
USE_PYTHON= autoplist concurrent pep517 pytest
PEP517_BUILD_DEPEND= ${PYTHON_PKGNAMEPREFIX}hatch-vcs>=0.3:devel/py-hatch-vcs@${PY_FLAVOR}
PEP517_BUILD_CMD= ${PYTHON_CMD} -m hatchling build --target wheel
PEP517_INSTALL_DEPEND= ${PKGNAMEPREFIX}pip>=22.3.1:devel/py-pip@${PY_FLAVOR}
PEP517_INSTALL_CMD= ${PYTHON_CMD} -m pip install --no-color --compile \
--no-deps --no-warn-script-location --prefix ${PREFIX} \
--progress-bar off --root ${STAGEDIR} \
--root-user-action ignore --verbose \
${BUILD_WRKSRC}/dist/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}-*.whl
# Fix the LookupError: setuptools-scm was unable to detect version (build target)
MAKE_ENV= SETUPTOOLS_SCM_PRETEND_VERSION="${PORTVERSION}"
.if make(test)
TEST_DEPENDS+= python2:lang/python2
TEST_ENV= PYTHONIOENCODING=utf-8 \
@ -46,23 +54,30 @@ OPTIONS_DEFINE= DOCS
DOCS_BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}click-default-group>0:devel/py-click-default-group@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}filelock>0:sysutils/py-filelock@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}furo>=2022.12.7:textproc/py-furo@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}platformdirs>0:devel/py-platformdirs@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}proselint>0:devel/py-proselint@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}sphinx-argparse>0:textproc/py-sphinx-argparse@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}sphinx>=1.8.0,1:textproc/py-sphinx@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}sphinx_rtd_theme>0:textproc/py-sphinx_rtd_theme@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}towncrier>=22.8.0:textproc/py-towncrier@${PY_FLAVOR}
DOCS_BINARY_ALIAS= towncrier=towncrier-${PYTHON_VER}
DOCS_PLIST_FILES= man/man1/virtualenv.1.gz
DOCS_PORTDOCS= * .buildinfo
# Note: we install a temporary egg_info so that virtualenv can discover its stuff,
# while sphinx builds docs. Otherwise an Exception occurs:
# Fix the Exception:
#
# File "/build/lib/virtualenv/run/plugin/discovery.py", line 20, in get_discover
# default=next(iter(choices)),
# StopIteration
#
DOCS_VARS= PYDISTUTILS_BUILD_TARGET+="install_egg_info --install-dir build/lib"
# Apparently it doesn't work setting PYTHONPATH environment variable...
VIRTUALENV_WHEEL= ${WRKSRC}/dist/${PORTNAME}-${PORTVERSION}-py${PYTHON_MAJOR_VER}-none-any.whl
post-patch:
@${SED} -i.bak -e 's,%%VIRTUALENV_WHEEL%%,${VIRTUALENV_WHEEL},1' ${WRKSRC}/docs/conf.py
post-install:
${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py -s ${STAGEDIR} -f ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
post-install-DOCS-on:
${LOCALBASE}/bin/sphinx-build-${PYTHON_VER} -d ${WRKDIR} -b html -n ${WRKSRC}/docs ${STAGEDIR}${DOCSDIR}
@ -72,6 +87,7 @@ post-install-DOCS-on:
.if "${PYTHON_VER}" == "3.7"
RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}importlib-metadata>=4.8.1:devel/py-importlib-metadata@${PY_FLAVOR}
.endif
.include <bsd.port.post.mk>

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1669666632
SHA256 (pypa-virtualenv-20.17.0_GH0.tar.gz) = a5a67b65ffc21677ddb9f8fae0a38f23e4f34c082844f465f27433cb228572f4
SIZE (pypa-virtualenv-20.17.0_GH0.tar.gz) = 12254220
TIMESTAMP = 1675762684
SHA256 (pypa-virtualenv-20.18.0_GH0.tar.gz) = 17fada8694de7adc3fa7dfc1a6bcb400403b9b129891fee116d8f3ebb5c0ba7c
SIZE (pypa-virtualenv-20.18.0_GH0.tar.gz) = 12108429

View File

@ -1,15 +1,20 @@
--- docs/conf.py.orig 2022-11-12 21:38:58 UTC
--- docs/conf.py.orig 2023-02-06 17:33:30 UTC
+++ docs/conf.py
@@ -1,9 +1,12 @@
+import os
import subprocess
import sys
@@ -3,6 +3,8 @@ import sys
from datetime import date, datetime
from pathlib import Path
import sphinx_rtd_theme
+sys.path.insert(0, '%%VIRTUALENV_WHEEL%%')
+
+sys.path.insert(0, os.path.abspath('../build/lib'))
from virtualenv.version import __version__
company = "PyPA"
@@ -48,7 +50,7 @@ extlinks = {
def setup(app):
here = Path(__file__).parent
root, exe = here.parent, Path(sys.executable)
- towncrier = exe.with_name(f"towncrier{exe.suffix}")
+ towncrier = exe.with_name(f"towncrier")
cmd = [str(towncrier), "build", "--draft", "--version", "NEXT"]
new = subprocess.check_output(cmd, cwd=root, text=True, stderr=subprocess.DEVNULL)
(root / "docs" / "_draft.rst").write_text("" if "No significant changes" in new else new)

View File

@ -0,0 +1,16 @@
--- pyproject.toml.orig 2023-02-06 17:33:30 UTC
+++ pyproject.toml
@@ -100,6 +100,13 @@ pip = "virtualenv.seed.embed.pip_invoke:PipInvoke"
[tool.hatch]
build.hooks.vcs.version-file = "src/virtualenv/version.py"
+build.hooks.vcs.template = """\
+# coding: utf-8
+# file generated by setuptools_scm
+# don't change, don't track in version control
+__version__ = {version!r}
+__version_tuple__ = {version_tuple!r}
+"""
build.targets.sdist.include = ["/src", "/tests"]
version.source = "vcs"