Skip to content

Commit

Permalink
py-libxml2: Byte compile
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
BSDKaffee committed May 17, 2024
1 parent c1163c5 commit bb5ef64
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
6 changes: 6 additions & 0 deletions textproc/libxml2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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>
17 changes: 6 additions & 11 deletions textproc/py-libxml2/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}
Expand Down
7 changes: 7 additions & 0 deletions textproc/py-libxml2/pkg-plist
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bb5ef64

Please sign in to comment.