From owner-svn-ports-all@FreeBSD.ORG Sat Nov 9 13:09:50 2013 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6DCCCB35; Sat, 9 Nov 2013 13:09:50 +0000 (UTC) (envelope-from wg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5ACB92CAC; Sat, 9 Nov 2013 13:09:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA9D9oIc076127; Sat, 9 Nov 2013 13:09:50 GMT (envelope-from wg@svn.freebsd.org) Received: (from wg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA9D9oaj076126; Sat, 9 Nov 2013 13:09:50 GMT (envelope-from wg@svn.freebsd.org) Message-Id: <201311091309.rA9D9oaj076126@svn.freebsd.org> From: William Grzybowski Date: Sat, 9 Nov 2013 13:09:50 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r333286 - head/Mk X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Nov 2013 13:09:50 -0000 Author: wg Date: Sat Nov 9 13:09:49 2013 New Revision: 333286 URL: http://svnweb.freebsd.org/changeset/ports/333286 Log: Mk/bsd.python.mk: add staging support for easy_install This allows stage dir support for python packages using easy_install method from setuptools module. easy_install target does not support a --root so we workaround it with PYTHONUSERBASE and other user flags. Submitted by: nivit, wg With hat on: python Exp-run: bdrewery Modified: head/Mk/bsd.python.mk Modified: head/Mk/bsd.python.mk ============================================================================== --- head/Mk/bsd.python.mk Sat Nov 9 13:02:19 2013 (r333285) +++ head/Mk/bsd.python.mk Sat Nov 9 13:09:49 2013 (r333286) @@ -452,7 +452,12 @@ PYDISTUTILS_INSTALLARGS?= -O 1 -N -S ${ -d ${PYEASYINSTALL_SITELIBDIR} \ -s ${PYEASYINSTALL_BINDIR} \ ${WRKSRC}/dist/${PYEASYINSTALL_EGG} -.if ${PREFIX} != ${LOCALBASE} +.if !defined(NO_STAGE) +MAKE_ENV+= PYTHONUSERBASE=${STAGEDIR}${PYTHONBASE} +PYDISTUTILS_INSTALLARGS:= -m -q --user ${PYDISTUTILS_INSTALLARGS} +.endif + +.if ${PREFIX} != ${LOCALBASE} || !defined(NO_STAGE) MAKE_ENV+= PYTHONPATH=${PYEASYINSTALL_SITELIBDIR} .endif @@ -477,7 +482,11 @@ PLIST_SUB+= PYEASYINSTALL_EGG=${PYEASYI pre-install: pre-install-easyinstall pre-install-easyinstall: +.if defined(NO_STAGE) @${MKDIR} ${PYEASYINSTALL_SITELIBDIR} +.else + @${MKDIR} ${STAGEDIR}${PYEASYINSTALL_SITELIBDIR} +.endif add-plist-post: add-plist-easyinstall add-plist-easyinstall: @@ -489,6 +498,20 @@ add-plist-easyinstall: @${ECHO_CMD} "@exec ${PRINTF} '1a\n./${PYEASYINSTALL_EGG}\n.\nw\nq\n' | \ /bin/ed ${PYEASYINSTALL_SITELIBDIR}/easy-install.pth" \ >> ${TMPPLIST} + +.if !defined(NO_STAGE) +.if !target(stage-python-compileall) +stage-python-compileall: + (cd ${STAGEDIR}${PREFIX} && \ + ${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py \ + -d ${PYTHONPREFIX_SITELIBDIR} -f ${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;} && \ + ${PYTHON_CMD} -O ${PYTHON_LIBDIR}/compileall.py \ + -d ${PYTHONPREFIX_SITELIBDIR} -f ${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;}) +.endif + +post-install: stage-python-compileall +.endif + .endif # defined(USE_PYDISTUTILS) && ${USE_PYDISTUTILS} == "easy_install" # distutils support @@ -496,7 +519,7 @@ PYSETUP?= setup.py PYDISTUTILS_CONFIGUREARGS?= PYDISTUTILS_BUILDARGS?= PYDISTUTILS_INSTALLARGS?= -c -O1 --prefix=${PREFIX} -.if !defined(NO_STAGE) +.if !defined(NO_STAGE) && defined(USE_PYDISTUTILS) && ${USE_PYDISTUTILS} != "easy_install" PYDISTUTILS_INSTALLARGS+= --root=${STAGEDIR} .endif PYDISTUTILS_PKGNAME?= ${PORTNAME} @@ -529,10 +552,12 @@ add-plist-pymod: ${SED} '/^\.$$/d' > ${WRKDIR}/.localmtree @${ECHO_CMD} "${_RELSITELIBDIR}" >> ${WRKDIR}/.localmtree @${ECHO_CMD} "${_RELLIBDIR}" >> ${WRKDIR}/.localmtree - @${SED} -e 's|^${PREFIX}/||' \ + @${SED} -e 's|^${STAGEDIR}${PREFIX}/||' \ + -e 's|^${PREFIX}/||' \ -e 's|^\(man/man[0-9]\)/\(.*\.[0-9]\)$$|\1/\2${MANEXT}|' \ ${_PYTHONPKGLIST} | ${SORT} >> ${TMPPLIST} - @${SED} -e 's|^${PREFIX}/\(.*\)/\(.*\)|\1|' ${_PYTHONPKGLIST} | \ + @${SED} -e 's|^${STAGEDIR}${PREFIX}/\(.*\)/\(.*\)|\1|' \ + -e 's|^${PREFIX}/\(.*\)/\(.*\)|\1|' ${_PYTHONPKGLIST} | \ ${AWK} '{ num = split($$0, a, "/"); res=""; \ for(i = 1; i <= num; ++i) { \ if (i == 1) res = a[i]; \ @@ -546,6 +571,8 @@ add-plist-pymod: ${ECHO_CMD} "@unexec rmdir \"%D/$${line}\" 2>/dev/null || true"; \ }; \ done | ${SORT} | uniq | ${SORT} -r >> ${TMPPLIST} + @${ECHO_CMD} "@unexec rmdir \"%D/${PYTHON_SITELIBDIR:S;${PYTHONBASE}/;;}\" 2>/dev/null || true" >> ${TMPPLIST} + @${ECHO_CMD} "@unexec rmdir \"%D/${PYTHON_LIBDIR:S;${PYTHONBASE}/;;}\" 2>/dev/null || true" >> ${TMPPLIST} .else .if ${PYTHON_REL} >= 320 && defined(PYTHON_PY3K_PLIST_HACK)