git: a4431f26f3a6 - main - devel/py-virtualenv: Fix build when a previous version is installed

From: Nicola Vitale <nivit_at_FreeBSD.org>
Date: Fri, 10 Feb 2023 16:31:33 UTC
The branch main has been updated by nivit:

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

commit a4431f26f3a69c55d0785aeb349f070c8bea1321
Author:     Nicola Vitale <nivit@FreeBSD.org>
AuthorDate: 2023-02-10 16:25:04 +0000
Commit:     Nicola Vitale <nivit@FreeBSD.org>
CommitDate: 2023-02-10 16:31:02 +0000

    devel/py-virtualenv: Fix build when a previous version is installed
    
    - Pass the option --ignore-installed to pip(1), because it tries to deinstall
      the  previous version when installing the new one. This is safe because we
      install it in the stage dir. [1]
    
    - Fix build with Python < 3.9.
      Replace the switch -s (strip) with -d (destination dir), passed to module
      compileall.py, because the first is available only with Python 3.9+. [2]
    
      Reported error:
    
    ===>  Staging for py38-virtualenv-20.18.0
    ===>   Generating temporary packing list
    Using pip 22.3.1 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
    Processing ./dist/virtualenv-20.18.0-py3-none-any.whl
    Installing collected packages: virtualenv
      changing mode of /wrkdirs/usr/ports/devel/py-virtualenv/work-py38/stage/usr/local/bin/virtualenv to 755
    Successfully installed virtualenv-20.18.0
    WARNING: There was an error checking the latest version of pip.
    /usr/local/bin/python3.8 /usr/local/lib/python3.8/compileall.py -s /wrkdirs/usr/ports/devel/py-virtualenv/work-py38/stage -f /wrkdirs/usr/ports/devel/py-virtualenv/work-py38/stage/usr/local/lib/python3.8/site
    -packages
    usage: compileall.py [-h] [-l] [-r RECURSION] [-f] [-q] [-b] [-d DESTDIR]
                         [-x REGEXP] [-i FILE] [-j WORKERS]
                         [--invalidation-mode {checked-hash,timestamp,unchecked-hash}]
                         [FILE|DIR [FILE|DIR ...]]
    compileall.py: error: unrecognized arguments: -s /wrkdirs/usr/ports/devel/py-virtualenv/work-py38/stage/usr/local/lib/python3.8/site-packages
    *** Error code 2
    
    PR:             269458 [1]
    Reported by:    John Hein <jcfyecrayz@liamekaens.com> [1]
    Reported by:    Кирилл Варнаков <kirill@varnakov.com> (via email) [2]
---
 devel/py-virtualenv/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/devel/py-virtualenv/Makefile b/devel/py-virtualenv/Makefile
index 1e3d9b54aefb..e5467b93f08e 100644
--- a/devel/py-virtualenv/Makefile
+++ b/devel/py-virtualenv/Makefile
@@ -33,9 +33,9 @@ PEP517_BUILD_DEPEND=	${PYTHON_PKGNAMEPREFIX}hatch-vcs>=0.3:devel/py-hatch-vcs@${
 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 \
+			--ignore-installed --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)
@@ -77,7 +77,7 @@ 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}
+	${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py -d ${PYTHONPREFIX_SITELIBDIR} -f ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
 
 post-install-DOCS-on:
 	${LOCALBASE}/bin/sphinx-build-${PYTHON_VER} -d ${WRKDIR} -b html -n ${WRKSRC}/docs ${STAGEDIR}${DOCSDIR}