git: e7693e387ca0 - main - devel/py-virtualenv: Update to 20.16.7

From: Nicola Vitale <nivit_at_FreeBSD.org>
Date: Tue, 22 Nov 2022 17:03:57 UTC
The branch main has been updated by nivit:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e7693e387ca0224d30dc2bd7ec86205961d4a8c5

commit e7693e387ca0224d30dc2bd7ec86205961d4a8c5
Author:     Nicola Vitale <nivit@FreeBSD.org>
AuthorDate: 2022-11-22 16:58:56 +0000
Commit:     Nicola Vitale <nivit@FreeBSD.org>
CommitDate: 2022-11-22 16:58:56 +0000

    devel/py-virtualenv: Update to 20.16.7
    
    - Update (BUILD|RUN|TEST)_DEPENDS list
    - Update patch for docs/conf.pyp file
    - Use pytest for testing
    - Set the environment variable SETUPTOOLS_SCM_PRETEND_VERSION to fix the
      exception:
    
        LookupError: setuptools-scm was unable to detect version
    
    - Disable QA_depends_blacklist when executing the test target, because
      virtualenv also requires python2 executable for some tests
    - Set the test environment variable PYTHONPATH, so pytest can find the
      virtualenv library
    - Force setuptools to create a temporary egg_info in build/lib during the build
      stage, so that sphinx can then create docs. Exception occurred:
    
      File "/usr/local/poudriere/ports/default/devel/py-virtualenv/work-py39/virtualenv-20.16.7/build/lib/
    virtualenv/run/plugin/discovery.py", line 20, in get_discover
        default=next(iter(choices)),
    StopIteration
    
      (raised only when virtualenv is not already installed in the system)
    - Add devel/py-importlib-metadata to RUN_DEPENDS when using python3.7
    - Reorder variables in Makefile
    
    Port tested with all versions of Python currently supported.
    
    Changelog:  https://github.com/pypa/virtualenv/releases/tag/20.16.7
---
 devel/py-virtualenv/Makefile                 | 75 +++++++++++++++++++---------
 devel/py-virtualenv/distinfo                 |  6 +--
 devel/py-virtualenv/files/patch-docs_conf.py | 18 +++----
 3 files changed, 64 insertions(+), 35 deletions(-)

diff --git a/devel/py-virtualenv/Makefile b/devel/py-virtualenv/Makefile
index 044b6a84094f..3c13b8eebd54 100644
--- a/devel/py-virtualenv/Makefile
+++ b/devel/py-virtualenv/Makefile
@@ -1,5 +1,5 @@
 PORTNAME=	virtualenv
-PORTVERSION=	16.7.5
+PORTVERSION=	20.16.7
 PORTREVISION=	0
 CATEGORIES=	devel python
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -10,39 +10,68 @@ WWW=		https://virtualenv.pypa.io
 
 LICENSE=	MIT
 
-TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest@${PY_FLAVOR} \
-		${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock@${PY_FLAVOR}
-
-DOCS_BUILD_DEPENDS=	${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>0:textproc/py-towncrier@${PY_FLAVOR}
-DOCS_BINARY_ALIAS=	towncrier=towncrier-${PYTHON_VER}
-DOCS_PORTDOCS=	*
-DOCS_VARS=	PYDISTUTILS_BUILD_TARGET="build build_sphinx"
-
-# Required by towncrier/click when Python < 3.7
-# see https://click.palletsprojects.com/en/7.x/python3/
-# Documentation is in English, so...
-MAKE_ENV=	LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
+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}
+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} \
+		${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} \
+		${PYTHON_PKGNAMEPREFIX}pytest-freezegun>=0.4.2:devel/py-pytest-freezegun@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-mock>0:devel/py-pytest-mock@${PY_FLAVOR} \
+		${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+
+USE_GITHUB=	yes
 GH_ACCOUNT=	pypa
+USE_PYTHON=	autoplist concurrent distutils pytest
+
+# 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 \
+		PYTHONPATH="${STAGEDIR}${PYTHON_SITELIBDIR}"
+QA_ENV=		IGNORE_QA_depends_blacklist=yes # we also need lang/python2 to pass some tests
+.endif
 
 NO_ARCH=	yes
 
 OPTIONS_DEFINE=	DOCS
 
-PYDISTUTILS_BUILDARGS=	-c ${WRKSRC}/docs
-
-USES=		cpe python:3.6+
-USE_GITHUB=	yes
-USE_PYTHON=	autoplist concurrent distutils
+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}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_PORTDOCS=		*
+# Note: we install a temporary egg_info so that virtualenv can discover its stuff,
+# while sphinx builds docs. Otherwise an Exception occurs:
+#
+# File "/build/lib/virtualenv/run/plugin/discovery.py", line 20, in get_discover
+#    default=next(iter(choices)),
+# StopIteration
+#
+DOCS_VARS=	PYDISTUTILS_BUILD_TARGET="build install_egg_info --install-dir build/lib build_sphinx"
 
 post-install-DOCS-on:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
 	(cd ${WRKSRC}/build/sphinx/html && \
 	${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR} "! -name .buildinfo -or -name objects.inv")
 
-regression-test: build
-	@cd ${WRKSRC} && ${PYTHON_CMD} ${PYDISTUTILS_SETUP} test
+.include <bsd.port.pre.mk>
+
+.if "${PYTHON_VER}" == "3.7"
+RUN_DEPENDS+=	${PYTHON_PKGNAMEPREFIX}importlib-metadata>=4.8.1:devel/py-importlib-metadata@${PY_FLAVOR}
+.endif
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/devel/py-virtualenv/distinfo b/devel/py-virtualenv/distinfo
index 8b97e30e2940..f6b727027814 100644
--- a/devel/py-virtualenv/distinfo
+++ b/devel/py-virtualenv/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1568815876
-SHA256 (pypa-virtualenv-16.7.5_GH0.tar.gz) = b14f2548f9d9b3db3309756069d2df9cbb8eb1cbd5f968437fc4580a6dbf19b6
-SIZE (pypa-virtualenv-16.7.5_GH0.tar.gz) = 5108645
+TIMESTAMP = 1668801951
+SHA256 (pypa-virtualenv-20.16.7_GH0.tar.gz) = 5aca63a79f180330fec063323a3604a84f61c6003784d88f2f033bea6193d058
+SIZE (pypa-virtualenv-20.16.7_GH0.tar.gz) = 12253560
diff --git a/devel/py-virtualenv/files/patch-docs_conf.py b/devel/py-virtualenv/files/patch-docs_conf.py
index 9ce57124c7bf..9d0dd6d85969 100644
--- a/devel/py-virtualenv/files/patch-docs_conf.py
+++ b/devel/py-virtualenv/files/patch-docs_conf.py
@@ -1,15 +1,15 @@
---- docs/conf.py.orig	2019-09-03 16:32:54 UTC
+--- docs/conf.py.orig	2022-11-12 21:38:58 UTC
 +++ docs/conf.py
-@@ -4,7 +4,11 @@ import os
- import re
+@@ -1,9 +1,12 @@
++import os
  import subprocess
  import sys
--from pathlib import Path
-+if sys.version_info[0] == 2:
-+    from pathlib2 import Path
-+else:
-+    from pathlib import Path
+ from datetime import date, datetime
+ from pathlib import Path
+ 
+ import sphinx_rtd_theme
++
 +sys.path.insert(0, os.path.abspath('../build/lib'))
  
- from virtualenv import __version__
+ from virtualenv.version import __version__