When to use PYTHONPREFIX_SITELIBDIR?

Charlie Kester corky1951 at comcast.net
Mon Oct 11 21:54:06 UTC 2010


A port I maintain, multimedia/gpodder, needs to install a set of Python
modules from another distfile called mygpoclient.

Here are the pertinent excerpts from the port Makefile, as I inherited
it from the previous maintainer:

DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:DEFAULT \
		${MGC_DISTNAME}${EXTRACT_SUFX}:mygpoclient

...

MGC_DISTNAME= mygpoclient-1.4
MGC_WRKSRC= ${WRKDIR}/${MGC_DISTNAME}/mygpoclient

...

pre-build:
	@${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py ${MGC_WRKSRC}
	@${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py ${MGC_WRKSRC}

pre-install:
	@${MKDIR} ${PYTHON_SITELIBDIR}/mygpoclient
	@(cd ${MGC_WRKSRC} && ${COPYTREE_SHARE} . ${PYTHON_SITELIBDIR}/mygpoclient)

The pkg-plist then contains multiple lines of the following form, to
delete the files installed in the pre-install step:

...
%%PYTHON_SITELIBDIR%%/mygpoclient/api.py
%%PYTHON_SITELIBDIR%%/mygpoclient/api.pyc
...

I've submitted a PR to update gpodder to 2.8 (and now 2.9), but the
committers are reporting plist errors related to these mygpoclient
files.  The files are not being removed when gpodder is pkg-deleted.

While researching this, I ran some simple tests using
ports-mgmt/genplist and noticed that the mygpoclient files were being
installed under /usr/local/lib and NOT under the tmp prefix as expected.

("genplist create /tmp/portname" sets PREFIX to /tmp/portname and
installs the port there.  I like to use it as a quick-and-dirty test of
the install.)

So I tried using PYTHONPREFIX_SITELIBDIR in the pre-install commands,
and this seemed to work here on my own machine, testing with both
genplist and tinderbox.  (The pkg-plist lines were unchanged.)

Today, however, I got another report of a plist failure.  I'm not
sure if the version tested was using PYTHONPREFIX_SITELIBDIR and
will ask the committer about that.   But I would like to get some
advice from this list: is my approach correct?  Is there a better
way to accomplish the goal?


More information about the freebsd-python mailing list