Re: git: bb5ef640ea2f - main - py-libxml2: Byte compile
Date: Fri, 17 May 2024 17:05:36 UTC
On 2024-05-17T10:51:11.000+02:00, Jason E. Hale <jhale@FreeBSD.org> wrote: > The branch main has been updated by jhale: > > URL: https://cgit.FreeBSD.org/ports/commit/?id=bb5ef640ea2f1756105b9f2aea44d85df600dd5e > > commit bb5ef640ea2f1756105b9f2aea44d85df600dd5e > Author: Jason E. Hale <jhale@FreeBSD.org> > AuthorDate: 2024-05-17 07:51:35 +0000 > Commit: Jason E. Hale <jhale@FreeBSD.org> > CommitDate: 2024-05-17 08:51:04 +0000 > > py-libxml2: Byte compile > > This eliminates annoying fs-violation errors, notably from > textproc/itstool and textproc/gtk-doc where the byte code is generated > at build time instead of already having been generated by py-libxml2. > > It is still peculiar to me that these files are dumped directly into > PYTHON_SITELIBDIR and don't have a subdirectory of their own. > Worth investigating, but hierachical changes are obviously more > intrusive and beyond this scope. > --- > textproc/libxml2/Makefile | 6 ++++++ > textproc/py-libxml2/Makefile | 17 ++++++----------- > textproc/py-libxml2/pkg-plist | 7 +++++++ > 3 files changed, 19 insertions(+), 11 deletions(-) > > diff --git a/textproc/libxml2/Makefile b/textproc/libxml2/Makefile > index e69bb22381d7..386af00928be 100644 > --- a/textproc/libxml2/Makefile > +++ b/textproc/libxml2/Makefile > @@ -55,6 +55,12 @@ post-patch: > post-install: > .if defined(LIBXML2_SLAVE) > ${STRIP_CMD} ${STAGEDIR}${PYTHON_LIBDIR}/site-packages/libxml2mod.so > + ${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py \ > + -f -d ${PYTHONPREFIX_SITELIBDIR} \ > + ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} > + ${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py \ > + -f -d ${PYTHONPREFIX_SITELIBDIR} \ > + ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} > .endif > > .include <bsd.port.mk>; > diff --git a/textproc/py-libxml2/Makefile b/textproc/py-libxml2/Makefile > index 33a8d506f52f..84796bac21b3 100644 > --- a/textproc/py-libxml2/Makefile > +++ b/textproc/py-libxml2/Makefile > @@ -1,9 +1,8 @@ > -PORTREVISION= 0 > +PORTREVISION= 1 > CATEGORIES= textproc gnome python > PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} > > COMMENT= Python interface for XML parser library for GNOME > -MASTERDIR= ${.CURDIR}/../libxml2 > > USES+= gnome python shebangfix > USE_GNOME= libxml2 > @@ -14,19 +13,15 @@ SHEBANG_FILES= *.py doc/*.py python/*.py python/tests/*.py > # multiple versions are installed > CMAKE_ARGS= -DPython_EXECUTABLE=${PYTHON_CMD} > > -OPTIONS_EXCLUDE= ${OPTIONS_DEFINE} > +MASTERDIR= ${.CURDIR}/../libxml2 > > -# Tell master port we're a slave port > -LIBXML2_SLAVE= python > -# Grab pkg-descr from slave port > DESCR= ${.CURDIR}/pkg-descr > +PLIST= ${.CURDIR}/pkg-plist > > -# Don't append pkg-plist from master port > -PLIST= > +OPTIONS_EXCLUDE= ${OPTIONS_DEFINE} > > -PLIST_FILES= ${PYTHON_SITELIBDIR}/drv_libxml2.py \ > - ${PYTHON_SITELIBDIR}/libxml2.py \ > - ${PYTHON_SITELIBDIR}/libxml2mod.so > +# Tell master port we're a slave port > +LIBXML2_SLAVE= python > > do-install: > ${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR} > diff --git a/textproc/py-libxml2/pkg-plist b/textproc/py-libxml2/pkg-plist > new file mode 100644 > index 000000000000..9cd0595dabe2 > --- /dev/null > +++ b/textproc/py-libxml2/pkg-plist > @@ -0,0 +1,7 @@ > +%%PYTHON_SITELIBDIR%%/__pycache__/drv_libxml2%%PYTHON_EXT_SUFFIX%%.opt-1.pyc > +%%PYTHON_SITELIBDIR%%/__pycache__/drv_libxml2%%PYTHON_EXT_SUFFIX%%.pyc > +%%PYTHON_SITELIBDIR%%/__pycache__/libxml2%%PYTHON_EXT_SUFFIX%%.opt-1.pyc > +%%PYTHON_SITELIBDIR%%/__pycache__/libxml2%%PYTHON_EXT_SUFFIX%%.pyc > +%%PYTHON_SITELIBDIR%%/drv_libxml2.py > +%%PYTHON_SITELIBDIR%%/libxml2.py > +%%PYTHON_SITELIBDIR%%/libxml2mod.so Hi, Wouldn't the correct solution to use the PYTHONDONTWRITEBYTECODE environment variable instead of packaging bytecode files which seems rather fragile? Best regards, Daniel