From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 7BAAF1381F3 for ; Wed, 21 Nov 2012 09:04:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1577221C0A3; Wed, 21 Nov 2012 09:04:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7098B21C0AA for ; Wed, 21 Nov 2012 09:04:17 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5E4E933D7C7 for ; Wed, 21 Nov 2012 09:04:16 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 2279) id 2811620C65; Wed, 21 Nov 2012 09:04:15 +0000 (UTC) From: "Michal Gorny (mgorny)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, mgorny@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog python-r1.eclass X-VCS-Repository: gentoo-x86 X-VCS-Files: ChangeLog python-r1.eclass X-VCS-Directories: eclass X-VCS-Committer: mgorny X-VCS-Committer-Name: Michal Gorny Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Message-Id: <20121121090415.2811620C65@flycatcher.gentoo.org> Date: Wed, 21 Nov 2012 09:04:15 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 52d456ed-afd2-44cb-8fcb-a69d8a7fcfc6 X-Archives-Hash: a81baa19f7e5762f80a4a61d6d3ed61a mgorny 12/11/21 09:04:15 Modified: ChangeLog python-r1.eclass Log: Introduce python_domodule() to install Python modules. Revision Changes Path 1.515 eclass/ChangeLog file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.515&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.515&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.514&r2=1.515 Index: ChangeLog =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v retrieving revision 1.514 retrieving revision 1.515 diff -u -r1.514 -r1.515 --- ChangeLog 21 Nov 2012 09:01:50 -0000 1.514 +++ ChangeLog 21 Nov 2012 09:04:14 -0000 1.515 @@ -1,6 +1,9 @@ # ChangeLog for eclass directory # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.514 2012/11/21 09:01:50 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.515 2012/11/21 09:04:14 mgorny Exp $ + + 21 Nov 2012; Michał Górny python-r1.eclass: + Introduce python_domodule() to install Python modules. 21 Nov 2012; Michał Górny python-r1.eclass: Introduce python_doscript() to install Python scripts. 1.20 eclass/python-r1.eclass file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.20&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.20&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.19&r2=1.20 Index: python-r1.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- python-r1.eclass 21 Nov 2012 09:01:50 -0000 1.19 +++ python-r1.eclass 21 Nov 2012 09:04:14 -0000 1.20 @@ -1,6 +1,6 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.19 2012/11/21 09:01:50 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.20 2012/11/21 09:04:14 mgorny Exp $ # @ECLASS: python-r1 # @MAINTAINER: @@ -816,3 +816,87 @@ _python_ln_rel "${ED}"/usr/bin/python-exec "${D}/${d}/${oldfn}" || die done } + +# @ECLASS-VARIABLE: python_moduleroot +# @DEFAULT_UNSET +# @DESCRIPTION: +# The current module root for python_domodule(). The path can be either +# an absolute system path (it must start with a slash, and ${D} will be +# prepended to it) or relative to the implementation's site-packages directory +# (then it must start with a non-slash character). +# +# When unset, the modules will be installed in the site-packages root. +# +# Can be set indirectly through the python_moduleinto() function. +# +# Example: +# @CODE +# src_install() { +# local python_moduleroot=bar +# # installs ${PYTHON_SITEDIR}/bar/baz.py +# python_foreach_impl python_domodule baz.py +# } +# @CODE + +# @FUNCTION: python_moduleinto +# @USAGE: +# @DESCRIPTION: +# Set the current module root. The new value will be stored +# in the 'python_moduleroot' environment variable. The new value need +# be relative to the site-packages root. +# +# Alternatively, you can set the variable directly. +python_moduleinto() { + debug-print-function ${FUNCNAME} "${@}" + + python_moduleroot=${1} +} + +# @FUNCTION: python_domodule +# @USAGE: ... +# @DESCRIPTION: +# Install the given modules (or packages) into the current +# python_moduleroot. The list can mention both modules (files) +# and packages (directories). All listed files will be installed +# for all enabled implementations, and compiled afterwards. +# +# Example: +# @CODE +# src_install() { +# # (${PN} being a directory) +# python_foreach_impl python_domodule ${PN} +# } +# @CODE +python_domodule() { + debug-print-function ${FUNCNAME} "${@}" + + [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).' + + local d + if [[ ${python_moduleroot} == /* ]]; then + # absolute path + d=${python_moduleroot} + else + # relative to site-packages + local PYTHON_SITEDIR=${PYTHON_SITEDIR} + [[ ${PYTHON_SITEDIR} ]] || python_export PYTHON_SITEDIR + + d=${PYTHON_SITEDIR}/${python_moduleroot} + fi + + local INSDESTTREE + + insinto "${d}" + doins -r "${@}" + + # erm, python2.6 can't handle passing files to compileall... + case "${EPYTHON}" in + python*) + "${PYTHON}" -m compileall -q "${D}/${d}" + "${PYTHON}" -OO -m compileall -q -f "${D}/${d}" + ;; + *) + "${PYTHON}" -m compileall -q "${D}/${d}" + ;; + esac +}