Re: git: 16a6fecb4ff8 - main - python.mk: use script to process RECORD for the first pass

From: Mathieu Arnold <mat_at_freebsd.org>
Date: Thu, 09 Mar 2023 07:56:39 UTC
On Thu, Mar 09, 2023 at 03:44:08AM +0000, Charlie Li wrote:
> The branch main has been updated by vishwin:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=16a6fecb4ff8b051ba1b238267b7cd15b19cda75
> 
> commit 16a6fecb4ff8b051ba1b238267b7cd15b19cda75
> Author:     Charlie Li <vishwin@FreeBSD.org>
> AuthorDate: 2023-03-09 03:33:57 +0000
> Commit:     Charlie Li <vishwin@FreeBSD.org>
> CommitDate: 2023-03-09 03:33:57 +0000
> 
>     python.mk: use script to process RECORD for the first pass
>     
>     RECORD is a CSV file [0] containing more data than our plist format
>     accepts. The original processing method used sed(1) exclusively,
>     but paths containing quotes, spaces and commas throw it off. Process
>     the CSV properly instead for the first pass.
>     
>     References: https://packaging.python.org/en/latest/specifications/recording-installed-packages/#the-record-file [0]
> ---
>  Mk/Uses/python.mk | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk
> index d0754dc02097..6e25d0427cb2 100644
> --- a/Mk/Uses/python.mk
> +++ b/Mk/Uses/python.mk
> @@ -870,7 +870,9 @@ do-build:
>  do-install:
>  	@${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
>  	@cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PEP517_INSTALL_CMD}
> -	@${SED} -e 's|^|${PYTHONPREFIX_SITELIBDIR}/|' \
> +	@${PYTHON_CMD} -B ${PORTSDIR}/Tools/scripts/strip_RECORD.py \
> +		${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}.dist-info/RECORD >> ${_PYTHONPKGLIST}

Any script that is used by the framework must be put in Mk/scripts.  The
scripts in Tools are user contributed and not supported.

> +	@${REINPLACE_CMD} -e 's|^|${PYTHONPREFIX_SITELIBDIR}/|' \
>  		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../etc/|etc/|' \
>  		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../bin/|bin/|' \
>  		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../include/|include/|' \
> @@ -880,8 +882,7 @@ do-install:
>  		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../man/|man/|' \
>  		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../sbin/|sbin/|' \
>  		-e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../share/|share/|' \
> -		-e 's|\,.*$$||' \
> -		${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME:C/[-_]+/_/g}-${PORTVERSION}.dist-info/RECORD >> ${_PYTHONPKGLIST}
> +		${_PYTHONPKGLIST}
>  .    endif
>  .  endif # defined(_PYTHON_FEATURE_PEP517)
>  
> 

-- 
Mathieu Arnold