diff options
author | Po-Chuan Hsieh <sunpoet@FreeBSD.org> | 2023-05-07 16:05:26 +0000 |
---|---|---|
committer | Po-Chuan Hsieh <sunpoet@FreeBSD.org> | 2023-05-07 16:05:26 +0000 |
commit | 34852a28b2b09ceb1b52db7ac15a192089c5e60c (patch) | |
tree | b6221561020bc453e8f24cc04b9d4ed55f1187ad /Mk | |
parent | 2ee3452db15ba1d4e78bb48997938cb6ebadd14e (diff) |
Mk/Uses/python.mk: Fix PLIST issue for USE_PYTHON=pep517
Currently "USE_PYTHON=autoplist pep517" generates the PLIST as follows:
- Extract the list of installed files from the RECORD file to the intermediate
PLIST (_PYTHONPKGLIST)
- Manipulate the intermediate PLIST
- Add list of pycache files to the intermediate PLIST
When the RECORD file contains foo.pyc entry, that file will be counted twice in
the PLIST at the end. It will cause check-plist error. This fix removes *.pyc
entries while manipulating the intermediate PLIST to ensure all pycache files
are only counted once.
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Uses/python.mk | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk index 0e8350663076..74660df56a51 100644 --- a/Mk/Uses/python.mk +++ b/Mk/Uses/python.mk @@ -390,10 +390,6 @@ _PYTHON_RUN_DEP= yes _PYTHON_TEST_DEP= yes . endif -. if ${PYTHON2_DEFAULT} != ${PYTHON_DEFAULT} && ${PYTHON3_DEFAULT} != ${PYTHON_DEFAULT} -WARNING+= "PYTHON_DEFAULT must be a version present in PYTHON2_DEFAULT or PYTHON3_DEFAULT, if you want more Python flavors, set BUILD_ALL_PYTHON_FLAVORS in your make.conf" -. endif - . if ${_PYTHON_ARGS} == 2.7 DEV_WARNING+= "lang/python27 reached End of Life and will be removed somewhere in the future, please convert to a modern version of python" . elif ${_PYTHON_ARGS} == 2 @@ -437,7 +433,7 @@ _PYTHON_VERSION_NONSUPPORTED= ${_PYTHON_VERSION_MAXIMUM} at most # If we have an unsupported version of Python, try another. . if defined(_PYTHON_VERSION_NONSUPPORTED) .undef _PYTHON_VERSION -. for ver in ${PYTHON2_DEFAULT} ${PYTHON3_DEFAULT} ${_PYTHON_VERSIONS} +. for ver in ${PYTHON_DEFAULT} ${PYTHON2_DEFAULT} ${_PYTHON_VERSIONS} __VER= ${ver} . if !defined(_PYTHON_VERSION) && \ !(!empty(_PYTHON_VERSION_MINIMUM) && ( \ @@ -455,7 +451,7 @@ IGNORE= needs an unsupported version of Python # Automatically generates FLAVORS if empty . if empty(FLAVORS) && defined(_PYTHON_FEATURE_FLAVORS) . undef _VALID_PYTHON_VERSIONS -. for ver in ${PYTHON_DEFAULT} ${PYTHON2_DEFAULT} ${PYTHON3_DEFAULT} ${_PYTHON_VERSIONS} +. for ver in ${PYTHON_DEFAULT} ${PYTHON2_DEFAULT} ${_PYTHON_VERSIONS} __VER= ${ver} . if !(!empty(_PYTHON_VERSION_MINIMUM) && ( \ ${__VER:${_VC}} < ${_PYTHON_VERSION_MINIMUM:${_VC}})) && \ @@ -477,7 +473,7 @@ _ALL_PYTHON_FLAVORS= ${_PYTHON_VERSIONS:S/.//:S/^/py/} . if defined(BUILD_ALL_PYTHON_FLAVORS) || defined(_PYTHON_FEATURE_ALLFLAVORS) FLAVORS= ${_ALL_PYTHON_FLAVORS} . else -. for _v in ${PYTHON_DEFAULT} ${PYTHON2_DEFAULT} ${PYTHON3_DEFAULT} +. for _v in ${PYTHON_DEFAULT} ${PYTHON2_DEFAULT} _f= py${_v:S/.//} . if ${_ALL_PYTHON_FLAVORS:M${_f}} && !${FLAVORS:M${_f}} . if !empty(FLAVORS) @@ -909,7 +905,9 @@ do-install: @cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${PEP517_INSTALL_CMD} @${PYTHON_CMD} -B ${PORTSDIR}/Mk/Scripts/strip_RECORD.py \ ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/${PORTNAME:C|[-_]+|_|g}-${DISTVERSION}*.dist-info/RECORD >> ${_PYTHONPKGLIST} - @${REINPLACE_CMD} -e 's|^|${PYTHONPREFIX_SITELIBDIR}/|' \ + @${REINPLACE_CMD} \ + -e '/\.pyc$$/d' \ + -e 's|^|${PYTHONPREFIX_SITELIBDIR}/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../etc/|etc/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../bin/|bin/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../include/|include/|' \ @@ -919,7 +917,7 @@ do-install: -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../man/|man/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../sbin/|sbin/|' \ -e 's|^${PYTHONPREFIX_SITELIBDIR}/../../../share/|share/|' \ - ${_PYTHONPKGLIST} + ${_PYTHONPKGLIST} @cd ${STAGEDIR}${PREFIX} && ${FIND} lib -name '*.pyc' >> ${_PYTHONPKGLIST} . endif . endif # defined(_PYTHON_FEATURE_PEP517) |