Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jun 2012 23:02:00 +0400
From:      Andrey Zonov <andrey@zonov.org>
To:        miwi@FreeBSD.org
Cc:        John Baldwin <jhb@freebsd.org>, freebsd-python@freebsd.org
Subject:   Re: Earlier patch to always install python's eggs as unpacked files
Message-ID:  <4FD8E3A8.7020001@zonov.org>
In-Reply-To: <4FD8D5EC.4000409@zonov.org>
References:  <201206121725.03767.jhb@freebsd.org> <20120613215312.5d238750.miwi@FreeBSD.org> <4FD8D5EC.4000409@zonov.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------010408050501040403060806
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 6/13/12 10:03 PM, Andrey Zonov wrote:
> On 6/13/12 5:53 PM, Martin Wilke wrote:
>> On Tue, 12 Jun 2012 17:25:03 -0400
>> John Baldwin<jhb@freebsd.org> wrote:
>>
>>> There was a patch in this post from last year
>>> (http://lists.freebsd.org/pipermail/freebsd-python/2011-August/003701.html)
>>>
>>> to make python packages unpack eggs to avoid problems with shared egg
>>> caches and to avoid requiring Internet access during pkg_add. Andrey
>>> mentioned doing an exp run with his patch. I don't see the patch
>>> committed to bsd.python.mk or any further replies to the thread. We
>>> are running into some of these issues using our own packages at my
>>> work. Were there any problems with this patch or during it's exp run?
>>>
>>
>> Hi John and Andrey,
>>
>> I've add that to my todo for next exprun over the weekend.
>>
>> - Martin
>>
>
> Hi,
>
> There is a problem with this patch. If you build package for one FreeBSD
> version and install package to another, easy_install will fetch sources
> and will try to build an egg. I found that during upgrading from 8.2 to
> 9.0.
>
> My suggestion is to replace post-install/pre-deinstall actions to
> manually editing easy-install.pth. I mean this code:
>
> @${ECHO_CMD} "@unexec ${PYEASYINSTALL_CMD}
> ${PYEASYINSTALL_UNINSTALLARGS}" \
>  > ${TMPPLIST}
> @${ECHO_CMD} "@unexec ${RM} -rf
> ${PYTHON_SITELIBDIR}/${PYEASYINSTALL_EGG}" >> ${TMPPLIST}
> @${ECHO_CMD} "@exec ${SETENV} PYTHONPATH=${PYEASYINSTALL_SITELIBDIR} \
> ${PYEASYINSTALL_CMD} ${PYEASYINSTALL_INSTALLARGS}" \
>  >> ${TMPPLIST}
>
> What do you think?
>
> PS: I don't really like this solution.
>

Attached patch works for pymongo.

-- 
Andrey Zonov

--------------010408050501040403060806
Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0";
	name="bsd.python.mk.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="bsd.python.mk.patch"

--- Mk/bsd.python.mk.orig	2011-11-07 16:40:53.000000000 +0400
+++ Mk/bsd.python.mk	2012-06-13 22:48:33.000000000 +0400
@@ -460,7 +460,7 @@
 
 PYDISTUTILS_BUILD_TARGET?=		bdist_egg
 PYDISTUTILS_INSTALL_TARGET?=	easy_install
-PYDISTUTILS_INSTALLARGS?=		-O 1 -N -S ${PYTHON_SITELIBDIR} \
+PYDISTUTILS_INSTALLARGS?=		-Z --record ${TMPPLIST}.egg -O 1 -N -S ${PYTHON_SITELIBDIR} \
 								-d ${PYEASYINSTALL_SITELIBDIR} \
 								-s ${PYEASYINSTALL_BINDIR} \
 								${WRKSRC}/dist/${PYEASYINSTALL_EGG}
@@ -496,13 +496,17 @@
 add-plist-post: add-plist-easyinstall
 add-plist-easyinstall:
 	@# @unexec line must be located before any other line while @exec must not.
-	@${CAT} ${TMPPLIST} > ${TMPPLIST}.pei_tmp
-	@${ECHO_CMD} "@unexec ${PYEASYINSTALL_CMD} ${PYEASYINSTALL_UNINSTALLARGS}" \
+	@${TOUCH} ${TMPPLIST}.egg
+	@${SED} -i "" -e 's,^${PREFIX}/,,' ${TMPPLIST}.egg
+	@${GREP} -v "^${PYTHON_SITELIBDIR:S,${PREFIX}/,,}/${PYEASYINSTALL_EGG}$$" ${TMPPLIST} \
+		> ${TMPPLIST}.pei_tmp || ${TRUE}
+	@${ECHO_CMD} "@unexec ${RM} -f ${PYTHON_SITELIBDIR}/${PYEASYINSTALL_EGG}.pth" \
 		> ${TMPPLIST}
-	@${CAT} ${TMPPLIST}.pei_tmp >> ${TMPPLIST}
-	@${ECHO_CMD} "@exec ${SETENV} PYTHONPATH=${PYEASYINSTALL_SITELIBDIR} \
-		${PYEASYINSTALL_CMD} ${PYEASYINSTALL_INSTALLARGS}" \
+	@${SORT} -ru ${TMPPLIST}.egg ${TMPPLIST}.pei_tmp >> ${TMPPLIST}
+	@${ECHO_CMD} "@unexec ${RM} -rf ${PYTHON_SITELIBDIR}/${PYEASYINSTALL_EGG}" \
 		>> ${TMPPLIST}
+	@${ECHO_CMD} "@exec ${ECHO_CMD} './${PYEASYINSTALL_EGG}' \
+		>> ${PYTHON_SITELIBDIR}/${PYEASYINSTALL_EGG}.pth" >> ${TMPPLIST}
 .endif		# defined(USE_PYDISTUTILS) && ${USE_PYDISTUTILS} == "easy_install"
 
 # distutils support

--------------010408050501040403060806--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FD8E3A8.7020001>